参考问题汇总
centos安装tensorFlow版本的时候会遇到的一些问题,参考这个链接:https://blog.csdn.net/luoyexuge/article/details/78321220。
问题一
[root@]$ Exception in thread "DictLoader" java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1523963835308-0/libtensorflow_jni.so: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by /tmp/tensorflow_native_libraries-1523963835308-0/libtensorflow_jni.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:96)
at org.tensorflow.TensorFlow.init(TensorFlow.java:66)
at org.tensorflow.TensorFlow.(TensorFlow.java:70)
at org.tensorflow.SavedModelBundle.(SavedModelBundle.java:101)
at com.beibei.bigdata.recom.script.TfModelBundle.updateTfModelBundle(TfModelBundle.java:117)
at com.beibei.bigdata.recom.script.TfModelBundle.(TfModelBundle.java:71)
at com.beibei.bigdata.recom.script.TfLoadFactory.run(TfLoadFactory.java:193)
at java.lang.Thread.run(Thread.java:748)
问题二
[root@]$ Exception in thread "DictLoader" java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1523974562408-0/libtensorflow_jni.so: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /tmp/tensorflow_native_libraries-1523974562408-0/libtensorflow_jni.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:101)
at org.tensorflow.TensorFlow.init(TensorFlow.java:66)
at org.tensorflow.TensorFlow.(TensorFlow.java:70)
at org.tensorflow.SavedModelBundle.(SavedModelBundle.java:101)
at com.beibei.bigdata.recom.script.TfModelBundle.updateTfModelBundle(TfModelBundle.java:117)
at com.beibei.bigdata.recom.script.TfModelBundle.(TfModelBundle.java:71)
at com.beibei.bigdata.recom.script.TfLoadFactory.run(TfLoadFactory.java:193)
at java.lang.Thread.run(Thread.java:748)
问题三
[root@]$ Exception in thread "DictLoader" java.lang.UnsatisfiedLinkError: /tmp/tensorflow_native_libraries-1524018100794-0/libtensorflow_jni.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /tmp/tensorflow_native_libraries-1524018100794-0/libtensorflow_jni.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:101)
at org.tensorflow.TensorFlow.init(TensorFlow.java:66)
at org.tensorflow.TensorFlow.(TensorFlow.java:70)
at org.tensorflow.SavedModelBundle.(SavedModelBundle.java:101)
at com.beibei.bigdata.recom.script.TfModelBundle.updateTfModelBundle(TfModelBundle.java:117)
at com.beibei.bigdata.recom.script.TfModelBundle.(TfModelBundle.java:71)
at com.beibei.bigdata.recom.script.TfLoadFactory.run(TfLoadFactory.java:193)
at java.lang.Thread.run(Thread.java:748)
解决方案
针对问题一
升级glibc到glibc-2.17版本,由于我只是在预发环境升级的,所以运维同学在升级的时候可以采用自己的方法进行升级,我这边只是记录我的升级步骤。
参考链接:https://blog.csdn.net/wyl9527/article/details/78256066,之前网上有推荐说采用软链接方式,但是没成功,最后还是采用覆盖的方式
直接覆盖了旧的glibc
tar –zxvf glibc-2.17.tar.gz
cd glibc-2.17
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make –j4
make install
安装后查看是否符合要求
针对问题二/三
升级gcc到gcc-6.1.0,参考链接https://blog.csdn.net/zr1076311296/article/details/51334538。
升级完以后拷贝最新的libstdc++.so
cp /usr/local/lib64/libstdc++.so.6.0.22 /usr/lib64/
ln -s/usr/lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
修改软链接(备份旧gcc版本,软链新gcc版本)
mv /usr/bin/gcc /usr/bin/gcc4.4.7
mv /usr/bin/g++ /usr/bin/g++4.4.7
mv /usr/bin/cc /usr/bin/cc4.4.7
mv /usr/bin/c++ /usr/bin/c++4.4.7
ln -s /usr/local/bin/gcc /usr/bin/gcc
ln -s /usr/local/bin/g++ /usr/bin/g++
ln -s /usr/local/bin/cc /usr/bin/cc
ln -s /usr/local/bin/c++ /usr/bin/c++
安装后查看是否符合要求