Hello there,
I’ve been trying to get clang OpenMP GPU offloading working for weeks now. I think I wasted multiple kWh in compiling LLVM (please update the information on the website, I beg you).
Anyway I resorted to building the Docker Image and in builds fine (cmdline:
~/llvm_project/llvm/utils/docker:$ bash build_docker_image.sh
--source nvidia-cuda
--docker-repository clang-cuda --docker-tag "latest"
-p clang -i stage2-install-clang -i stage2-install-clang-resource-headers
--
-DLLVM_TARGETS_TO_BUILD="host;NVPTX"
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_RUNTIMES="openmp;offload"
-DLIBOMPTARGET_DEVICE_ARCHITECHTURES="sm_86"
-DBOOTSTRAP_CMAKE_BUILD_TYPE=Release
-DCLANG_ENABLE_BOOTSTRAP=ON
-DCLANG_BOOTSTRAP_TARGETS="install-clang;install-clang-resource-headers"
-DLLVM_ENABLE_PROJECTS="clang;clang-tools;lld;lldb;openmp"
) but then when I try to compile an example: clang++ -fopenmp -fopenmp-targets=nvptx64 -O3 run.cpp
:
clang++: error: cannot determine nvptx64 architecture: nvptx-arch: posix_spawn failed: No such file or directory; consider passing it via '--offload-arch'; environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool timeout (integer secs, <=0 is infinite)
And when I pass --offload-arch="sm_86"
:
clang++: error: no library 'libomptarget-nvptx.bc' found in the default clang lib directory or in LIBRARY_PATH; use '--libomptarget-nvptx-bc-path' to specify nvptx bitcode library
I tried the current master
branch and tag 20.1.5. Also multiple machines and GPUs (sm_60, sm_75, sm_86), Debian, NixOS (all x86_64).
The Docker container is run with runtime nvidia: docker run -it --runtime=nvidia --gpus all -v $PWD:/app clang-cuda:latest /bin/bash
and nvidia-smi
shows the correct result:
Mon Jun 2 09:39:09 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03 Driver Version: 560.35.03 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3080 ... Off | 00000000:01:00.0 Off | N/A |
| N/A 42C P8 14W / 150W | 593MiB / 16384MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+
Sorry about that, it’s definitely got some outright incorrect information in there. Probably need to set some time aside to update it. I don’t know much about Docker, but I’ll try to explain some stuff.
This is unused now.
This likely means the tool wasn’t built for some reason, could try ninja offload-arch
. But you’re on clang-20 I see? Some things might be a little outdated from my mental model.
clang++: error: no library 'libomptarget-nvptx.bc' found in the default clang lib directory or in LIBRARY_PATH; use '--libomptarget-nvptx-bc-path' to specify nvptx bitcode library
You should have lib/nvptx64-nvidia-cuda/libomptarget-nvptx.bc
somewhere. I think that’s changed in 21 as well so I don’t remember.
I’d recommend you get the main
branch and try what’s listed in the documentation. It’s supposed to work, if not we have an issue.
$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> cmake ../llvm -G Ninja \
-C ../offload/cmake/caches/Offload.cmake \ # The preset cache file
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<PATH> \ # Where the libraries will live
$> ninja install
If you’re trying to get some minimal set of stuff, then the core CMake targets off the top of my head would be libomptarget
, libomp
, omptarget.nvptx
, offload-arch
, clang
, clang-linker-wrapper
, clang-nvlink-wrapper
, clang-offload-packager
, and all the LLVM tools w/ the NVPTX backend enabled.
But you’re on clang-20 I see?
This was a build I did on git tag 20.1.5. As I said, I tried a lot of versions. Currently building are two main branch versions. One where clang is bootstrapped and one only with the default install process. I’ve seen the documentation but don’t know anymore what went wrong there. Gonna send my next message when compiling finished. The Problem is: I’m not on the newest hardware and a compile process takes roughly one to two hours. Currently I’ve got my hands on some newer Hardware but don’t have access 24/7 and it still takes around half an hour…
You could speed it up somewhat by making it much leaner. Like setting LLVM_TARGETS_TO_BUILD="X86;NVPTX"
.
Did now finish the first set: doesn’t compile due to a python missing dependency:
> [7/7] RUN ninja install:
1742.6 from hdrgen.yaml_to_classes import load_yaml_file, fill_public_api
1742.6 File "/llvm-project/libc/utils/hdrgen/hdrgen/yaml_to_classes.py", line 11, in <module>
1742.6 import yaml
1742.6 ModuleNotFoundError: No module named 'yaml'
(i copied the dependency installation from the nvidia-cuda docker container provided in the llvm/utils/docker directory)
I’ve now added python3-yaml
to the apt installs. Up to another round we go!
That’s for the libc
support, not strictly necessary if you can’t get yaml
support but it’s probably easier just to install that.
Well I’m gonna create a Pull request with a working Docker example when done here so that’s an important imformation 
With LLVM_TARGETS_TO_BUILD="X86;NVPTX"
it now only builds ~ 5000 instead of over 6000 files…
Ah, there we have it:
> [7/7] RUN ninja install:
1364.9 /llvm-project/build/./bin/clang --target=amdgcn-amd-amdhsa -O3 -DNDEBUG -flto -DCOMPILER_RT_HAS_FLOAT16 -MD -MT CMakeFiles/clang_rt.builtins-amdgcn.dir/comparedf2.c.o -MF CMakeFiles/clang_rt.builtins-amdgcn.dir/comparedf2.c.o.d -o CMakeFiles/clang_rt.builtins-amdgcn.dir/comparedf2.c.o -c /llvm-project/compiler-rt/lib/builtins/comparedf2.c
1364.9 clang: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
i guess -nogpulib
is not a CMAKE variable is it?
Ehh, that’s weird. We should be passing that from here llvm-project/compiler-rt/cmake/builtin-config-ix.cmake at main · llvm/llvm-project · GitHub. Think you could somehow send me the CMake logs that show that compile flag check?
Here you go:
cmake ../llvm -G Ninja -C ../offload/cmake/caches/Offload.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/llvm -DLLVM_TARGETS_TO_BUILD="X86;NVPTX"
#11 0.285 loading initial cache file ../offload/cmake/caches/Offload.cmake
#11 0.420 -- The C compiler identification is GNU 13.2.0
#11 0.538 -- The CXX compiler identification is GNU 13.2.0
#11 0.550 -- The ASM compiler identification is GNU
#11 0.553 -- Found assembler: /usr/bin/cc
#11 0.571 -- Detecting C compiler ABI info
#11 0.671 -- Detecting C compiler ABI info - done
#11 0.681 -- Check for working C compiler: /usr/bin/cc - skipped
#11 0.682 -- Detecting C compile features
#11 0.682 -- Detecting C compile features - done
#11 0.698 -- Detecting CXX compiler ABI info
#11 0.803 -- Detecting CXX compiler ABI info - done
#11 0.813 -- Check for working CXX compiler: /usr/bin/c++ - skipped
#11 0.813 -- Detecting CXX compile features
#11 0.814 -- Detecting CXX compile features - done
#11 0.832 -- bolt project is disabled
#11 0.832 -- clang project is enabled
#11 0.832 -- clang-tools-extra project is enabled
#11 0.832 -- compiler-rt project is disabled
#11 0.832 -- cross-project-tests project is disabled
#11 0.832 -- libc project is disabled
#11 0.832 -- libclc project is disabled
#11 0.832 -- lld project is enabled
#11 0.832 -- lldb project is disabled
#11 0.832 -- mlir project is disabled
#11 0.832 -- openmp project is disabled
#11 0.832 -- polly project is disabled
#11 0.832 -- pstl project is disabled
#11 0.832 -- flang project is disabled
#11 0.986 -- Found Python3: /usr/bin/python3 (found suitable version "3.12.3", minimum required is "3.8") found components: Interpreter
#11 0.992 -- Looking for __GLIBC__
#11 1.099 -- Looking for __GLIBC__ - found
#11 1.099 -- Looking for valgrind/valgrind.h
#11 1.138 -- Looking for valgrind/valgrind.h - not found
#11 1.138 -- Looking for FE_ALL_EXCEPT
#11 1.208 -- Looking for FE_ALL_EXCEPT - found
#11 1.208 -- Looking for FE_INEXACT
#11 1.279 -- Looking for FE_INEXACT - found
#11 1.279 -- Performing Test HAVE_BUILTIN_THREAD_POINTER
#11 1.347 -- Performing Test HAVE_BUILTIN_THREAD_POINTER - Success
#11 1.348 -- Looking for CrashReporterClient.h
#11 1.388 -- Looking for CrashReporterClient.h - not found
#11 1.388 -- Looking for linux/magic.h
#11 1.453 -- Looking for linux/magic.h - found
#11 1.454 -- Looking for pthread_create in pthread
#11 1.536 -- Looking for pthread_create in pthread - found
#11 1.537 -- Looking for pthread_rwlock_init in pthread
#11 1.623 -- Looking for pthread_rwlock_init in pthread - found
#11 1.623 -- Looking for pthread_mutex_lock in pthread
#11 1.714 -- Looking for pthread_mutex_lock in pthread - found
#11 1.714 -- Looking for dlopen in dl
#11 1.810 -- Looking for dlopen in dl - found
#11 1.810 -- Looking for shm_open in rt
#11 1.887 -- Looking for shm_open in rt - found
#11 1.888 -- Looking for pfm_initialize in pfm
#11 1.942 -- Looking for pfm_initialize in pfm - not found
#11 1.943 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
#11 2.040 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
#11 2.041 -- Found Threads: TRUE
#11 2.052 -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
#11 2.064 -- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
#11 2.071 -- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES)
#11 2.071 -- Looking for arc4random
#11 2.177 -- Looking for arc4random - found
#11 2.177 -- Looking for backtrace
#11 2.270 -- Looking for backtrace - found
#11 2.270 -- backtrace facility detected in default set of libraries
#11 2.271 -- Found Backtrace: /usr/include
#11 2.272 -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
#11 2.330 -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
#11 2.331 -- Looking for __register_frame
#11 2.421 -- Looking for __register_frame - found
#11 2.422 -- Looking for __deregister_frame
#11 2.499 -- Looking for __deregister_frame - found
#11 2.499 -- Looking for __unw_add_dynamic_fde
#11 2.590 -- Looking for __unw_add_dynamic_fde - not found
#11 2.590 -- Looking for _Unwind_Backtrace
#11 2.673 -- Looking for _Unwind_Backtrace - found
#11 2.674 -- Looking for getpagesize
#11 2.740 -- Looking for getpagesize - found
#11 2.740 -- Looking for sysconf
#11 2.801 -- Looking for sysconf - found
#11 2.801 -- Looking for getrusage
#11 2.869 -- Looking for getrusage - found
#11 2.869 -- Looking for isatty
#11 2.945 -- Looking for isatty - found
#11 2.945 -- Looking for futimens
#11 3.019 -- Looking for futimens - found
#11 3.019 -- Looking for futimes
#11 3.090 -- Looking for futimes - found
#11 3.091 -- Looking for getauxval
#11 3.179 -- Looking for getauxval - found
#11 3.179 -- Looking for sigaltstack
#11 3.260 -- Looking for sigaltstack - found
#11 3.260 -- Looking for mallctl
#11 3.295 -- Looking for mallctl - not found
#11 3.295 -- Looking for mallinfo
#11 3.379 -- Looking for mallinfo - found
#11 3.380 -- Looking for mallinfo2
#11 3.453 -- Looking for mallinfo2 - found
#11 3.453 -- Looking for malloc_zone_statistics
#11 3.485 -- Looking for malloc_zone_statistics - not found
#11 3.486 -- Looking for posix_spawn
#11 3.560 -- Looking for posix_spawn - found
#11 3.560 -- Looking for pread
#11 3.650 -- Looking for pread - found
#11 3.651 -- Looking for sbrk
#11 3.762 -- Looking for sbrk - found
#11 3.762 -- Looking for strerror_r
#11 3.855 -- Looking for strerror_r - found
#11 3.856 -- Looking for strerror_s
#11 3.901 -- Looking for strerror_s - not found
#11 3.903 -- Looking for setenv
#11 3.998 -- Looking for setenv - found
#11 3.999 -- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
#11 4.038 -- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Failed
#11 4.039 -- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
#11 4.111 -- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success
#11 4.112 -- Looking for pthread_getname_np
#11 4.189 -- Looking for pthread_getname_np - found
#11 4.190 -- Looking for pthread_setname_np
#11 4.267 -- Looking for pthread_setname_np - found
#11 4.269 -- Looking for pthread_get_name_np
#11 4.310 -- Looking for pthread_get_name_np - not found
#11 4.310 -- Looking for pthread_set_name_np
#11 4.353 -- Looking for pthread_set_name_np - not found
#11 4.354 -- Looking for dlopen
#11 4.441 -- Looking for dlopen - found
#11 4.441 -- Looking for proc_pid_rusage
#11 4.487 -- Looking for proc_pid_rusage - not found
#11 4.487 -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
#11 4.645 -- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
#11 4.645 -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
#11 4.808 -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
#11 4.809 -- Performing Test LLVM_HAS_ATOMICS
#11 4.892 -- Performing Test LLVM_HAS_ATOMICS - Success
#11 5.426 -- LLVM host triple: x86_64-unknown-linux-gnu
#11 5.426 -- Native target architecture is X86
#11 5.426 -- Threads enabled.
#11 5.426 -- Doxygen disabled.
#11 5.429 -- Ninja version: 1.11.1
#11 5.431 -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
#11 5.433 -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
#11 5.433 -- OCaml bindings disabled.
#11 5.447 -- Could NOT find Python module pygments
#11 5.461 -- Could NOT find Python module pygments.lexers.c_cpp
#11 5.500 -- Found Python module yaml
#11 5.501 -- LLVM default target triple: x86_64-unknown-linux-gnu
#11 5.509 -- Performing Test C_SUPPORTS_FPIC
#11 5.570 -- Performing Test C_SUPPORTS_FPIC - Success
#11 5.571 -- Performing Test CXX_SUPPORTS_FPIC
#11 5.672 -- Performing Test CXX_SUPPORTS_FPIC - Success
#11 5.672 -- Building with -fPIC
#11 5.672 -- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
#11 5.744 -- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
#11 5.746 -- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
#11 5.828 -- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
#11 5.829 -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
#11 5.910 -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
#11 5.911 -- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
#11 5.954 -- Performing Test C_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Failed
#11 5.956 -- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG
#11 6.007 -- Performing Test CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG - Failed
#11 6.007 -- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
#11 6.115 -- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
#11 6.116 -- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
#11 6.211 -- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
#11 6.211 -- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
#11 6.250 -- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
#11 6.251 -- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
#11 6.295 -- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Failed
#11 6.298 -- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
#11 6.393 -- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
#11 6.394 -- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
#11 6.458 -- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
#11 6.459 -- Looking for os_signpost_interval_begin
#11 6.507 -- Looking for os_signpost_interval_begin - not found
#11 6.530 -- Linker detection: GNU ld
#11 6.540 -- Performing Test LLVM_LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS
#11 6.640 -- Performing Test LLVM_LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS - Success
#11 6.645 -- Performing Test HAS_WERROR_GLOBAL_CTORS
#11 6.705 -- Performing Test HAS_WERROR_GLOBAL_CTORS - Failed
#11 6.710 -- Looking for __x86_64__
#11 6.805 -- Looking for __x86_64__ - found
#11 6.883 -- Found Git: /usr/bin/git (found version "2.43.0")
#11 7.107 -- Looking for logf128
#11 7.406 -- Looking for logf128 - found
#11 7.542 -- Targeting X86
#11 7.571 -- Targeting NVPTX
#11 7.759 -- LLD version: 21.0.0
#11 7.929 -- Looking for sys/resource.h
#11 8.010 -- Looking for sys/resource.h - found
#11 8.010 -- Looking for dlfcn.h
#11 8.090 -- Looking for dlfcn.h - found
#11 8.091 -- Looking for dladdr
#11 8.184 -- Looking for dladdr - found
#11 8.184 -- Clang version: 21.0.0git
#11 8.454 -- Looking for include file sys/inotify.h
#11 8.553 -- Looking for include file sys/inotify.h - found
#11 8.691 -- Performing Test HAVE_LINKER_FLAG_LONG_PLT
#11 8.759 -- Performing Test HAVE_LINKER_FLAG_LONG_PLT - Failed
#11 9.188 -- Found Perl: /usr/bin/perl (found version "5.38.2")
#11 10.35 -- Not building llvm-mt because libxml2 is not available
#11 10.85 -- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
#11 10.96 -- Registering Bye as a pass plugin (static build: OFF)
#11 13.01 -- Failed to find LLVM FileCheck
#11 13.03 -- Google Benchmark version: v0.0.0, normalized to 0.0.0
#11 13.03 -- Looking for shm_open in rt
#11 13.18 -- Looking for shm_open in rt - found
#11 13.18 -- Performing Test HAVE_CXX_FLAG_WALL
#11 13.31 -- Performing Test HAVE_CXX_FLAG_WALL - Success
#11 13.31 -- Performing Test HAVE_CXX_FLAG_WEXTRA
#11 13.43 -- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
#11 13.43 -- Performing Test HAVE_CXX_FLAG_WSHADOW
#11 13.56 -- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
#11 13.56 -- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
#11 13.71 -- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
#11 13.71 -- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST
#11 13.86 -- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST - Success
#11 13.87 -- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
#11 13.99 -- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
#11 13.99 -- Performing Test HAVE_CXX_FLAG_PEDANTIC
#11 14.12 -- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
#11 14.12 -- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
#11 14.25 -- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
#11 14.25 -- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
#11 14.35 -- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
#11 14.35 -- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
#11 14.49 -- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
#11 14.49 -- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
#11 14.65 -- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
#11 14.65 -- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS
#11 14.82 -- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS - Success
#11 14.82 -- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
#11 14.95 -- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
#11 14.95 -- Performing Test HAVE_CXX_FLAG_WD654
#11 15.04 -- Performing Test HAVE_CXX_FLAG_WD654 - Failed
#11 15.05 -- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
#11 15.14 -- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
#11 15.14 -- Performing Test HAVE_CXX_FLAG_COVERAGE
#11 15.28 -- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
#11 15.28 -- Compiling and running to test HAVE_GNU_POSIX_REGEX
#11 15.36 -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
#11 15.36 -- Compiling and running to test HAVE_POSIX_REGEX
#11 15.77 -- Performing Test HAVE_POSIX_REGEX -- success
#11 15.77 -- Compiling and running to test HAVE_STEADY_CLOCK
#11 16.04 -- Performing Test HAVE_STEADY_CLOCK -- success
#11 16.04 -- Compiling and running to test HAVE_PTHREAD_AFFINITY
#11 16.23 -- Performing Test HAVE_PTHREAD_AFFINITY -- success
#11 16.34 -- Configuring done (16.0s)
#11 21.85 -- Generating done (4.3s)
#11 22.54 -- Build files have been written to: /llvm-project/build
#11 DONE 23.3s
On another front: I tried installing ROCm with: Quick start installation guide — ROCm installation (Linux) and still got the issue…
Neither CUDA nor ROCm are required for building LLVM.
I would trust you but my compiler tells me otherwise 
If someone is interested how to cause the issue:
FROM nvidia/cuda:12.6.3-devel-ubuntu24.04
WORKDIR /root
# for ROCm (didn't work either)
# RUN apt update && apt install -y wget
# RUN wget https://repo.radeon.com/amdgpu-install/6.4.1/ubuntu/noble/amdgpu-install_6.4.60401-1_all.deb
# RUN apt install -y ./amdgpu-install_6.4.60401-1_all.deb
# RUN apt update && apt install -y python3-setuptools python3-wheel && \
# rm -rf /var/lib/apt/lists/*
# RUN usermod -a -G render,video
# RUN apt update && apt install -y rocm libdrm-dev && \
# rm -rf /var/lib/apt/lists/*
# Install llvm build dependencies.
RUN apt update && \
apt install -y --no-install-recommends ca-certificates cmake 2to3 python-is-python3 \
subversion ninja-build python3-yaml git && \
rm -rf /var/lib/apt/lists/*
ADD https://github.com/llvm/llvm-project.git /llvm-project
RUN mkdir /llvm-project/build
WORKDIR /llvm-project/build
RUN cmake ../llvm -G Ninja \
-C ../offload/cmake/caches/Offload.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/llvm \
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX"
RUN ninja install
Ok, I tried building it on TUXEDO OS (Debian derivation) and the same issue occurs. Here the complete log: Error.log · GitHub
-- Performing Test COMPILER_RT_HAS_NOGPULIB_FLAG
-- Performing Test COMPILER_RT_HAS_NOGPULIB_FLAG - Failed
Oh, this might be because you turned off AMDGPU
support and now it fails because you can’t actually build these checks. Yeah, either use `LLVM_TARGETS_TO_BUILD=‘AMDGPU;NVPTX;X86’ or remove the AMDGPU stuff.