bazel: failed to install bazel on Red Hat 6.7

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 using gcc 4.8.4, I got the following error:

bazel-0.1.1/_bin/build-runfiles: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found

How can I install the missing dependency locally, and have bazel pick up the right version of glib? What part of tools/cpp/CROSSTOOL should I modify? What environment variables should I set before ./compile.sh

I am trying to install bazel-0.1.1 instead of bazel-0.1.2 because the latter does not compile tensorflow. https://github.com/tensorflow/tensorflow/issues/469

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 110 (54 by maintainers)

Commits related to this issue

Most upvoted comments

Why can’t bazel simply respect my PATH?

Such was what I kept screaming to google until it led me to this issue. When I set up my compiler tool chain, I expect the first cc and ld found in my PATH to be the working combination. Yet bazel secretly used my cc and instructed my cc to pick a funny ld.

πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰-Wl,-R works great! Linker rocks! I really appreciate @damienmg 's help on this issue.

In summary, to build bazel with a customized gcc and gcxxlib other than the standard paths, I customized tools/cpp/CROSSTOOL

-  tool_path { name: "gcc" path: "/usr/bin/gcc" }
+  tool_path { name: "gcc" path: "/lustre/usr/gcc/4.9/bin/gcc" }

+  linker_flag: "-Wl,-R/lustre/usr/gcc/4.9/lib64"

+  cxx_builtin_include_directory: "/lustre/usr/gcc/4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/include"
+  cxx_builtin_include_directory: "/lustre/usr/gcc/4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/include-fixed"
+  cxx_builtin_include_directory: "/lustre/usr/gcc/4.9/include/c++/4.9.3"

Then comment out the atexit line in scripts/bootstrap/buildenv.sh:

-  atexit "rm -fr ${DIR}"

Finally build bazel:

$ for d in `ls | grep 'bazel-'`; do unlink $d; done; pkill java; rm -rf ~/.cache/bazel; export EXTRA_BAZEL_ARGS='--ignore_unsupported_sandboxing -s';  ./compile.sh
...
INFO: Elapsed time: 40.780s, Critical Path: 36.66s

Build successful! Binary is here: /home/rpmbuild/tmp/bazel/output/bazel