Root broken after removing build directory

Dear experts,

I tried to build the root from scratch in a docker container. I build everything from the source and root prompt seems ok after installing it. However, root is broken after I deleted build directory. It shows me errors like

input_line_1:1:2: fatal error: module file '/home/username/packages/cern-root/build-v6-30-04/lib/libc.pcm' not found: module file not found
#include <new>
 ^
input_line_1:1:2: note: imported by module 'std' in '/opt/root-v6.30.04/lib/std.pcm'
Warning in cling::IncrementalParser::CheckABICompatibility():
  Failed to extract C++ standard library version.
Replaced symbol atexit cannot be found in JIT!
Replaced symbol at_quick_exit cannot be found in JIT!
Module libc not found.
Failed to load module std
<<< cling interactive line includer >>>: fatal error: module file '/home/username/packages/cern-root/build-v6-30-04/lib/libc.pcm' not found: module file not found
<<< cling interactive line includer >>>: note: imported by module '_Builtin_intrinsics' in '/opt/root-v6.30.04/lib/_Builtin_intrinsics.pcm'
Failed to load module _Builtin_intrinsics
Failed to load module ROOT_Foundation_C
Failed to load module ROOT_Rtypes
Failed to load module ROOT_Foundation_Stage1_NoRTTI
Failed to load module Core
...

I have truncated more error messages.

To reproduce the problem, one can follow the dockerfile as attached.

 FROM debian:latest
 COPY bash_install_root.sh /
 RUN apt-get update && apt-get upgrade && apt-get install -y git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python3 libssl-dev  gfortran libpcre3-dev xlibmesa-glu-dev libglew-dev libftgl-dev libmariadb-dev libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev  python3-dev python3-numpy libxml2-dev libkrb5-dev libgsl0-dev qtwebengine5-dev nlohmann-json3-dev liblzma-dev libtbb-dev libvdt-dev  libopenblas-dev libsm-dev  libice-dev python3-pygments python3-yaml davix-dev libafterimage-dev libcfitsio-dev && bash bash_install_root.sh
 CMD ["/bin/bash", "-i"]

and a script called bash_install_root.sh,

#!/bin/bash
BaseDir="/home/username/packages/cern-root"
GitVerTag="v6-30-04"
VerTag="v6.30.04"
SourceDir="${BaseDir}/root"
BuildDir="${BaseDir}/build-${GitVerTag}"
InstallDir="/opt/root-${VerTag}"

echo "Installing root..."
echo "Cloning root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
# bad practice to use -p
mkdir -p $InstallDir
mkdir -p $BaseDir && cd $BaseDir
git clone https://github.com/root-project/root.git ${SourceDir}
cd $SourceDir
git checkout -b $GitVerTag $GitVerTag
echo "Configuring root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
mkdir -p ${BuildDir} && cd ${BuildDir}
cmake ${SourceDir} -DCMAKE_INSTALL_PREFIX=$InstallDir > ../cmake_config_${VerTag}.log 2>&1
echo "Building root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
cmake --build . --target install > ../cmake_build_${VerTag}.log 2>&1
echo "Testing >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
${InstallDir}/bin/root -b -q
echo "Done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

I wonder if I made anything wrong in the cmake configuration. Suggestions are welcome! I would like to decouple the build directory from the installation.

Thanks!


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.30.04
Platform: Debian latest
Compiler: gcc-12.2.0


Hi Yousen,

I am sorry to see you experienced this issue.
I add in the loop @mczurylo , who might be able to help here.

Best,
D

Hi @Y.S.Zhang,

I will take a deeper look into your issue, but first of all I would like to ask if you considered using the already built docker images for 6.30.04: Docker ?

Cheers,
Marta

Hi @mczurylo

Thanks for your kind help!

I do not want to use docker because I need simple gui.

The reason why I would like to build docker on debian is because I am working on debian and I want to package the binary from docker to my debian desktop.

I tried to build root directly on debian. However, I am not sure why I always encounter the issue

Module libc not found.

I built v6.28.06 last year and there was no such warning. I tried to upgrade to secured release and now I face this problem. The warning message event shows up for v6.28.06 now which is weird. I guess it is related to changes in my debian environment. I do not have an idea how to reproduce this separate issue. Similar issues were also asked in the fora but never answered. See Module libc not found

When I build on fresh debian docker, there is no issue about libc not found. However, I have issue to isolate install from build.

Hi @Y.S.Zhang,

Thank you for giving me some more details. So what I did now, was to use your script to simply build root on my macbook (could be possible there are still some differences). At first I could reproduce the issue and there was nothing in my install directory but then I realised the main issue with your script here is that you are trying to install root in /opt/ directory that normally requires the sudo rights. Additionally, another thing, which you may need is another cmake option: -Dbuiltin_glew=ON (and this should have been indicated by the error message while trying to run this script). So eventually, I have:

echo "Installing root..."
echo "Cloning root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
# bad practice to use -p
sudo mkdir -p $InstallDir
mkdir -p $BaseDir && cd $BaseDir
git clone https://github.com/root-project/root.git ${SourceDir}
cd $SourceDir
git checkout -b $GitVerTag $GitVerTag
echo "Configuring root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
mkdir -p ${BuildDir} && cd ${BuildDir}
cmake ${SourceDir} -DCMAKE_INSTALL_PREFIX=$InstallDir -Dbuiltin_glew=ON > ../cmake_config_${VerTag}.log 2>&1
echo "Building root >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo cmake --build . -- install > ../cmake_build_${VerTag}.log 2>&1
echo "Testing >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
${InstallDir}/bin/root -b -q
echo "Done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

Let me know if this solves your issue or if we need to dig deeper.

Cheers,
Marta

Hi Marta,

Thanks for your help! I have two questions.

  • What is the use for option built_glew?
  • I am afraid I am not clear why /opt needs root permission in a docker/podman environment. I have executables of root under /opt in docker/podman environment in my test on debian desktop.

In the docker environment, I can execute root unless I delete or rename the build directory. I am confused why root cannot recognize the install directory as path for library loading.

Cheers,

Yousen

Hi @Y.S.Zhang,

but does executing the script itself work for you? Have you tried running it before building the docker image itself? It didn’t work for me in a sense that nothing was installed in the install directory because I could not access it. What happens if you change the install directory to somewhere else, for example, the same directory where you have your source and build directories?

Regarding Glew - it is CMake related, when I run the script I see:

CMake Error at cmake/modules/SearchInstalledSoftware.cmake:615 (message):
 Please enable builtin Glew due bug in latest CMake (use cmake option
 -Dbuiltin_glew=ON).
Call Stack (most recent call first):
 CMakeLists.txt:300 (include)

but it might be the case that you don’t see this issue, then you don’t need this option.

Cheers,
Marta

Dear Marta,

I have a full installation under /opt/root-v6.30.04. And I can have working functions under /opt/root-v6.30/. I tried a hello world example and it works perfectly. It is surprising that we have different permission to access the target directory using docker environment.

The system wide installation should be done no matter where the build directory is. I suppose root will search rpath for loading libraries. I tried to look through run path of root.

chrpath -l /opt/root-v6.30.04/bin/root
# RUNPATH=${ORIGIN}:${ORIGIN}/../lib

I am not sure where root searches for $ORIGIN.

I would expect it to be the installation directory. However, it seems not. The option -Drpath=ON is default on for root. I wonder what is the effects of this option.

I am also curious the effects of option gnuinstall which is default off, as indicated in the instruction for build.

Thanks!

Yousen

Hi @Y.S.Zhang,

I’m sorry for the delayed response - maybe you’ve found a solution to your problem in the meantime, but let me post here what worked for me just in case. What I followed directly is the Dockerfile for ubuntu that we use to build images and what I now used for your case is:

FROM debian:latest

ENV LANG=C.UTF-8

WORKDIR /opt

COPY bash_install_root.sh bash_install_root.sh

RUN apt-get update -qq \
 && apt-get -y install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python3 libssl-dev  gfortran libpcre3-dev xlibmesa-glu-dev libglew-dev libftgl-dev libmariadb-dev libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev  python3-dev python3-numpy libxml2-dev libkrb5-dev libgsl0-dev qtwebengine5-dev nlohmann-json3-dev liblzma-dev libtbb-dev libvdt-dev  libopenblas-dev libsm-dev  libice-dev python3-pygments python3-yaml davix-dev libafterimage-dev libcfitsio-dev\
 && bash bash_install_root.sh \
 && echo /opt/root/lib >> /etc/ld.so.conf \
 && ldconfig \
 && echo /opt/root/lib >> /etc/ld.so.conf \
 && ldconfig

ENV ROOTSYS /opt/root
ENV PATH $ROOTSYS/bin:$PATH
ENV PYTHONPATH $ROOTSYS/lib:$PYTHONPATH
ENV CLING_STANDARD_PCH none

CMD ["/bin/bash", "-i"]

This allows me to build a working version of root without changing your bash script. In order to build root inside the image I run your bash script and sourced the /bin/thisroot.sh.

Cheers,
Marta

Hi @Y.S.Zhang,

one more thing - now ROOT 6.30.06 is out so you can also try installing this one instead of 6.30.04.

Cheers,
Marta

Hi @mczurylo thank you so much! The solution is very helpful!