Skip to content

Building libcxxabi throws “cannot find -lcxx-headers” error #116088

@jonathonmckay

Description

@jonathonmckay

Apologies in advance if this isn't the right place to raise this.
I maintain a small HPC cluster. As a result, I often have to install things in non standard ways.
I already have LLVM and Clang 16.0.6 compiled and installed. While attempting to build a 3rd party program, it became clear that I also needed libc++ and libc++abi.

I found instructions on installing libc++ and libc++abi on CentOS7 from Stack Overflow here. These are essentially the steps I followed, making path and other settings changes as needed. I downloaded the .src.tar.xz files for libcxx and libcxxabi from https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6

Step 5 involves building libcxx without libcxxabi. After some minor problems, I got the following cmake command to do what I want:
cmake -DCMAKE_INSTALL_PREFIX=/minerva/opt/llvm-16.0.6/ -DCMAKE_BUILD_TYPE=Release -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBCXX_CXX_ABI=none ..

Once that worked and was built and installed with make install, I then moved on to Step 6, which involves building libcxxabi with the libcxx I just built. After a few more minor problems, I got the following cmake command:
cmake -DCMAKE_INSTALL_PREFIX=/minerva/opt/llvm-16.0.6/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx-16.0.6.src/include/ -DLIBCXXABI_LIBCXX_PATH=../../libcxx-16.0.6.src/ ..
This finished successfully.

Then when trying to actually compile with make, while it is trying to link libc++abi.so, I get the following error:
/usr/bin/ld: cannot find -lcxx-headers

From what I can tell, this is supposed to be part of libcxx, but I cannot find any "libcxx-headers" in either the source code or in the installed location.
I found that libcxx has make targets generate-cxx-headers, but I verified those have been done and finished without errors.

I expect I'm missing something fundamental, and have likely done something somewhat daft due to the way we install things on our HPC system.

If anyone has any insight, it would be greatly appreciated (There has already been two days of searching and trying things). If any additional information is required, please don't hesitate to ask.

Metadata

Metadata

Assignees

No one assigned

    Labels

    build-problemlibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++abilibc++abi C++ Runtime Library. Not libc++.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions