{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/1201","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1201/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1201/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1201/events","html_url":"https://github.com/bazelbuild/bazel/issues/1201","id":151220674,"number":1201,"title":"CentOS 6.7 building with custom GCC","user":{"login":"stephenroller","id":31896,"avatar_url":"https://avatars.githubusercontent.com/u/31896?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenroller","html_url":"https://github.com/stephenroller","followers_url":"https://api.github.com/users/stephenroller/followers","following_url":"https://api.github.com/users/stephenroller/following{/other_user}","gists_url":"https://api.github.com/users/stephenroller/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenroller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenroller/subscriptions","organizations_url":"https://api.github.com/users/stephenroller/orgs","repos_url":"https://api.github.com/users/stephenroller/repos","events_url":"https://api.github.com/users/stephenroller/events{/privacy}","received_events_url":"https://api.github.com/users/stephenroller/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-26T19:36:06Z","updated_at":"2016-04-26T22:06:14Z","closed_at":"2016-04-26T22:06:14Z","body":"Hi all,\r\n\r\nThanks for your hard work on the project.\r\n\r\nI've been trying to get TensorFlow working on a cluster which runs on CentOS 6.7 with a custom GCC. I can't use the binary releases because of the older version of glibc, which we do not have the option of upgrading (cluster supports hundreds of other users who are infinitely more important than me). So the route to victory here is Compile Bazel -> Compile Tensorflow -> Profit.\r\n\r\nThis issue seemed to be resolved in #760, but here I am. I'm using HEAD, but the also tried 0.2.2b, but I haven't tried 0.1.1.\r\n\r\nThe new cc_configure.bzl seems to successfully load my environment variables (woot!) and set the proper options *for part of ./compile.sh*. I get past the bootstrapping part (where we historically usually see complaints about GLIB being too old), and then make it to the Building Bazel with Bazel step.\r\n\r\n```\r\nINFO: You can skip this first step by providing a path to the bazel binary as second argument:\r\nINFO:    ./compile.sh compile /path/to/bazel\r\n🍃  Building Bazel from scratch......\r\n🍃  Building Bazel with Bazel.\r\nWARNING: /work/01813/roller/maverick/packages/bazel/src/bazel/src/main/native/BUILD:46:16: in includes attribute of cc_binary rule //src/main/native:libunix.so: '.' resolves to 'src/main/native' not in 'third_party'. This will be an error in the future.\r\nWARNING: /work/01813/roller/maverick/packages/bazel/src/bazel/src/main/protobuf/BUILD:37:1: in includes attribute of cc_library rule //src/main/protobuf:command_server_cc_proto: '.' resolves to 'src/main/protobuf' not in 'third_party'. This will be an error in the future. Since this rule was created by the macro 'cc_grpc_library', the error might have been caused by the macro implementation in /work/01813/roller/maverick/packages/bazel/src/bazel/tools/build_rules/genproto.bzl:104:18.\r\nINFO: Found 1 target...\r\n>>>>> # //src:java-version [action 'Executing genrule //src:java-version']\r\n(cd /tmp/bazel.HerjB3ym/out/bazel && \\\r\n  exec env - \\\r\n    PATH=/opt/apps/gcc/4.9.1/bin:/opt/apps/git/2.7.0/bin:/usr/local/bin:/usr/bin:/bin \\\r\n    TMPDIR=/tmp \\\r\n  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh;\r\n          VERSION_LINE=$(cat bazel-out/local-fastbuild/bin/src/java_toolchain_content | grep target_version);\r\n          JAVA_VERSION=$(echo ${VERSION_LINE} | sed '\\''s/.*value=\\\"\\([^\\\"]\\)\\\".*/\\1/'\\'');\r\n          if [ -z \"${JAVA_VERSION}\" ]; then\r\n            echo \"1.8\" >bazel-out/local-fastbuild/genfiles/src/java.version  # Java 8 is the default\r\n          elif [[ \"${JAVA_VERSION}\" =~ ^[0-9]+$ ]]; then\r\n            echo \"1.${JAVA_VERSION}\" >bazel-out/local-fastbuild/genfiles/src/java.version  # Add 1. before 7 or 8\r\n          else\r\n            echo \"${JAVA_VERSION}\" >bazel-out/local-fastbuild/genfiles/src/java.version\r\n          fi\r\n          ')\r\n>>>>> # //src/main/tools:process-tools [action 'Compiling src/main/tools/process-tools.c']\r\n(cd /tmp/bazel.HerjB3ym/out/bazel && \\\r\n  exec env - \\\r\n    PATH=/opt/apps/gcc/4.9.1/bin:/opt/apps/git/2.7.0/bin:/usr/local/bin:/usr/bin:/bin \\\r\n    TMPDIR=/tmp \\\r\n  /opt/apps/gcc/4.9.1/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/opt/apps/gcc/4.9.1/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 '-std=c99' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__=\"redacted\"' '-D__TIMESTAMP__=\"redacted\"' '-D__TIME__=\"redacted\"' '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.o' -MD -MF bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.d -fPIC -c src/main/tools/process-tools.c -o bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.o)\r\nERROR: /work/01813/roller/maverick/packages/bazel/src/bazel/src/main/tools/BUILD:11:1: C++ compilation of rule '//src/main/tools:process-tools' failed: gcc failed: error executing command\r\n  (cd /tmp/bazel.HerjB3ym/out/bazel && \\\r\n  exec env - \\\r\n    PATH=/opt/apps/gcc/4.9.1/bin:/opt/apps/git/2.7.0/bin:/usr/local/bin:/usr/bin:/bin \\\r\n    TMPDIR=/tmp \\\r\n  /opt/apps/gcc/4.9.1/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/opt/apps/gcc/4.9.1/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 '-std=c99' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__=\"redacted\"' '-D__TIMESTAMP__=\"redacted\"' '-D__TIME__=\"redacted\"' '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.o' -MD -MF bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.d -fPIC -c src/main/tools/process-tools.c -o bazel-out/local-fastbuild/bin/src/main/tools/_objs/process-tools/src/main/tools/process-tools.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.\r\n/opt/apps/gcc/4.9.1/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/cc1: error while loading shared libraries: libcloog-isl.so.4: cannot open shared object file: No such file or directory\r\nTarget //src:bazel failed to build\r\nINFO: Elapsed time: 2.332s, Critical Path: 0.01s\r\n```\r\n\r\nRunning the failed command also fails, with the same error message. However, if I drop the \"exec env - PATH\" bit, then GCC sees the LD_LIBRARY_PATH and naturally finds the elusive libcloog-isl.so.4. So somewhere along the building Bazel with Bazel step, the options inferred in cc_configure.bzl are getting lost.\r\n\r\nDoes anyone have any suggestions?\r\n\r\n(Just to make sure i'm not insane, the following confirms libcloog-isl does exist...)\r\n```\r\n$ ls /opt/apps/gcc/4.9.1/lib | grep cloog\r\ncloog-isl\r\nlibcloog-isl.a\r\nlibcloog-isl.la\r\nlibcloog-isl.so\r\nlibcloog-isl.so.4\r\nlibcloog-isl.so.4.0.0\r\n```\r\n\r\nEnvironment\r\n```\r\nPATH=/opt/apps/gcc/4.9.1/bin:/opt/apps/git/2.7.0/bin:/usr/local/bin:/usr/bin:/bin\r\nCC=/opt/apps/gcc/4.9.1/bin/gcc\r\nCXX=/opt/apps/gcc/4.9.1/bin/cpp\r\nCPLUS_INCLUDE_PATH=/opt/apps/gcc/4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include/:/opt/apps/gcc/4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include-fixed:/opt/apps/gcc/4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include-fixed\r\nLD_LIBRARY_PATH=/opt/apps/gcc/4.9.1/lib:/opt/apps/gcc/4.9.1/lib64\r\nEXTRA_BAZEL_ARGS=\"-s --verbose_failures --ignore_unsupported_sandboxing --genrule_strategy=standalone --spawn_strategy=standalone --jobs=1\"\r\n```"},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/214902373","html_url":"https://github.com/bazelbuild/bazel/issues/1201#issuecomment-214902373","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1201","id":214902373,"user":{"login":"stephenroller","id":31896,"avatar_url":"https://avatars.githubusercontent.com/u/31896?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenroller","html_url":"https://github.com/stephenroller","followers_url":"https://api.github.com/users/stephenroller/followers","following_url":"https://api.github.com/users/stephenroller/following{/other_user}","gists_url":"https://api.github.com/users/stephenroller/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenroller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenroller/subscriptions","organizations_url":"https://api.github.com/users/stephenroller/orgs","repos_url":"https://api.github.com/users/stephenroller/repos","events_url":"https://api.github.com/users/stephenroller/events{/privacy}","received_events_url":"https://api.github.com/users/stephenroller/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T22:06:14Z","updated_at":"2016-04-26T22:06:14Z","body":"Ahh shucks. It seems that GCC's cc1 and cc1plus couldn't find the necessary libcloog-isl library. An unfortunate result of the way the admin's have set up the multiple GCC compilers, require that LD_LIBRARY_PATH be set to use them.\r\n\r\nI ended up writing some sad little shell wrappers to call gcc, cpp, cc1 and cc1plus with the necessary LD_LIBRARY_PATH set, and this resolved the issue.\r\n\r\nA more principled solution would have been to recompile GCC from scratch in my own directory.\r\n"}}