I have successfully compiled the 3.6.1 version of LLVM-Clang-LLDB-Compiler-RT-LibCxx-LibCxxABI-TestSuite bundle. However, when I tried ninja check-all
, the check failed right at the first target [1/150] Generating sanitizer_bitvector_test.cc.x86_64.o
. I think the reason is that LLVM is trying to use the system GCC header files, but I compiled LLVM with another GCC toolchain (GCC 4.8.4) that I compiled and installed in a non-root directory. However, I can't figure out how to let the CMake avoid using the system GCC headers (I have modified the PATH and LD_LIBRARY_PATH, but they didn't help at all).
Here is the relevant information:
- CentOS 6.6
- x86_64 architecture (Intel(R) Xeon(R) CPU W3550 @ 3.07GHz)
- Tools used for installation:
- 1) gcc/4.8.4
- 2) ninja
- 3) zlib/1.2.8
- 4) python-miniconda
- Linux Kernel version
- 2.6.32-504.16.2.el6.x86_64
CMake build command
cmake -G "Ninja" -DCMAKE_C_COMPILER=/Scr/scr-test-steven/install/gcc/4.8.4/bin/gcc -DCMAKE_CXX_COMPILER=/Scr/scr-test-steven/install/gcc/4.8.4/bin/c++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Scr/scr-test-steven/install/llvm/3.6.1 /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src -DLLDB_DISABLE_PYTHON=1 -DCMAKE_CXX_FLAGS:STRING="-I/Scr/scr-test-steven/install/gcc/4.8.4/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/tools/clang/include -I/Scr/scr-test-steven/install/libedit/3.1/include -I/Scr/scr-test-steven/install/miniconda/include/python2.7 -L/Scr/scr-test-steven/install/gcc/4.8.4/lib64 -L/Scr/scr-test-steven/install/libedit/3.1/lib -L/Scr/scr-test-steven/install/miniconda/lib -L/Scr/scr-test-steven/install/miniconda/lib/python2.7" -DPYTHON_HOME=/Scr/scr-test-steven/install/miniconda -DLLVM_LIB_SEARCH_PATH=/Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/lib
ninja check
results are okay, which means LLVM was compiled successfully:[1/1] Running the LLVM regression tests lit.py: lit.cfg:271: note: Did not find llvm-go in /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/./bin -- Testing: 12316 tests, 8 threads -- Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Testing Time: 105.65s * Expected Passes : 12056 * Expected Failures : 79 * Unsupported Tests : 181
The first few lines of errors for
ninja check-all
(see details in Log.check.log ):[1/150] Generating sanitizer_bitvector_test.cc.x86_64.o FAILED: cd /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/projects/compiler-rt/lib/sanitizer_common/tests && /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/./bin/clang -I/Scr/scr-test-steven/install/gcc/4.8.4/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/tools/clang/include -I/Scr/scr-test-steven/install/libedit/3.1/include -I/Scr/scr-test-steven/install/miniconda/include/python2.7 -L/Scr/scr-test-steven/install/gcc/4.8.4/lib64 -L/Scr/scr-test-steven/install/libedit/3.1/lib -L/Scr/scr-test-steven/install/miniconda/lib -L/Scr/scr-test-steven/install/miniconda/lib/python2.7 -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unknown-warning-option -DGTEST_NO_LLVM_RAW_OSTREAM=1 -DGTEST_HAS_RTTI=0 -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common -fno-rtti -O2 -Werror=sign-compare -Wno-non-virtual-dtor -m64 -c -o sanitizer_bitvector_test.cc.x86_64.o /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/gcc/4.8.4/lib64' clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/libedit/3.1/lib' clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/miniconda/lib' clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/miniconda/lib/python2.7' In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc:16: In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h:28: In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_config.h:20: In file included from **/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7** /vector:61: In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algobase.h:66: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:89:10: error: no matching function for call to 'forward' : first(std::forward<_U1>(__x)), ^~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_tree.h:1177:13: note: in instantiation of function template specialization 'std::pair<std::_Rb_tree_iterator<const char *>, bool>::pair<std::_Rb_tree_iterator<const char *>, bool>' requested here return pair<iterator, bool>(_M_insert_(__x, __y, __v), true); ^ /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_set.h:411:9: note: in instantiation of member function 'std::_Rb_tree<const char *, const char *, std::_Identity<const char *>, std::less<const char *>, std::allocator<const char *> >::_M_insert_unique' requested here _M_t._M_insert_unique(__x); ^ /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest/include/gtest/internal/gtest-internal.h:628:25: note: in instantiation of member function 'std::set<const char *, std::less<const char *>, std::allocator<const char *> >::insert' requested here defined_test_names_.insert(test_name); ^ /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/move.h:51:5: note: candidate function [with _Tp = std::_Rb_tree_iterator<const char *>] not viable: no known conversion from 'std::_Rb_tree_iterator<const char *>' to 'typename std::identity<_Rb_tree_iterator<const char *> >::type &&' (aka 'std::_Rb_tree_iterator<const char *> &&') for 1st argument forward(typename std::identity<_Tp>::type&& __t) ^
In particular you may notice that: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7 was used. However, 'ninja check-all' really should have used the header files for gcc-4.8.4, not gcc-4.4.7 (system bundled gcc).
I have filed a bug report, but no one seems to want to answer it.
If anyone knows how to fix this, please let me know. Thanks.