vivek@vivek-System-Product-Name:~/dev/llvm-build$ ninja -j6
[8/12] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
-- Building with -fPIC
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Using LLVM include directories: /home/vivek/dev/llvm-project/llvm/include;/home/vivek/dev/llvm-build/include
CUDA error: forward compatibility was attempted on non supported HW
Failed to 'dlopen' libhsa-runtime64.so
Failed to load libamdhip64.so: libamdhip64.so: cannot open shared object file: No such file or directory
-- OMPT target enabled
-- OpenMP tools dir in libomptarget: /home/vivek/dev/llvm-build/runtimes/runtimes-bins/openmp/runtime/src
-- LIBOMPTARGET: Not building aarch64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building AMDGPU NextGen plugin for dlopened libhsa
-- LIBOMPTARGET: Not generating AMDGPU tests, no supported devices detected.
-- LIBOMPTARGET: Building CUDA NextGen offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin linked against libcuda
-- LIBOMPTARGET: Not generating NVIDIA tests, no supported devices detected.
-- LIBOMPTARGET: Not building PPC64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building x86_64 plugin linked with libffi
-- LIBOMPTARGET: Not building S390X NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building DeviceRTL. Using clang: /home/vivek/dev/llvm-build/bin/clang, llvm-link: /home/vivek/dev/llvm-build/bin/llvm-link and opt: /home/vivek/dev/llvm-build/bin/opt
-- LIBOMPTARGET: Building the llvm-omp-device-info tool
-- LIBOMPTARGET: Building the llvm-omp-kernel-replay tool
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Building plugin unit tests for omptarget.rtl.x86_64
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter Development Development.Module Development.Embed
-- Configuring done
-- Generating done
CMake Error:
Running
'/usr/bin/ninja' '-C' '/home/vivek/dev/llvm-build/runtimes/runtimes-bins' '-t' 'recompact'
failed with:
ninja: error: build.ninja:762: bad $-escape (literal $ must be written as $$)
CMake Generate step failed. Build files cannot be regenerated correctly.
FAILED: runtimes/runtimes-stamps/runtimes-configure /home/vivek/dev/llvm-build/runtimes/runtimes-stamps/runtimes-configure
cd /home/vivek/dev/llvm-build/runtimes/runtimes-bins && /usr/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/home/vivek/dev/llvm-build/./bin/clang -DCMAKE_CXX_COMPILER=/home/vivek/dev/llvm-build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/vivek/dev/llvm-build/./bin/clang -DCMAKE_AR=/home/vivek/dev/llvm-build/./bin/llvm-ar -DCMAKE_RANLIB=/home/vivek/dev/llvm-build/./bin/llvm-ranlib -DCMAKE_NM=/home/vivek/dev/llvm-build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/vivek/dev/llvm-build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/vivek/dev/llvm-build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/vivek/dev/llvm-build/./bin/llvm-strip -DCMAKE_READELF=/home/vivek/dev/llvm-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=/usr/local -DLLVM_BINARY_DIR=/home/vivek/dev/llvm-build -DLLVM_CONFIG_PATH=/home/vivek/dev/llvm-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=19.0.0git -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -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 -DCLANG_RESOURCE_DIR= -DLLVM_ENABLE_RUNTIMES=openmp -GNinja /home/vivek/dev/llvm-project/llvm/runtimes/../../runtimes && /usr/bin/cmake -E touch /home/vivek/dev/llvm-build/runtimes/runtimes-stamps//runtimes-configure
ninja: build stopped: subcommand failed.
Can you try a clean build? The cmake fails in your ninja invocation.
I haven’t seen this one before, without OpenMP it works? Does it work with a different runtime, e.g., libc?
cmake …/llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD=‘X86;NVPTX’ -DLLVM_OPTIMIZED_TABLEGEN=1 -DLLVM_ENABLE_PROJECTS=‘clang’ -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_BUILD_TOOLS=On -DLLVM_ENABLE_RUNTIMES=“libcxx;libcxxabi;libunwind”
and
ninja
worked fine.
However even after deleting everything in build dir and running following commands fails
cmake …/llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD=‘X86;NVPTX’ -DLLVM_OPTIMIZED_TABLEGEN=1 -DLLVM_ENABLE_PROJECTS=‘clang’ -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_BUILD_TOOLS=On -DLLVM_ENABLE_RUNTIMES=“openmp”
ninja -j6
[18/44] Building CXX object openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o
FAILED: openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o
/home/vivek/dev/llvm-build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DDEBUG_PREFIX=\"PluginInterface\" -DGTEST_HAS_RTTI=0 -DLIBOMPTARGET_JIT_NVPTX -DLIBOMPTARGET_JIT_X86 -DOMPTARGET_DEBUG -DOMPT_SUPPORT=1 -DTARGET_NAME=\"PluginInterface\" -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/vivek/dev/llvm-project/llvm/include -I/home/vivek/dev/llvm-build/include -I/home/vivek/dev/llvm-build/runtimes/runtimes-bins/openmp/runtime/src -I/home/vivek/dev/llvm-project/openmp/libomptarget/include -I/home/vivek/dev/llvm-project/openmp/libomptarget/plugins-nextgen/common/include -I/home/vivek/dev/llvm-project/openmp/libomptarget/plugins-nextgen/common/OMPT -isystem /usr/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-enum-constexpr-conversion -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -g -fPIC -fvisibility=protected -fno-exceptions -funwind-tables -fno-rtti -fno-exceptions -fno-rtti -MD -MT openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o -MF openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o.d -o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o -c /home/vivek/dev/llvm-project/openmp/libomptarget/plugins-nextgen/common/src/JIT.cpp
In file included from /home/vivek/dev/llvm-project/openmp/libomptarget/plugins-nextgen/common/src/JIT.cpp:11:
In file included from /home/vivek/dev/llvm-project/openmp/libomptarget/plugins-nextgen/common/include/JIT.h:14:
In file included from /home/vivek/dev/llvm-project/openmp/libomptarget/include/Shared/EnvironmentVar.h:14:
In file included from /home/vivek/dev/llvm-project/openmp/libomptarget/include/Shared/Debug.h:42:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:41:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/system_error:41:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/stdexcept:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/string:53:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:3968:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ext/string_conversions.h:41:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/cstdlib:75:15: fatal error: 'stdlib.h' file not found
75 | #include_next <stdlib.h>
| ^~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build /home/vivek/dev/llvm-build/runtimes/runtimes-stamps/runtimes-build
cd /home/vivek/dev/llvm-build/runtimes/runtimes-bins && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
I’ve seen those glibcxx failures before, I think it’s a bug in the GNU headers that showed up around GCC12 or something? Unfortunately I don’t know of any workarounds besides just using a different compiler / standard library.
Not that I’m aware of, I think that bug shows up in random places. There’s nothing written down as far as I know, but I can try making up a tutorial on the spot.
First you’ll probably want to build clang and the libraries.
Then you can try doing the same thing with the newly installed compiler. Now, strictly speaking you could probably just build LLVM out of the runtimes directory, or even as a project. I think @shiltian has experience there, but I’ve never tried it.
I always use the standalone build of OpenMP. Basically you just build LLVM as normal, just w/o setting OpenMP in either LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES. After the build, set LLVM_ROOT, CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the one you just built when you configure llvm-project/openmp.
Make Warning at /home/vivek/dev/llvm-project/third-party/benchmark/CMakeLists.txt:308 (message):
Using std::regex with exceptions disabled is not fully supported
-- Performing Test HAVE_STEADY_CLOCK -- compiled but failed to run
-- Configuring done
CMake Error at cmake/modules/AddLLVM.cmake:1962 (add_dependencies):
The dependency target "clang" of target "check-all" does not exist.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:2002 (add_lit_target)
CMakeLists.txt:1255 (umbrella_lit_testsuite_end)