我已经成功编译了3.6.1版本的LLVM-Clang-LLDB-Compiler-RT-LibCxx-LibCxxABI-TestSuite软件包。但是,当我尝试ninja check-all
时,检查在第一个目标[1/150] Generating sanitizer_bitvector_test.cc.x86_64.o
处失败。我认为原因是LLVM正在尝试使用系统GCC头文件,但我使用另一个GCC工具链(GCC 4.8.4)编译了LLVM,我将其编译并安装在非根目录中。但是,我无法弄清楚如何让CMake避免使用系统GCC头文件(我修改了PATH和LD_LIBRARY_PATH,但它们根本没有帮助。)
以下是相关信息:
CMake构建命令
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
结果没问题,这意味着LLVM已成功编译:
[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
ninja check-all
的前几行错误(请参阅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)
^
特别是你可能会注意到: /usr/lib/gcc/x86_64-redhat-linux/4.4.7 /../../../../ include / c ++ / 4.4.7 被使用。但是,'ninja check-all'确实应该使用gcc-4.8.4的头文件,而不是gcc-4.4.7(系统捆绑的gcc)。
我已经提交了一份错误报告,但似乎没有人愿意接听。
如果有人知道如何解决这个问题,请告诉我。感谢。