Llvm-project-16.0.0 build errors

Hi everyone!

Newbie asking for help :slight_smile:
I’m using Ubuntu 22 on an AMD X86_64 computer and I’m trying to install llvm/clang/… from scratch.
I’ve downloaded the project as https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/llvm-project-16.0.0.src.tar.xz, expanded it and proceeded as explained in README.me:

$ cd llvm-project
$ cmake -S llvm -B build -G “Unix Makefiles”
-DLLVM_ENABLE_PROJECTS=“clang;clang-tools-extra;lldb;lld;polly”
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_RUNTIMES=“libcxx;libcxxabi”
-DLLVM_RUNTIME_TARGETS=“libcxx;libcxxabi”

$ cd build
$ cmake --build . -j4

However the building process stops at 87% with the following errors:

[ 87%] Built target generate-cxx-headers
[ 87%] Building CXX object libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_aux_runtime.cpp.o
error: unknown target triple ‘libcxx’
gmake[5]: *** [libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/build.make:76: libcxxabi/src/CMake
Files/cxxabi_shared_objects.dir/cxa_aux_runtime.cpp.o] Error 1
gmake[4]: *** [CMakeFiles/Makefile2:671: libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/all] Err
o 2
gmake[3]: *** [Makefile:136: all] Error 2
gmake[2]: *** [runtimes/CMakeFiles/runtimes-libcxx.dir/build.make:86: runtimes/runtimes-libcxx-stamp
s/runtimes-libcxx-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:174007: runtimes/CMakeFiles/runtimes-libcxx.dir/all] Erro 2
gmake[1]: *** A aguardar por trabalhos não terminados…
[ 90%] Built target clangTidyCppCoreGuidelinesModule
[ 90%] Linking CXX static library …/…/…/…/…/…/lib/liblldbPluginObjCRuntime.a
[ 90%] Built target lldbPluginObjCRuntime
[ 90%] Linking CXX executable …/…/…/…/bin/c-index-test
[ 90%] Built target c-index-test
gmake: *** [Makefile:156: all] Error 2

What am I doing wrong?
or … what should I be doing instead?

Thanks for your help,

-Francisco

Target is a pretty overloaded term, unfortunately :slight_smile: In the case of LLVM_RUNTIME_TARGETS, target refers to a target triple like x86_64-linux-gnu, which controls the platform (OS and architecture) you’re building code for, not a target in the build system sense. It doesn’t sound like you want to cross-compile, so just omit the -DLLVM_RUNTIME_TARGETS="libcxx;libcxxabi" from your configure (you’ll have to blow away your build directory and reconfigure, unfortunately) and see if that works.

It worked!

Thanks :slight_smile:

1 Like