[llvm] [Offload] generate LLVMOffloadKernel library (PR #211694)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 09:08:35 PDT 2026
================
----------------
agozillon wrote:
I'm not sure if this is a known issue (or even an issue), as my familiarity with CMake and llvm's CMake infrastructure is fairly limited, but thought I would bring it up just incase. This appears to cause issues when we compile LLVM with dynamic libraries on, predominantly the link command e.g.:
" -DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DCLANG_LINK_CLANG_DYLIB=ON \"
The below is an admittedly monstrous compilation command I use which works as we add none of the above options, but if I add those options we run into the issue where we're missing "ol.." symbol definitions. I've added this bit of information for context, perhaps the command itself is flawed/outdated and there is no problem :-)
cmake -G Ninja \
../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_C_COMPILER=$(which gcc) \
-DCMAKE_CXX_COMPILER=$(which g++) \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_DUMP=ON \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86;" \
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;flang" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;openmp;offload;compiler-rt;flang-rt" \
-DCLANG_DEFAULT_PIE_ON_LINUX=0 \
-DCLANG_DEFAULT_LINKER=lld \
-DCLANG_ENABLE_AMDCLANG=ON \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLIBCXX_ENABLE_STATIC=ON \
-DLIBCXXABI_ENABLE_STATIC=ON \
-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath \
-DFLANG_RT_INCLUDE_AMD=ON \
-DLIBOMPTARGET_BUILD_DEVICE_FORTRT=ON \
-DOPENMP_ENABLE_LIBOMPTARGET=1 \
-DLIBOMPTARGET_AMDGCN_GFXLIST="gfx90a" \
-DLIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH="../somepath" \
-DLLVM_RUNTIME_TARGETS="default;amdgcn-amd-amdhsa" \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES="compiler-rt;libc;libcxx;libcxxabi;flang-rt;openmp" \
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
-DRUNTIMES_amdgcn-amd-amdhsa_FLANG_RT_LIBC_PROVIDER=llvm \
-DRUNTIMES_amdgcn-amd-amdhsa_FLANG_RT_LIBCXX_PROVIDER=llvm \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
It seemed to compile fine with the DYLIB flags when I remove Offload from the link components and add a separate "target_link_libraries(LLVMOffloadKernel PRIVATE LLVMOffload)" a line or so below. But my CMake knowledge is fairly weak, so there's likely a better solution if this is indeed a problem.
https://github.com/llvm/llvm-project/pull/211694
More information about the llvm-commits
mailing list