Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ compilation of rule '//src/main/tools:linux-sandbox' failed #2057

Closed
linrio opened this issue Nov 8, 2016 · 4 comments
Closed

C++ compilation of rule '//src/main/tools:linux-sandbox' failed #2057

linrio opened this issue Nov 8, 2016 · 4 comments
Assignees

Comments

@linrio
Copy link

linrio commented Nov 8, 2016

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

I manage to compile bazel from source, and I follow the Documentation. But I got the error:

If possible, provide a minimal example to reproduce the problem:

[llf@k20-1 bazel]$ ./compile.sh 
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
馃崈  Building Bazel from scratch.......
馃崈  Building Bazel with Bazel.
.WARNING: /tmp/bazel_PzOTkjF2/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_PzOTkjF2/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
INFO: Found 1 target...
ERROR: /home/llf/support/bazel/src/main/tools/BUILD:19:1: C++ compilation of rule '//src/main/tools:linux-sandbox' failed: process-wrapper failed: error executing command 
  (cd /tmp/bazel_PzOTkjF2/out/bazel-sandbox/d6b121ed-adbe-4321-84b0-6ef25aee0916-6/execroot/bazel && \
  exec env - \
    LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64:/usr/local/cuda-7.5/lib64: \
    PATH=:/llf/usr/local/gmp/include:/llf/usr/local/mpfr/include:/home/llf/usr/local/include:/usr/include:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/home/llf/usr/local/python/bin:/home/llf/usr/local/gmp/bin:/home/llf/usr/local/bazel/bin \
  /tmp/bazel_PzOTkjF2/out/execroot/bazel/_bin/process-wrapper -1 5 - - /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/local-opt/bin/src/main/tools/_objs/linux-sandbox/src/main/tools/linux-sandbox.d '-frandom-seed=bazel-out/local-opt/bin/src/main/tools/_objs/linux-sandbox/src/main/tools/linux-sandbox.o' -iquote . -iquote bazel-out/local-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/tools/linux-sandbox.cc -o bazel-out/local-opt/bin/src/main/tools/_objs/linux-sandbox/src/main/tools/linux-sandbox.o).
src/main/tools/linux-sandbox.cc: In function 'void CloseFds()':
src/main/tools/linux-sandbox.cc:104: error: 'nullptr' was not declared in this scope
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-free-nonheap-object"
Target //src:bazel failed to build
INFO: Elapsed time: 3.775s, Critical Path: 0.73s

ERROR: Could not build Bazel

How to address this problem?

Environment info

  • Operating System:
Linux k20-1 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

*Java version:

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

*GCC version:

[llf@k20-1 support]$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2010 Free Software Foundation, Inc.

*G++ version:

[llf@k20-1 support]$ g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2010 Free Software Foundation, Inc.
  • Bazel version (output of bazel info release):
[llf@k20-1 support]$ bazel info release
/home/llf/usr/local/bazel/bin/bazel: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /home/llf/usr/local/bazel/bin/bazel)
/home/llf/usr/local/bazel/bin/bazel: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /home/llf/usr/local/bazel/bin/bazel)
/home/llf/usr/local/bazel/bin/bazel: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /home/llf/usr/local/bazel/bin/bazel)
/home/llf/usr/local/bazel/bin/bazel: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /home/llf/usr/local/bazel/bin/bazel)
/home/llf/usr/local/bazel/bin/bazel: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /home/llf/usr/local/bazel/bin/bazel)

I copy the sound code from git clone https://github.com/bazelbuild/bazel.git . Is it the latest version?

  • If bazel info release returns "development version" or "(@non-git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

#1900 #583

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).

@aehlig
Copy link
Contributor

aehlig commented Nov 9, 2016

Over to @damienmg for the policy decission on how old C-compiliers we still support; also, as the problem is realted to #1900 which he handled and vpiced strong opinions there.

@damienmg
Copy link
Contributor

So we do not support such old version of gcc, on RHEL 6, you can follow the instruction there to install a new GCC:
https://github.com/bazelbuild/bazel/wiki/FAQ#q2

@linrio
Copy link
Author

linrio commented Nov 10, 2016

@aehlig @damienmg Tks!
I have addressed this problem by updating GCC version from gcc-4.4.7 to gcc-4.8.2. Reference linrio and #2069 , #1420
Now my gcc version is:

[llf@k20-1 lib64]$ gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc4.8.2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
目标:x86_64-unknown-linux-gnu
配置为:../configure --prefix=/usr/local/gcc4.8.2/ --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilib
线程模型:posix
gcc 版本 4.8.2 (GCC) 

And the compile result is:

INFO: From Building src/main/java/com/google/devtools/build/lib/libbazel-main.jar (4 source files, 3 resources):
Note: src/main/java/com/google/devtools/build/lib/bazel/BazelMain.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Target //src:bazel up-to-date:
  bazel-bin/src/bazel
INFO: Elapsed time: 89.520s, Critical Path: 84.99s
WARNING: /tmp/bazel_Cu2OI5UE/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_Cu2OI5UE/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.

Build successful! Binary is here: /home/llf/bazel/output/bazel

But why occur this problem? The bazel does not support the old version gcc-4.4.7?

@damienmg
Copy link
Contributor

No Bazel C++ code is using recent compiler feature that are not provided by gcc-4.4.7.

Glad you find a way to compile bazel :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants