| author | |
| committer | |
| log | c40708a2ce4f6ed1adcc1de39fc7b4fc27db32f8 |
| tree | f66d6be424bb24d643f1f48762b0644f7246f202 |
| parent | bf588f67d8c6261105f81fd468c420d662541d2a |
Line `link_directories("${CMAKE_PREFIX_PATH}/lib")` was evaluated as
`link_directories("/lib")` in the default case of `CMAKE_PREFIX_PATH`
being empty.
This caused cmake to add `-L/lib -Wl,-rpath,/lib` to the zig2
build flags.
This could result in errors on systems where libraries set via
`CMAKE_LIBRARY_PATH` had conflicting versions in `/lib`:
- `-L/lib` could cause linking zig2 to fail
- `-Wl,-rpath,/lib` adds `/lib` as the first entry of the zig2 `RPATH`.
This could cause running zig2 (to build zig3) to fail.
In case of conflicting lib dirs, cmake emitted this warning, which is
now fixed:
```
Cannot generate a safe runtime search path for target zig2 because files in
some directories may conflict with libraries in implicit directories:
runtime library [libclang-cpp.so.18.1] in /nix/store/...-clang-18.1.5-lib/lib may be hidden by files in:
/lib
```1 files changed, 0 insertions(+), 1 deletions(-)
cmake/Findllvm.cmake-1| ... | @@ -176,7 +176,6 @@ if(ZIG_USE_LLVM_CONFIG) | ... | @@ -176,7 +176,6 @@ if(ZIG_USE_LLVM_CONFIG) |
| 176 | OUTPUT_STRIP_TRAILING_WHITESPACE) | 176 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 177 | string(REPLACE " " ";" LLVM_INCLUDE_DIRS "${LLVM_INCLUDE_DIRS_SPACES}") | 177 | string(REPLACE " " ";" LLVM_INCLUDE_DIRS "${LLVM_INCLUDE_DIRS_SPACES}") |
| 178 | 178 | ||
| 179 | link_directories("${CMAKE_PREFIX_PATH}/lib") | ||
| 180 | link_directories("${LLVM_LIBDIRS}") | 179 | link_directories("${LLVM_LIBDIRS}") |
| 181 | else() | 180 | else() |
| 182 | # Here we assume that we're cross compiling with Zig, of course. No reason | 181 | # Here we assume that we're cross compiling with Zig, of course. No reason |