Singularity source thisroot.sh sourcebuild

ROOT Version: master
Platform: f31
Compiler: f31 default


Hello all -

Has anyone had success sourcing a root built in singularity, not from binaries?
The build succeeds, and it can be used normally with singularity shell root.sif, but running the entrypoint, or exec commands fail to source thisroot.sh, citing failure on line 168:

    166 SOURCE=${BASH_ARGV[0]}
    167 if [ "x$SOURCE" = "x" ]; then
    168    SOURCE=${(%):-%N} # for zsh
    169 fi

You can view this failure yourself by executing singularity build root.sif root.def with this def:

Bootstrap: docker
From: fedora:31

%post
    # Install ROOT
    ROOT_DEPENDENCIES="gcc gcc-c++ git cmake3 python3 zlib-devel libX11-devel libXpm-devel libXft-devel libXext-devel openssl-devel freetype-devel libuuid-devel fuse-devel davix-devel libxml2-devel"
    yum install -y $ROOT_DEPENDENCIES
    yum -y clean all --enablerepo='*'
    git clone --depth 1 https://github.com/root-project/root /opt/root_src
    mkdir /opt/build /opt/root && cd /opt/build
    cmake3 /opt/root_src  -DCMAKE_INSTALL_PREFIX=/opt/root
    make -j $(nproc)
    make install
    # Clean leftovers
    rm -rf /opt/root_src /opt/build

%environment
    source /opt/root/bin/thisroot.sh

the resulting run fails like so:

$ singularity run root.sif
source: /opt/root/bin/thisroot.sh:168:13: parameter expansion requires a literal

Perhaps @jblomer has experience with ROOT and singularity?

It seems to be a problem zsh, is that the default shell? What I don’t understand is why with singularity shell everything works. Once you are in with singularity shell, what happens if you echo $SHELL? Does it work if you source thisroot.sh then?

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