root-project / root

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

[CMake] troubles with ROOT 6.26.04 from CVMFS #10963

Closed cburgard closed 2 years ago

cburgard commented 2 years ago
bellenot commented 2 years ago

@linev Since you introduced that dependency, can you take a look? Thanks!

andresailer commented 2 years ago

Hi everyone, the problem arises because /cvmfs/sft.cern.ch/lcg/releases/LCG_102/ROOT/6.26.04/x86_64-centos7-gcc11-opt/ROOT-env.sh (or I guess whatever setupATLAS is doing) is not exporting the CMAKE_PREFIX_PATH to all dependencies. exporting CMAKE_PREFIX_PATH to point to the folder for nlohmann_json fixes this.

I.e., this works

export PATH=/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.23.1/Linux-x86_64/bin/:$PATH
source /cvmfs/sft.cern.ch/lcg/releases/LCG_102/ROOT/6.26.04/x86_64-centos7-gcc11-opt/ROOT-env.sh
export CMAKE_PREFIX_PATH=$JSONMCPP__HOME:$CMAKE_PREFIX_PATH

cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.20)
project(test)
find_package( ROOT REQUIRED COMPONENTS Core RIO MathCore Matrix HistFactory RooFitCore RooFit Hist RooStats Minuit2 Minuit)

EOF

mkdir -p build
cd build
cmake ..

Cheers, Andre

bellenot commented 2 years ago

Thanks @andresailer ! Then who should take care of this?

andresailer commented 2 years ago

I think @cburgard just needs to export the CMAKE_PREFIX_PATH.

I don't know what setupATLAS is doing, so I don't know if that relies on lcgenv, or does its own thing.

We can probably add the CMAKE_PREFIX_PATH exports to lcgenv, but this isn't going to show up on CVMFS for the existing releases.

cburgard commented 2 years ago

@andresailer I'm happy to try whatever you send me, but I'm not going to be the only person encountering this issue, setupATLAS is the default way the majority of ATLAS users setup root, unless they use an ATLAS analysis release that ships with ROOT. I don't know who's in charge of doing this.

andresailer commented 2 years ago

If your setup gives you the JSONMCPP__HOME variable, please try: export CMAKE_PREFIX_PATH=$JSONMCPP__HOME:$CMAKE_PREFIX_PATH before running cmake

linev commented 2 years ago

@bellenot I guess issue is due to difference in shell environment between ROOT compilation and ROOT-based code. One have to ensure that same nlohmann/json.hpp version is detected in both cases. Actually it has nothing to do with my last change which only set minimal accepted version to 3.9.

cburgard commented 2 years ago

@andresailer This fixes it, which is great (for me), but perhaps you want to undertake some steps so that this obscure fix doesn't need to be performed by everyone in the future?

andresailer commented 2 years ago

Totally, this is what I refer to here https://github.com/root-project/root/issues/10963#issuecomment-1186980925

cburgard commented 2 years ago

Ok, great. Shall we close this issue here then or do you want to keep it open until this is done?

andresailer commented 2 years ago

I think we can close this here. We can follow up in https://sft.its.cern.ch/jira/browse/SPI-2197

cburgard commented 2 years ago

Ok, great. Thanks!

github-actions[bot] commented 2 years ago

Hi @cburgard, @bellenot,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot: