Adam Jensen via llvm-dev
2017-Jun-03 21:29 UTC
[llvm-dev] building llvm_Rel400 on Scientific Linux (RHEL) 7.3 x86_64
Hi, I am trying to build the LLVM suite on a RedHat Enterprise Linux clone (Scientific Linux <https://www.scientificlinux.org/>). In the latest attempt, the build seems to complete without any explicit failures but the `check-all` process fails. Any ideas about what is wrong or suggestions for how to proceed would be much appreciated. This is the current procedure: sudo yum install ninja-build sudo yum install cmake3 sudo yum install subversion sudo rpm -Uvh http://ftp.scientificlinux.org/linux/scientific/7x/external_products/softwarecollections/yum-conf-softwarecollections-2.0-1.el7.noarch.rpm sudo yum install devtoolset-6 # See <http://linux.web.cern.ch/linux/centos7/docs/softwarecollections.shtml> scl enable devtoolset-6 bash mkdir $HOME/build export BASE=$HOME/build svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_400/final/ $BASE/llvm_Rel400 cd $BASE/llvm_Rel400/tools svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_400/final/ clang svn co http://llvm.org/svn/llvm-project/lld/tags/RELEASE_400/final/ lld svn co http://llvm.org/svn/llvm-project/polly/tags/RELEASE_400/final/ polly cd $BASE/llvm_Rel400/tools/clang/tools svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_400/final/ extra cd $BASE/llvm_Rel400/projects svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_400/final/ compiler-rt svn co http://llvm.org/svn/llvm-project/openmp/tags/RELEASE_400/final/ openmp svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_400/final/ libcxx svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_400/final/ libcxxabi svn co http://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_400/final/ test-suite mkdir $BASE/build_llvm cd $BASE/build_llvm cmake3 -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/.local/llvm \ -DCMAKE_BUILD_TYPE=Release $BASE/llvm_Rel400 ninja-build ninja-build check-all 2>&1 | tee check.log ----- The last few lines of the log file look like this: [112/475] cd /home/hanzer/build/build_llvm/projects/compiler-rt/lib/xray/tests/unit && /home/hanzer/build/build_llvm/./bin/clang buffer_queue_test.cc.x86_64.o xray_unit_test_main.cc.x86_64.o gtest-all.cc.x86_64.o -o /home/hanzer/build/build_llvm/projects/compiler-rt/lib/xray/tests/unit/XRayBufferQueueTest -Wl,-allow-shlib-undefined -m64 -lstdc++ -lm -lpthread -lpthread -L/home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux -lclang_rt.xray-fdr-x86_64 FAILED: projects/compiler-rt/lib/xray/tests/unit/CMakeFiles/XRayBufferQueueTest cd /home/hanzer/build/build_llvm/projects/compiler-rt/lib/xray/tests/unit && /home/hanzer/build/build_llvm/./bin/clang buffer_queue_test.cc.x86_64.o xray_unit_test_main.cc.x86_64.o gtest-all.cc.x86_64.o -o /home/hanzer/build/build_llvm/projects/compiler-rt/lib/xray/tests/unit/XRayBufferQueueTest -Wl,-allow-shlib-undefined -m64 -lstdc++ -lm -lpthread -lpthread -L/home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux -lclang_rt.xray-fdr-x86_64 /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::make_error_code(std::errc)': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:197: undefined reference to `std::_V2::generic_category()' /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::error_code::error_code()': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:141: undefined reference to `std::_V2::system_category()' /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::make_error_code(std::errc)': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:197: undefined reference to `std::_V2::generic_category()' /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::error_code::error_code()': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:141: undefined reference to `std::_V2::system_category()' /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::make_error_code(std::errc)': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:197: undefined reference to `std::_V2::generic_category()' /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:197: undefined reference to `std::_V2::generic_category()' /home/hanzer/build/build_llvm/./lib/clang/4.0.0/lib/linux/libclang_rt.xray-fdr-x86_64.a(xray_buffer_queue.cc.o): In function `std::error_code::error_code()': /opt/rh/devtoolset-6/root/usr/include/c++/6.2.1/system_error:141: undefined reference to `std::_V2::system_category()' clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation) [113/475] Performing build step for 'libcxx_tsan_x86_64' -- libcxx_tsan_x86_64 build command succeeded. See also /home/hanzer/build/build_llvm/projects/compiler-rt/lib/tsan/libcxx_tsan_x86_64/src/libcxx_tsan_x86_64-stamp/libcxx_tsan_x86_64-build-*.log [114/475] Building CXX object tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTestJS.cpp.o [115/475] Building CXX object tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTestObjC.cpp.o [116/475] Performing build step for 'libcxx_msan_x86_64' -- libcxx_msan_x86_64 build command succeeded. See also /home/hanzer/build/build_llvm/projects/compiler-rt/lib/msan/tests/../libcxx_msan_x86_64/src/libcxx_msan_x86_64-stamp/libcxx_msan_x86_64-build-*.log [117/475] Building CXX object tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o ninja: build stopped: subcommand failed.
Tim Northover via llvm-dev
2017-Jun-03 23:04 UTC
[llvm-dev] building llvm_Rel400 on Scientific Linux (RHEL) 7.3 x86_64
Hi Adam, On 3 June 2017 at 14:29, Adam Jensen via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I am trying to build the LLVM suite on a RedHat Enterprise Linux clone (Scientific Linux <https://www.scientificlinux.org/>). In the latest attempt, the build seems to complete without any explicit failures but the `check-all` process fails. Any ideas about what is wrong or suggestions for how to proceed would be much appreciated.I can't reproduce this exact failure (my build dies earlier), but I think what's happening is that you're finding a libstdc++.a from the GCC toolchain (i.e. a static rather than dynamic library). For static libraries the order of objects on the command-line matters libclang_rt.xray-fdr-x86_64.a is after libstdc++, so libstdc++ isn't examined again and the link step fails. I think you should be able to fix it by changing the compiler-rt/lib/xray/test/CMakeLists.txt. If you find the "add_compiler_rt_test" call and move "-lstdc++" to the end, just after "-lrt" it should work. I'm not sure if this is the real fix though we'd want to adopt into compiler-rt though. Cheers. Tim.
Adam Jensen via llvm-dev
2017-Jun-04 00:12 UTC
[llvm-dev] building llvm_Rel400 on Scientific Linux (RHEL) 7.3 x86_64
On Sat, 3 Jun 2017 16:04:57 -0700 Tim Northover <t.p.northover at gmail.com> wrote: [snip]> I think you should be able to fix it by changing the > compiler-rt/lib/xray/test/CMakeLists.txt. If you find the > "add_compiler_rt_test" call and move "-lstdc++" to the end, just after > "-lrt" it should work.Thanks, Tim. I don't see "-lrt": $BASE/llvm_Rel400/projects/compiler-rt/lib/xray/tests/CMakeLists.txt 43 if(NOT APPLE) 44 add_compiler_rt_test(XRayUnitTests ${testname} 45 OBJECTS ${TEST_OBJECTS} 46 DEPS ${TEST_DEPS} 47 LINK_FLAGS ${TARGET_LINK_FLAGS} 48 -lstdc++ -lm ${CMAKE_THREAD_LIBS_INIT} 49 -lpthread 50 -L${COMPILER_RT_LIBRARY_OUTPUT_DIR} -lclang_rt.xray-fdr-${arch}) 51 endif()