CXX_LINKER_SUPPORTS_STDLIB error for llvm build

Hi everyone,
When building llvm-project I have got error’s of CXX_LINKER_SUPPORTS_STDLIB configuration with libc++.
Does anyone have idea what should I do to such error? Is there any configuration that I have to deal with before I can build the llvm project?

The CMake command being used is as following:

-DCMAKE_C_COMPILER=/usr/bin/clang-15
-DCMAKE_CXX_COMPILER=/usr/bin/clang+±15
-DLLVM_VERSION_SUFFIX=“libcxx”
-DLLVM_ENABLE_LIBCXX=ON

Output information is like below:

– Performing Test CXX_LINKER_SUPPORTS_STDLIB
– Performing Test CXX_LINKER_SUPPORTS_STDLIB - Failed
CMake Warning at cmake/modules/HandleLLVMStdlib.cmake:28 (message):
Can’t specify libc++ with ‘-stdlib=’
Call Stack (most recent call first):
cmake/config-ix.cmake:18 (include)
CMakeLists.txt:868 (include)

Thanks

What compiler are you using to build LLVM? IIRC gcc doesn’t support -stdlib=libc++. Also, what’s the full CMake command you’re using to configure?

Hi smeenai, here is the related settings from the CMake command that I am using. Does it look sufficient ?

-DCMAKE_C_COMPILER=/usr/bin/clang-15  \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++-15  \
-DLLVM_VERSION_SUFFIX="libcxx"  \
-DLLVM_ENABLE_LIBCXX=ON

Do you have libc++ installed on your system? If you just create a simple C++ source file (e.g. hello world) and build it with /usr/bin/clang++-15 -stdlib=libc++, does it succeed?

Taking a step back, what’s your intention behind passing -DLLVM_ENABLE_LIBCXX=ON to your configure? Do you want LLVM to be built with libc++, or do you want to build libc++ itself?

It does as of GCC 11.1.

1 Like