[clang] [llvm] Reapply "runtimes: Pass CMAKE_SYSTEM_NAME based on target triple" (#205133) (PR #205522)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 02:09:05 PDT 2026


mstorsjo wrote:

This change broke cross-compiling lldb-mi (for a mingw target, if that's relevant) with a cross-compiled LLVM: https://github.com/mstorsjo/llvm-mingw/actions/runs/28989600787/job/86046599844

(In this build configuration, I'm building LLVM but not installing all the libraries, I'm installing with `-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON`. Then I configure lldb-mi by pointing it at the build directory from the previous LLVM build.)

At the end of the failing build, lldb-mi fails to link, erroring out with
```
lld: error: unable to find library -lLLVMSupport
```
The linking command in this case passes just a plain `-lLLVMSupport` argument, which can't be found.

In earlier builds that did succeed, the lldb-mi linking command includes `/home/martin/code/llvm-mingw/llvm-project/llvm/build-x86_64-w64-mingw32/lib/liblldb.dll.a  /home/martin/code/llvm-mingw/llvm-project/llvm/build-x86_64-w64-mingw32/lib/libLLVMSupport.a`.

With a local modification like this on top, my build succeeds again:
```diff
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index 6ef0cef7d029..8eaf659d82c0 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -147,7 +147,7 @@ set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
 set(LLVM_DEFAULT_EXTERNAL_LIT "@LLVM_CONFIG_DEFAULT_EXTERNAL_LIT@")
 set(LLVM_LIT_ARGS "@LLVM_LIT_ARGS@")
 
-if(NOT TARGET LLVMSupport AND NOT CMAKE_CROSSCOMPILING)
+if(NOT TARGET LLVMSupport)
   @LLVM_CONFIG_INCLUDE_EXPORTS@
   @llvm_config_include_buildtree_only_exports@
 endif()
```

https://github.com/llvm/llvm-project/pull/205522


More information about the cfe-commits mailing list