llvm / llvm/llvm-project

CMAKE_PREFIX_PATH not properly propogated to runtime

Open
#185,438 2 comments 0 reactions 0 assignees View on GitHub
cmake
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

While building llvm 21.1.4 , I noticed following warnings
```
[6387/6391] cd /runtimes/runtimes-bins && /cmake/3.31.7-62f307011423a7f6b44229944c8e4c9c/bin/cmake \
--no-warn-unused-cli -DCMAKE_C_COMPILER=/./bin/clang -DCMAKE_CXX_COMPILER=/./bin/clang++ \
-DCMAKE_ASM_COMPILER=/./bin/clang -DCMAKE_LINKER=/./bin/ld.lld \
-DCMAKE_AR=/./bin/llvm-ar -DCMAKE_RANLIB=/./bin/llvm-ranlib \
-DCMAKE_NM=/./bin/llvm-nm -DCMAKE_OBJDUMP=/./bin/llvm-objdump \
-DCMAKE_OBJCOPY=/./bin/llvm-objcopy -DCMAKE_STRIP=/./bin/llvm-strip \
-DCMAKE_READELF=/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=x86_64-redhat-linux-gnu \
-DCMAKE_CXX_COMPILER_TARGET=x86_64-redhat-linux-gnu -DCMAKE_Fortran_COMPILER_TARGET=x86_64-redhat-linux-gnu \
-DCMAKE_ASM_COMPILER_TARGET=x86_64-redhat-linux-gnu -DCMAKE_INSTALL_PREFIX= \
-DLLVM_BINARY_DIR= -DLLVM_CONFIG_PATH=/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF \
-DLLVM_HOST_TRIPLE=x86_64-redhat-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 \
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF -DLLVM_LIT_ARGS=-sv \
-DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=21.1.4 -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MAKE_PROGRAM=/ninja/1.11.1-f55f9cac3b60a3f7ef65d610d7e6c02c/bin/ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=ON -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-redhat-linux-gnu -DLLVM_ENABLE_PROJECTS_USED=ON \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_Fortran_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON \
-DHAVE_LLVM_LIT=ON -DCLANG_RESOURCE_DIR= \
-DCMAKE_PREFIX_PATH=/zlib/1.2.13-589f6bb51bbeba38a7adf5a10ea8a093 \
/libxml2/2.9.10-028886c4bfbe27f656c04f0d4ecc9d4c \
/zstd/1.5.7-06370988946837b634b6dbd71385514f \
/libunwind/1.8.1-master-f32df36d9538c7aa97e7979da5c3b30a \
"-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind" -DFFI_INCLUDE_DIR= -DFFI_LIBRARY_DIR= \
-GNinja -C/projects/runtimes/tmp/runtimes-cache-Release.cmake \
-S /llvm/runtimes/../../runtimes -B /runtimes/runtimes-bins && \
/cmake/3.31.7-62f307011423a7f6b44229944c8e4c9c/bin/cmake \
-E touch /runtimes/runtimes-stamps/runtimes-configure

CMake Warning:
Ignoring extra path from command line:

"/libxml2/2.9.10-028886c4bfbe27f656c04f0d4ecc9d4c"

Not searching for unused variables given on the command line.

CMake Warning:
Ignoring extra path from command line:

"/libunwind/1.8.1-master-f32df36d9538c7aa97e7979da5c3b30a"
```

Looks like `CMAKE_PREFIX_PATH` was passed with spaces instead of `;`. I have checked the ninja build file too and it also contains
```
-DCMAKE_PREFIX_PATH=/zlib/1.2.13-589f6bb51bbeba38a7adf5a10ea8a093 \
/external/libxml2/2.9.10-028886c4bfbe27f656c04f0d4ecc9d4c \
/zstd/1.5.7-06370988946837b634b6dbd71385514f \
/libunwind/1.8.1-master-f32df36d9538c7aa97e7979da5c3b30a
```

Is there any fix for this?

Contributor guide

Open the contributing guide

Research direction

Start with the generated Ninja command for the runtimes configure step and trace how CMAKE_PREFIX_PATH is assembled before it reaches CMake. Reproduce the LLVM 21.1.4 runtime build using the reported paths, then verify that all prefix entries remain part of one semicolon-separated argument and that CMake emits no extra-path warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.