Thisroot.sh and system ROOT installation

Issue

Hello,
I have ROOT installed via dnf install root and also have built debug version from source.
I wanted to test build (glad I’ve done this before adding lines to .bashrc) and got this:

$ source /opt/root-6.34.04-debug/bin/thisroot.sh 
bash: sed: command not found...
Install package 'sed' to provide command 'sed'? [N/y] 

After some investigation I’ve realized that thisroot.sh drops /usr/bin from PATH.

$ printenv ROOTSYS
/usr

Is it possible to fix this behavior on the ROOT side?
May be there are recommendations on this case? Although what I did seems to be a recommended approach.

To reproduce

dnf upgrade --assumeyes
dnf --assumeyes install 'dnf-command(config-manager)'
dnf --assumeyes reinstall tzdata

# development tools
dnf install --assumeyes gcc gcc-c++ gcc-gfortran binutils make cmake patch git \
    python3 python3-devel python3-numpy python3-pip

# at least for giflib-devel
dnf config-manager --set-enabled crb

# at least for nlohmann_json
dnf install --assumeyes epel-release

dnf install --assumeyes bzip2-devel hdf5-devel json-devel protobuf-compiler \
    protobuf-devel libxml2-devel lz4-devel xz-devel zlib-devel libzstd-devel \
    libAfterImage-devel freetype-devel \
    giflib-devel libjpeg-turbo-devel libpng-devel libtiff-devel \
    libX11-devel libXpm-devel libXft-devel libXext-devel \
    ftgl-devel gl2ps-devel glew-devel \
    mesa-libGL-devel mesa-libGLU-devel \
    cfitsio-devel davix-devel gsl-devel \
    openssl-devel pcre-devel readline-devel tbb-devel \
    libuuid-devel xrootd-server-devel xxhash-devel \
    mysql-devel libpq-devel sqlite-devel \
    fftw-devel unuran-devel

# this may be quite long
dns install --assumeyes root-*

dnf install --assumeyes wget tar

cd /opt

# this may be quite long
wget -q https://github.com/root-project/root/archive/refs/tags/v6-34-04.tar.gz
tar xzf v6-34-04.tar.gz

mkdir root-6-34-04-build
mkdir root-6-34-04-debug

cmake -S root-6-34-04/ -B root-6-34-04-build/ \
    -DCMAKE_INSTALL_PREFIX=root-6-34-04-debug \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_CXX_STANDARD=17 \
    -DCMAKE_CXX_STANDARD_REQUIRED=ON \
    -DCMAKE_CXX_EXTENSIONS=OFF \
    -Dasimage=ON -Dbuiltin_vdt=ON -Dfftw3=ON -Dfortran=ON -Dmathmore=ON \
    -Dmlp=ON -Dtmva=ON -Dsoversion=ON \
    -Dunuran=ON -Dx11=ON -Dxrootd=ON -Dfail-on-missing=ON

# this is very long
cmake --build root-6-34-04-build --parallel $(nproc) --target install

source root-6-34-04-debug/bin/thisroot.sh

which root

root --version

Setup

ROOT Version: 6.34.02
Platform: AlmaLinux 9.5 (Teal Serval) x86-64
Compiler: gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)


Sorry for my inattention, turns out I’ve found a way to shoot myself in the foot.
In my .bash_profile

export ROOTSYS="/usr"

After removing this line everything works fine.

Update: I had a tangential issue which is less relevant to ROOT forum, but I’ll leave it as an edit.
Carefully check your IDE settings!
After fixing command line issue I was struggling with Qt Creator which didn’t pick right ROOT version.
Then I figured out that it runs CMake with-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}, where CMAKE_PREFIX_PATH is used to locate ROOT in this context.
Of course it turned out that QT_INSTALL_PREFIX=/usr.

Update2: CMake uses complicated procedure to traverse paths in search of packages.
Qt Creator passes CMake variable CMAKE_PREFIX_PATH as a command line argument and it takes priority in my case (and also it is saved to CMakeCache.txt because it was passed as an argument, complicating things further).
thisroot.sh sets environment variable with the same name CMAKE_PREFIX_PATH, which has lower priority but still precedes system paths.
To sum up, I had to disable undesired Qt Creator behavior and make a build from scratch.

Hi,

thanks for the posts and for sharing the solution!

Cheers,
D

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.