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

[libc++abi][libunwind] Run c++abi and unwind tests against a fake install root #110171

Merged

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 26, 2024

This is what we started doing in libc++ and it straightens up a lot of things that only happened to work before, notably the presence of relative rpaths in dylibs when running from the build tree.

This unlocks the ability to link against a just-built dylib but run against another version of the dylib (for example the system-provided one), which is necessary for proper backdeployment testing.

This patch adds a lot of code duplication between the libc++ and libc++abi testing setups. However, there is already a large amount of duplication and the only real way to get rid of it is to merge libc++abi into libc++. In a way, this patch is a step in that direction because it closes the gap between the two libraries' testing setup.

@ldionne ldionne requested review from a team as code owners September 26, 2024 21:15
@llvmbot llvmbot added libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind labels Sep 26, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 26, 2024

@llvm/pr-subscribers-libcxx
@llvm/pr-subscribers-libunwind

@llvm/pr-subscribers-libcxxabi

Author: Louis Dionne (ldionne)

Changes

This is what we started doing in libc++ and it straightens up a lot of things that only happened to work before, notably the presence of relative rpaths in dylibs when running from the build tree.

This unlocks the ability to link against a just-built dylib but run against another version of the dylib (for example the system-provided one), which is necessary for proper backdeployment testing.

This patch adds a lot of code duplication between the libc++ and libc++abi testing setups. However, there is already a large amount of duplication and the only real way to get rid of it is to merge libc++abi into libc++. In a way, this patch is a step in that direction because it closes the gap between the two libraries' testing setup.


Full diff: https://github.com/llvm/llvm-project/pull/110171.diff

5 Files Affected:

  • (modified) libcxxabi/src/CMakeLists.txt (-1)
  • (modified) libcxxabi/test/CMakeLists.txt (+51)
  • (modified) libcxxabi/test/configs/cmake-bridge.cfg.in (+4-4)
  • (modified) libunwind/test/CMakeLists.txt (+15-1)
  • (modified) libunwind/test/configs/cmake-bridge.cfg.in (+2-2)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index c1a7bcb14eb199..e8c459d1c9cae6 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -306,7 +306,6 @@ endif()
 
 # Add a meta-target for both libraries.
 add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
-add_dependencies(cxxabi-test-depends cxxabi cxx)
 
 if (LIBCXXABI_INSTALL_LIBRARY)
   install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index 8e3048f2ffe8a1..9eabfb08240b60 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -8,6 +8,57 @@ macro(pythonize_bool var)
   endif()
 endmacro()
 
+set(LIBCXXABI_TESTING_INSTALL_PREFIX "${LIBCXXABI_BINARY_DIR}/test-suite-install")
+add_custom_target(libcxxabi-install-cxx-for-testing
+                      DEPENDS cxx-headers
+                              cxx
+                              cxx_experimental
+                              cxx-modules
+                      COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                      COMMAND "${CMAKE_COMMAND}"
+                              -DCMAKE_INSTALL_COMPONENT=cxx-headers
+                              -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+                      COMMAND "${CMAKE_COMMAND}"
+                              -DCMAKE_INSTALL_COMPONENT=cxx-modules
+                              -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+                      COMMAND "${CMAKE_COMMAND}"
+                              -DCMAKE_INSTALL_COMPONENT=cxx
+                              -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+add_dependencies(cxxabi-test-depends libcxxabi-install-cxx-for-testing)
+
+add_custom_target(libcxxabi-install-cxxabi-for-testing
+                      DEPENDS cxxabi-headers
+                              cxxabi
+                      COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                      COMMAND "${CMAKE_COMMAND}"
+                              -DCMAKE_INSTALL_COMPONENT=cxxabi-headers
+                              -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+                      COMMAND "${CMAKE_COMMAND}"
+                              -DCMAKE_INSTALL_COMPONENT=cxxabi
+                              -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+add_dependencies(cxxabi-test-depends libcxxabi-install-cxxabi-for-testing)
+
+if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
+  add_custom_target(libcxxabi-install-unwind-for-testing
+    DEPENDS unwind-headers
+            unwind
+    COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+    COMMAND "${CMAKE_COMMAND}"
+            -DCMAKE_INSTALL_COMPONENT=unwind-headers
+            -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+            -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+    COMMAND "${CMAKE_COMMAND}"
+            -DCMAKE_INSTALL_COMPONENT=unwind
+            -DCMAKE_INSTALL_PREFIX="${LIBCXXABI_TESTING_INSTALL_PREFIX}"
+            -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+  add_dependencies(cxxabi-test-depends libcxxabi-install-unwind-for-testing)
+endif()
+
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
 
 set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in
index 3fefc6a7fdc88a..09f324933817e5 100644
--- a/libcxxabi/test/configs/cmake-bridge.cfg.in
+++ b/libcxxabi/test/configs/cmake-bridge.cfg.in
@@ -27,10 +27,10 @@ config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test')
 config.host_triple = '@LLVM_HOST_TRIPLE@'
 
 config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
-config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include'))
-config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))
-config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/include/%{triple}/c++/v1'))
-config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@'))
+config.substitutions.append(('%{include}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/include'))
+config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/@LIBCXXABI_INSTALL_INCLUDE_DIR@'))
+config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/@LIBCXX_INSTALL_INCLUDE_TARGET_DIR@'))
+config.substitutions.append(('%{lib}', '@LIBCXXABI_TESTING_INSTALL_PREFIX@/@LIBCXXABI_INSTALL_LIBRARY_DIR@'))
 
 if @LIBCXXABI_USE_LLVM_UNWINDER@:
     config.substitutions.append(('%{maybe-include-libunwind}', '-I "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"'))
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index c7b1b3d01d8c7d..c222c0bdbf5af1 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -8,6 +8,20 @@ macro(pythonize_bool var)
   endif()
 endmacro()
 
+set(LIBUNWIND_TESTING_INSTALL_PREFIX "${LIBUNWIND_BINARY_DIR}/test-suite-install")
+add_custom_target(libunwind-install-unwind-for-testing
+  DEPENDS unwind-headers
+          unwind
+  COMMAND ${CMAKE_COMMAND} -E make_directory "${LIBUNWIND_TESTING_INSTALL_PREFIX}"
+  COMMAND "${CMAKE_COMMAND}"
+          -DCMAKE_INSTALL_COMPONENT=unwind-headers
+          -DCMAKE_INSTALL_PREFIX="${LIBUNWIND_TESTING_INSTALL_PREFIX}"
+          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+  COMMAND "${CMAKE_COMMAND}"
+          -DCMAKE_INSTALL_COMPONENT=unwind
+          -DCMAKE_INSTALL_PREFIX="${LIBUNWIND_TESTING_INSTALL_PREFIX}"
+          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+
 pythonize_bool(LIBUNWIND_ENABLE_CET)
 pythonize_bool(LIBUNWIND_ENABLE_GCS)
 pythonize_bool(LIBUNWIND_ENABLE_THREADS)
@@ -48,4 +62,4 @@ configure_lit_site_cfg(
 
 add_lit_testsuite(check-unwind "Running libunwind tests"
   ${CMAKE_CURRENT_BINARY_DIR}
-  DEPENDS unwind)
+  DEPENDS libunwind-install-unwind-for-testing)
diff --git a/libunwind/test/configs/cmake-bridge.cfg.in b/libunwind/test/configs/cmake-bridge.cfg.in
index 7fc7a3da424629..5ccdd1772a8b3e 100644
--- a/libunwind/test/configs/cmake-bridge.cfg.in
+++ b/libunwind/test/configs/cmake-bridge.cfg.in
@@ -29,5 +29,5 @@ if not @LIBUNWIND_ENABLE_THREADS@:
     config.available_features.add('libunwind-no-threads')
 
 # Add substitutions for bootstrapping the test suite configuration
-config.substitutions.append(('%{include}', '@LIBUNWIND_SOURCE_DIR@/include'))
-config.substitutions.append(('%{lib}', '@LIBUNWIND_LIBRARY_DIR@'))
+config.substitutions.append(('%{include}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/include'))
+config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/lib'))

…tall root

This is what we started doing in libc++ and it straightens up a lot
of things that only happened to work before, notably the presence of
relative rpaths in dylibs when running from the build tree.

This unlocks the ability to link against a just-built dylib but run
against another version of the dylib (for example the system-provided
one), which is necessary for proper backdeployment testing.

This patch adds a lot of code duplication between the libc++ and
libc++abi testing setups. However, there is already a large amount
of duplication and the only real way to get rid of it is to merge
libc++abi into libc++. In a way, this patch is a step in that
direction because it closes the gap between the two libraries'
testing setup.
@ldionne ldionne force-pushed the review/test-cxxabi-and-unwind-against-fake-install branch from 554066d to f6c1590 Compare September 27, 2024 14:54
@ldionne ldionne requested a review from a team as a code owner September 27, 2024 14:54
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 27, 2024
@ldionne ldionne merged commit 2121b96 into llvm:main Sep 30, 2024
65 checks passed
@ldionne ldionne deleted the review/test-cxxabi-and-unwind-against-fake-install branch September 30, 2024 15:57
@zeroomega
Copy link
Contributor

We are seeing a test failure on linux-x64 runtime after this patch landed.

Error message:

[245/246](1) Running runtimes regression tests
llvm-lit: /b/s/w/ir/x/w/llvm-llvm-project/llvm/utils/lit/lit/TestingConfig.py:154: fatal: unable to parse config file '/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test/lit.site.cfg', traceback: Traceback (most recent call last):
  File "/b/s/w/ir/x/w/llvm-llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 142, in load_from_path
    exec(compile(data, path, "exec"), cfg_globals, None)
  File "/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test/lit.site.cfg", line 46, in <module>
    libcxx.test.config.configure(
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/config.py", line 44, in configure
    actions = feature.getActions(config)
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/dsl.py", line 647, in getActions
    if not self._isSupported(config):
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/features.py", line 291, in <lambda>
    and not programSucceeds(
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/dsl.py", line 68, in f
    cache[cacheKey] = function(config, *args, **kwargs)
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/dsl.py", line 203, in programSucceeds
    programOutput(config, program, args)
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/dsl.py", line 68, in f
    cache[cacheKey] = function(config, *args, **kwargs)
  File "/b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/libcxx/test/dsl.py", line 173, in programOutput
    raise ConfigurationCompilationError(
libcxx.test.dsl.ConfigurationCompilationError: Failed to build program, cmd:
['/b/s/w/ir/x/w/llvm_build/./bin/clang++ /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/__config_src__/tmp6ibehrxq.cpp -isysroot /b/s/w/ir/x/w/cipd/linux --target=x86_64-unknown-linux-gnu -nostdinc++ -I /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test-suite-install/include -funwind-tables -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Werror=thread-safety -Wuser-defined-warnings  /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test-suite-install/lib/libunwind.a -lpthread -Wl,--export-dynamic -ldl -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/__config_exec__/Output/tmp6ibehrxq.cpp.dir/t.tmp.exe']
stderr is:
clang++: error: no such file or directory: '/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test-suite-install/lib/libunwind.a'


FAILED: CMakeFiles/check-runtimes /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/CMakeFiles/check-runtimes 
cd /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins && /b/s/w/ir/cipd_bin_packages/cpython3/bin/python3.8 /b/s/w/ir/x/w/llvm_build/./bin/llvm-lit --resultdb-output=r.j -v --param HWASAN_ENABLE_ALIASES=1 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libunwind/test /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxxabi/test /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/libcxx/test /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/interception/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/lsan/X86_64LsanConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/lsan/X86_64AsanConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/lsan/X86_64HWAsanConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/Standalone-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/Standalone-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/AddressSanitizer-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/AddressSanitizer-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/MemorySanitizer-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/MemorySanitizer-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/ThreadSanitizer-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan/ThreadSanitizer-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/msan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/tsan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/ubsan-x86_64-Linux /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/fuzzer/unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/fuzzer/X86_64StaticLibcxxLinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/metadata /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/Unit/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/Unit/X86_64LinuxDynamicConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/rtsan/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/rtsan/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/dfsan/X86_64Config /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/msan/X86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/msan/lld-X86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/msan/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/hwasan/X86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/tsan/X86_64Config /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/tsan/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/safestack/Standalone-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Standalone-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Devirt-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Standalone-thinlto-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Devirt-thinlto-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Standalone-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Devirt-lld-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Standalone-lld-thinlto-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/cfi/Devirt-lld-thinlto-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/scudo/standalone/unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/scudo/standalone/unit/gwp_asan /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ubsan_minimal/x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/gwp_asan/unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/gwp_asan/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/nsan/X86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/nsan/Unit /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-x86_64 /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ctx_profile/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/ctx_profile/Unit/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/memprof/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/memprof/Unit/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/memprof/X86_64LinuxDynamicConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/xray/X86_64LinuxConfig /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/orc/X86_64LinuxConfig
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/check-runtimes-x86_64-unknown-linux-gnu /b/s/w/ir/x/w/llvm_build/runtimes/CMakeFiles/check-runtimes-x86_64-unknown-linux-gnu 

It looks like cmake pointed a wrong libunwind path to the clang. We are still investigating.

@bjope
Copy link
Collaborator

bjope commented Oct 1, 2024

Seeing same fault as @zeroomega .

I think problem is related to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR. When that is set to ON the install path is extended (in libunwind/CMakeLIsts.txt):

  set(LIBUNWIND_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
  if(LIBUNWIND_LIBDIR_SUBDIR)
    string(APPEND LIBUNWIND_TARGET_SUBDIR /${LIBUNWIND_LIBDIR_SUBDIR})
  endif()

And then the substitution in libunwind/test/configs/cmake-bridge.cfg.in is wrong:

config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/lib'))

@ldionne
Copy link
Member Author

ldionne commented Oct 1, 2024

Thanks for the analysis. Per-target runtime dir strikes again! That setting keeps on creating issues (by no fault of its own) because it's not the default.

Can we do something like this instead, then?

config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBUNWIND_INSTALL_LIBRARY_DIR@'))

We should fix this one forward since there's a complicated dependency chain on top of this (we switched to Github-hosted runners for macOS testing after this patch and they will start failing if we revert this). Hopefully it's not too complicated to fix forward.

@zeroomega
Copy link
Contributor

Thanks for the analysis. Per-target runtime dir strikes again! That setting keeps on creating issues (by no fault of its own) because it's not the default.

Can we do something like this instead, then?

config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBUNWIND_INSTALL_LIBRARY_DIR@'))

We should fix this one forward since there's a complicated dependency chain on top of this (we switched to Github-hosted runners for macOS testing after this patch and they will start failing if we revert this). Hopefully it's not too complicated to fix forward.

That seems to fix the test:
Test run: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci.shadow/clang-linux-x64/b8735236964550803665/overview
based on https://github.com/zeroomega/llvm-project/tree/libunwind_fix zeroomega@1e3b4a6

VitaNuo pushed a commit to VitaNuo/llvm-project that referenced this pull request Oct 2, 2024
…tall root (llvm#110171)

This is what we started doing in libc++ and it straightens up a lot of
things that only happened to work before, notably the presence of
relative rpaths in dylibs when running from the build tree.

This unlocks the ability to link against a just-built dylib but run
against another version of the dylib (for example the system-provided
one), which is necessary for proper backdeployment testing.

This patch adds a lot of code duplication between the libc++ and
libc++abi testing setups. However, there is already a large amount of
duplication and the only real way to get rid of it is to merge libc++abi
into libc++. In a way, this patch is a step in that direction because it
closes the gap between the two libraries' testing setup.
VitaNuo pushed a commit to VitaNuo/llvm-project that referenced this pull request Oct 2, 2024
…tall root (llvm#110171)

This is what we started doing in libc++ and it straightens up a lot of
things that only happened to work before, notably the presence of
relative rpaths in dylibs when running from the build tree.

This unlocks the ability to link against a just-built dylib but run
against another version of the dylib (for example the system-provided
one), which is necessary for proper backdeployment testing.

This patch adds a lot of code duplication between the libc++ and
libc++abi testing setups. However, there is already a large amount of
duplication and the only real way to get rid of it is to merge libc++abi
into libc++. In a way, this patch is a step in that direction because it
closes the gap between the two libraries' testing setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++. libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libunwind
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants