From 8b086e3cee0003380ca9efa7caf59087a3a75c6e Mon Sep 17 00:00:00 2001 From: Alexander Richardson Date: Thu, 7 Nov 2024 14:28:22 -0800 Subject: [PATCH] Link against installed libc++/libc++abi when bootstrapping The build tree layout does not necessarily match a valid libc++ installation tree, so install libc++/libc++abi first. This is needed for https://github.com/llvm/llvm-project/pull/115379 Reviewed By: vitalybuka Pull Request: https://github.com/llvm/llvm-zorg/pull/299 --- .../builders/sanitizers/buildbot_functions.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/zorg/buildbot/builders/sanitizers/buildbot_functions.sh b/zorg/buildbot/builders/sanitizers/buildbot_functions.sh index 7b54de1f1..4461d9acf 100755 --- a/zorg/buildbot/builders/sanitizers/buildbot_functions.sh +++ b/zorg/buildbot/builders/sanitizers/buildbot_functions.sh @@ -88,7 +88,7 @@ function rm_dirs { function cleanup() { [[ -v BUILDBOT_BUILDERNAME ]] || return 0 echo @@@BUILD_STEP cleanup@@@ - rm_dirs llvm_build2_* llvm_build_* libcxx_build_* compiler_rt_build* symbolizer_build* $@ + rm_dirs llvm_build2_* llvm_build_* libcxx_build_* libcxx_install_* compiler_rt_build* symbolizer_build* "$@" if ccache -s >/dev/null ; then rm_dirs llvm_build64 fi @@ -228,6 +228,7 @@ function build_stage2 { echo @@@BUILD_STEP stage2/$sanitizer_name build libcxx@@@ local libcxx_build_dir=libcxx_build_${sanitizer_name} + local libcxx_install_dir=libcxx_install_${sanitizer_name} local build_dir=llvm_build_${sanitizer_name} export STAGE2_DIR=${build_dir} local cmake_libcxx_cflags= @@ -283,6 +284,7 @@ function build_stage2 { (cd ${libcxx_build_dir} && \ cmake \ ${cmake_stage2_common_options} \ + -DCMAKE_INSTALL_PREFIX="${ROOT}/${libcxx_install_dir}" \ -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \ -DLIBCXX_TEST_PARAMS='long_tests=False' \ -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \ @@ -290,11 +292,14 @@ function build_stage2 { -DCMAKE_C_FLAGS="${fsanitize_flag} ${cmake_libcxx_cflags} ${fno_sanitize_flag}" \ -DCMAKE_CXX_FLAGS="${fsanitize_flag} ${cmake_libcxx_cflags} ${fno_sanitize_flag}" \ $LLVM/../runtimes && \ - ninja cxx cxxabi) || build_failure + ninja cxx cxxabi && ninja install-cxx install-cxxabi) || build_failure + + local libcxx_so_path="$(find "${ROOT}/${libcxx_install_dir}" -name libc++.so)" + test -f "${libcxx_so_path}" || build_failure + local libcxx_runtime_path=$(dirname "${libcxx_so_path}") - local libcxx_runtime_path=$(dirname $(find ${ROOT}/${libcxx_build_dir} -name libc++.so)) local sanitizer_ldflags="-Wl,--rpath=${libcxx_runtime_path} -L${libcxx_runtime_path}" - local sanitizer_cflags="-nostdinc++ -isystem ${ROOT}/${libcxx_build_dir}/include -isystem ${ROOT}/${libcxx_build_dir}/include/c++/v1 $fsanitize_flag" + local sanitizer_cflags="-nostdinc++ -isystem ${ROOT}/${libcxx_install_dir}/include -isystem ${ROOT}/${libcxx_install_dir}/include/c++/v1 $fsanitize_flag" echo @@@BUILD_STEP stage2/$sanitizer_name build@@@