root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.66k stars 1.27k forks source link

[FreeBSD] cling cmake error #13865

Closed mkrzewic closed 10 months ago

mkrzewic commented 1 year ago

Check duplicate issues.

Description

-- Building Cling as part of ROOT -- Cling version (from VERSION file): ROOT_1.0~dev CMake Error at interpreter/llvm-project/llvm/cmake/modules/LLVM-Config.cmake:138 (message): Target host is not in the set of libraries. Call Stack (most recent call first): interpreter/llvm-project/llvm/cmake/modules/LLVM-Config.cmake:256 (llvm_expand_pseudo_components) interpreter/llvm-project/llvm/cmake/modules/AddLLVM.cmake:641 (llvm_map_components_to_libnames) interpreter/cling/CMakeLists.txt:426 (llvm_add_library) interpreter/cling/lib/Interpreter/CMakeLists.txt:60 (add_cling_library)

Reproducer

cmake ../../src/root -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo

ROOT version

recent master @fee23275

Installation method

source

Operating system

FreeBSD 13.2p4

Additional context

No response

eamjensen commented 11 months ago

Same operating system as @mkrzewic. Slightly newer master version of ROOT @615eaf63.

When running cmake ../root -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo, the following error is reported:

[...]
-- Building Cling as part of ROOT
CMake Error at interpreter/cling/CMakeLists.txt:196 (message):
  NVPTX backend is not activated

  Please enable it via -DLLVM_TARGETS_TO_BUILD="host;NVPTX"

-- Configuring incomplete, errors occurred!

When running cmake ../root -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_TARGETS_TO_BUILD="host;NVPTX", the following error is reported:

[...]
-- Building Cling as part of ROOT
-- Cling version (from VERSION file): ROOT_1.0~dev
CMake Error at interpreter/llvm-project/llvm/cmake/modules/LLVM-Config.cmake:138 (message):
  Target host is not in the set of libraries.
Call Stack (most recent call first):
  interpreter/llvm-project/llvm/cmake/modules/LLVM-Config.cmake:256 (llvm_expand_pseudo_components)
  interpreter/llvm-project/llvm/cmake/modules/AddLLVM.cmake:641 (llvm_map_components_to_libnames)
  interpreter/cling/CMakeLists.txt:426 (llvm_add_library)
  interpreter/cling/lib/Interpreter/CMakeLists.txt:60 (add_cling_library)

-- Configuring incomplete, errors occurred!

Removing the "host" string from the list LLVM_TARGETS_TO_BUILD, seems to fix the issue, as running cmake ../root -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_TARGETS_TO_BUILD="NVPTX" results in successful build configuration.

Following this, ROOT successfully compiles almost all the way up to 100%:

[ 98%] Linking CXX executable ../../bin/hist2workspace
[ 98%] Linking CXX shared library ../../lib/libRooFitHS3.so
[ 98%] Built target hist2workspace
[100%] Built target RooFitHS3
[100%] Linking CXX shared library ../../lib/libRooFitXRooFit.so
[100%] Built target RooFitXRooFit
[100%] Built target onepcm
[100%] Generating lib/modules.idx
Abort trap (core dumped)
--- lib/modules.idx ---
*** [lib/modules.idx] Error code 134

make[2]: stopped in /usr/home/erik/devel/resources/root/build
1 error

make[2]: stopped in /usr/home/erik/devel/resources/root/build
--- CMakeFiles/modules_idx.dir/all ---
*** [CMakeFiles/modules_idx.dir/all] Error code 2

make[1]: stopped in /usr/home/erik/devel/resources/root/build
1 error

make[1]: stopped in /usr/home/erik/devel/resources/root/build
*** [all] Error code 2

make: stopped in /usr/home/erik/devel/resources/root/build
1 error

make: stopped in /usr/home/erik/devel/resources/root/build

on my machine via cmake --build . -- -j8 with the following (default/automatic) configuration:

-- ROOT Configuration 

System          FreeBSD-13.2-RELEASE-p4
Processor       8 core 0 MHz  (amd64)
Build type      RelWithDebInfo
Install path    /usr/local
Compiler        Clang 14.0.5
Compiler flags:
C                -pipe -Wall -W -pthread -O2 -g -DNDEBUG
C++              -std=c++17 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe  -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O2 -g -DNDEBUG
Linker flags:
Executable       -rdynamic
Module          
Shared           -Wl,--no-undefined

-- Enabled support for:  asimage builtin_clang builtin_cling builtin_llvm builtin_openui5 clad dataframe exceptions fitsio gdml http imt minuit2 opengl proof pyroot roofit webgui root7 rpath runtime_cxxmodules shared sqlite ssl tmva tmva-cpu tmva-pymva spectrum vdt x11 xml xrootd

As for the original CMake configuration error, my guess is that the CMake target "host" used to be part of the CMake project, but is no longer part of the CMake project, and that the error message in interpreter/cling/CMakeLists.txt:196 was not updated to reflect this when the CMake target "host" was removed from the CMake project.

As for the error on the final generation of lib/modules.idx, the issue seems to be with root.exe which is invoked with the following build step command:

cd /usr/home/erik/devel/resources/root/build/lib && LD_LIBRARY_PATH=/usr/home/erik/devel/resources/root/build/lib: ROOTIGNOREPREFIX=1 ROOT_HIST=0 /usr/home/erik/devel/resources/root/build/bin/root.exe -l -q -b

Running root.exe by itself generates an Abort trap (core dumped).

Have you stumbled upon this issue previously, @mkrzewic, and if so, have you managed to deal with it somehow?

mkrzewic commented 11 months ago

@eamjensen yes, the modules.idx thing was already solved in the first FreeBSD related patches but I don't remember what was the problem exactly, I'll see if I can dig it up...

mkrzewic commented 11 months ago

@eamjensen -DLLVM_TARGETS_TO_BUILD="NVPTX" helps, thanks. I'll close this for now. the modules.idx problem might need a separate ticket, feel free to open one for the record, when time allows I'll come back to this if it is not solved by then.