Libc build failure on x86

[5747/5751] Linking CXX executable bin/c-index-test
FAILED: runtimes/runtimes-stamps/runtimes-configure /tmp/build/runtimes/runtimes-stamps/runtimes-configure
cd /tmp/build/runtimes/runtimes-bins && /p/software/jurecadc/stages/2022/software/CMake/3.21.1-GCCcore-11.2.0/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/tmp/build/./bin/clang -DCMAKE_CXX_COMPILER=/tmp/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/tmp/build/./bin/clang -DCMAKE_LINKER=/tmp/build/./bin/ld.lld -DCMAKE_AR=/tmp/build/./bin/llvm-ar -DCMAKE_RANLIB=/tmp/build/./bin/llvm-ranlib -DCMAKE_NM=/tmp/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/tmp/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/tmp/build/./bin/llvm-objcopy -DCMAKE_STRIP=/tmp/build/./bin/llvm-strip -DCMAKE_READELF=/tmp/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_ASM_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_INSTALL_PREFIX=/tmp/libc-gpumode -DLLVM_BINARY_DIR=/tmp/build -DLLVM_CONFIG_PATH=/tmp/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-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=17.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/p/software/jurecadc/stages/2022/software/Ninja/1.10.2-GCCcore-11.2.0/bin/ninja -DCMAKE_C_COMPILER_LAUNCHER= -DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=ON -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-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_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON -DLIBC_HDRGEN_EXE=/tmp/build/bin/libc-hdrgen -DLLVM_LIBC_FULL_BUILD=ON "-DLLVM_ENABLE_RUNTIMES=libc;openmp" -DLIBCLANG_BUILD_STATIC=OFF -DLIBCLANG_LIBRARY_VERSION=17 -DLIBC_TABLEGEN=libc-hdrgen -DLLVM_LIBCXX_USED=0 -DLLVM_LIBC_FULL_BUILD=ON -DLLVM_LIBC_GPU_ARCHITECTURES=all -DLLVM_LIBC_TABLEGEN=libc-prototype-testgen -DLLVM_LIBC_TARGET_OS=gpu -DLIBC_TABLEGEN=libc-hdrgen -GNinja /p/scratch/cjinb33/kitayama1/projects/llvm-project/llvm/runtimes/../../runtimes && /p/software/jurecadc/stages/2022/software/CMake/3.21.1-GCCcore-11.2.0/bin/cmake -E touch /tmp/build/runtimes/runtimes-stamps//runtimes-configure
ninja: build stopped: subcommand failed.

Below is how I executed CMake:

cmake -G Ninja -S llvm -B /tmp/build \
   -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt"        \
   -DLLVM_ENABLE_RUNTIMES="libc;openmp"                  \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_LIBC_FULL_BUILD=ON \
   -DLLVM_LIBC_TARGET_OS=gpu \
   -DLLVM_LIBC_GPU_ARCHITECTURES=all \
   -DCMAKE_INSTALL_PREFIX=/tmp/libc-gpumode

I am trying to build main branch.

I copied your CMake and it worked for me. The above seems to fail when LLVM invokes the runtimes configuration. But I’m not sure what your issue could be.

[5749/5751] No install step for 'runtimes'
[5751/5751] Completed 'runtimes'
1 Like

@jhuber6 Thanks. On JURECA at JSC, I switched to a new software stack and added CMake variables to explicitly set the GCC version the software stack provides (also did clean the build dir), the build went fine. Now I am checking the results of ninja check-libc.

There currently aren’t any GPU tests running in libc yet. That’s still WIP as I work on a mechanism to send calls back to the host.

Also, some components aren’t built unless you specify ninja install-libc, but this shouldn’t be required for the files most people care about.

1 Like

For libc , you need at least a gcc12.2 to succeed.

1 Like

Got it. Then I will write a small program using OpenMP offloading locally.

Is this a subproject-level requirement?

Their web-pages states the requirements. For LLVM as a project the requirements are lower.

Specifically, the GPU project is only going to be supported via the LLVM_ENABLE_RUNTIMES=libc option, or a strict two-part build. This is because the only compiler we can reliably use to compile code for the GPU is a new clang. There’s a static check that the Clang version is equal to the LLVM version in the CMake.