Reputation: 6063
I would like to install bazel from source, and use bazel to compile tensorflow on a cluster running redhat 6.7. When I try to install bazel, the glibc version (2.12) is too old. I do not have root access to the cluster. Is it possible to install tensorflow in this case?
My system information:
-bash-4.1$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
-bash-4.1$ which gcc
/usr/bin/gcc
-bash-4.1$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
-bash-4.1$ ldd --version
ldd (GNU libc) 2.12
The system has newer gcc installed as well. I tried using it, bazel still won't compile.
-bash-4.1$ /usr/local/gcc/4.8.4/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc/4.8.4/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc/4.8.4/libexec/gcc/x86_64-unknown-linux-gnu/4.8.4/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc/4.8.4
Thread model: posix
gcc version 4.8.4 (GCC)
When I was compiling bazel, I got the following error:
bazel-0.1.1/_bin/build-runfiles: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found
Some people also reported this issue: https://github.com/tensorflow/tensorflow/issues/110 and https://github.com/tensorflow/tensorflow/issues/527
How can I install the missing dependency locally, and have bazel pick up the right library?
Upvotes: 4
Views: 6844
Reputation: 191
In case anyone need to do this manually:
Compile up-to-date glibc, gcc and all their dependencies from source with the option --disable-rpath
to avoid glibc path being hard coded to system default. Do NOT add glibc to LD_LIBRARY_PATH
directly, or all executables including rm
will stop working.
Compile python with your gcc, install pip and the official wheel
./configure --prefix=$PWD/build --enable-unicode=ucs4 --with-cxx-main=g++ && make && make install
alias tensorflow='${GLIBC_PATH}/lib/ld-2.23.so --library-path ${GLIBC_PATH}/lib:${LD_LIBRARY_PATH}
which python'
After able to import tensorflow module without any error, you can use any other computer (possibly ubuntu VM on your PC) to compile a custom wheel with machine specific option, and copy that to your cluster following the guide
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --copt=-msse4.1 //tensorflow/tools/pip_package:build_pip_package
Upvotes: 1
Reputation: 2370
You should be able to compile from source with a newer version of Bazel exporting LD_FLAGS, CXX and CC, and tweaking the tools/cpp/CROSSTOOL file of Bazel. Please open a github issue on Bazel (https://github.com/bazelbuild/bazel/issues) if you have further questions.
I am currently working on making all that easier. Sorry for the mess.
Upvotes: 3