ROOT v6.24.00 build failure in centos:7 Docker image on 'auto' return without trailing return type


ROOT Version: 6.24/00
Platform: CentOS Linux 7 Docker image
Compiler: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Python Version: CPython 3.8.10


Hi. I’m trying to build a Docker image that has ROOT installed in a CentOS 7 based environment. For reasons I’ll skip here, I need a containerized modern version of ROOT on a HPC cluster that has strict upper limits on the version of glibc that is can support. I would normally just build from the centos:8 image series, but the glibc requirements are motivating me to build on centos:7 (I also need CPython v3.7+ which I built from source to shoehorn it onto CentOS 7 hence the different base image).

To make reporting as easy as possible I’ve created a public GitLab repo here Matthew Carl Feickert / root-centos7-debug which contains all of the following files and CI to demonstrate a minimal failing example.

If I follow the CentOS dependency installation guide on the ROOT website (here in packages.txt just throwing in even things not needed for this build to make sure that for a minimal failing example I’m not missing anything) and attempt to build ROOT v6.24.00 from source with CXX14 (given that CentOS 7 seems capped below CXX17) I get the following build failure

[ 76%] Generating G__ROOTVecOps.cxx, ../../lib/ROOTVecOps.pcm
In file included from input_line_10:3:
In file included from /code/build/include/ROOT/RCanvas.hxx:12:
In file included from /code/build/include/ROOT/RPadBase.hxx:12:
In file included from /code/build/include/ROOT/RDrawable.hxx:16:
/code/build/include/ROOT/RAttrMap.hxx:193:4: error: 'auto' return without trailing return type; deduced return types are a C++14 extension
   auto begin() const { return m.begin(); }
   ^
/code/build/include/ROOT/RAttrMap.hxx:194:4: error: 'auto' return without trailing return type; deduced return types are a C++14 extension
   auto end() const { return m.end(); }
   ^
...

Can people advise how to attempt to resolve this?


All files used are linked above, but I’ll also reproduce the Dockerfile and additional files below

# packages.txt
git
gcc
gcc-c++
make
binutils
libX11-devel
libXpm-devel
libXft-devel
libXext-devel
openssl-devel
gcc-gfortran
readline-devel
cmake3
redhat-lsb-core
gcc-gfortran
pcre-devel
mesa-libGL-devel
mesa-libGLU-devel
glew-devel
ftgl-devel
fftw-devel
cfitsio-devel
libuuid-devel
avahi-compat-libdns_sd-devel
openldap-devel
libxml2-devel
gsl-devel
# requirements.txt
numpy~=1.20
Pygments~=2.9
PyYAML~=5.4
# Dockerfile
ARG BUILDER_IMAGE=neubauergroup/centos-python3:3.8.10
FROM ${BUILDER_IMAGE} as builder

USER root
WORKDIR /

SHELL [ "/bin/bash", "-c" ]

ARG TARGET_BRANCH=v6-24-00
ARG GIT_PROJECT_URL=https://github.com/root-project/root

# c.f. https://root.cern/install/build_from_source/#all-build-options
# gcc v4.8.5 is too old to use CXX17, so use CXX14
# Need epel-release to be installed first so that cmake3 is available
COPY packages.txt /tmp/packages.txt
COPY requirements.txt /tmp/requirements.txt
RUN yum update -y && \
    yum install -y epel-release && \
    yum install -y $(cat /tmp/packages.txt) && \
    yum clean all && \
    yum autoremove -y && \
    ln --symbolic $(command -v cmake3) /usr/bin/cmake && \
    python -m pip --no-cache-dir install --upgrade pip setuptools wheel && \
    python -m pip --no-cache-dir install --requirement /tmp/requirements.txt && \
    python -m pip list && \
    mkdir /code && \
    cd /code && \
    git clone --depth 1 "${GIT_PROJECT_URL}" \
      --branch "${TARGET_BRANCH}" \
      --single-branch \
      root_src && \
    cmake \
        -Dall=OFF \
        -Dsoversion=ON \
        -Dgsl_shared=ON \
        -DCMAKE_CXX_STANDARD=14 \
        -Droot7=ON \
        -Dfortran=ON \
        -Droofit=ON \
        -Droostats=ON \
        -Dhistfactory=ON \
        -Dminuit2=ON \
        -Dbuiltin_xrootd=ON \
        -Dxrootd=ON \
        -Dpyroot=ON \
        -DPYTHON_EXECUTABLE=$(command -v python3) \
        -DCMAKE_INSTALL_PREFIX=/usr/local/root-cern \
        -S root_src \
        -B build && \
    cmake build -L && \
    cmake --build build -- -j$(($(nproc) - 1)) && \
    cmake --build build --target install && \
    cd / && \
    rm -rf /code

ENV PYTHONPATH=/usr/local/root-cern/lib:$PYTHONPATH
ENV LD_LIBRARY_PATH=/usr/local/root-cern/lib:$LD_LIBRARY_PATH
ENV ROOTSYS=/usr/local/root-cern
ENV PATH="${PATH}:${ROOTSYS}/bin"

WORKDIR /home/data
ENV HOME /home

ENTRYPOINT ["/bin/bash", "-l", "-c"]
CMD ["/bin/bash"]

Hi @feickert ,
RAttrMap is part of the root7 interfaces, which require c++14, but it looks like they are being compiled without the --std=c++14 flag. That is really weird because if c++14 is off root7 should not even be built, and as you configure cmake with -Droot7=ON that should in turn set the C++ standard to at least C++14. It could be that setting -DCMAKE_CXX_STANDARD=14 at configuration time helps.

@oshadura any idea where the mismatch might come from?

Cheers,
Enrico

1 Like

Heya @feickert :smiley: ,

Can you try to build ROOT with VERBOSE=1 to see if during ROOTVecOps dictionary & PCM generation rootcling picks correct flag? Thanks!

These are the flags as per the cmake configuration:

Compiler        GNU 4.8.5
Compiler flags:
C                -pipe -Wall -W -pthread -O3 -DNDEBUG
C++              -std=c++1y -pipe  -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -DNDEBUG
Linker flags:
Executable       -rdynamic
Module
Shared           -Wl,--no-undefined -Wl,--hash-style="both"

-- Enabled support for:  asimage builtin_afterimage builtin_clang builtin_cling builtin_gl2ps builtin_llvm builtin_lz4 builtin_nlohmannjson builtin_openui5 builtin_tbb builtin_vdt builtin_xrootd builtin_xxhash builtin_zstd clad dataframe exceptions fftw3 fitsio fortran gdml gsl_shared http imt mathmore mlp minuit2 opengl pyroot roofit webgui root7 runtime_cxxmodules shared soversion sqlite ssl tmva tmva-cpu tmva-pymva spectrum vdt x11 xml xrootd

…and the invocation to rootcling is just:

cd /code/build/io/xml && /usr/bin/cmake3 -E env LD_LIBRARY_PATH=/code/build/lib: ROOTIGNOREPREFIX=1 /code/build/bin/rootcling -rootbuild -v2 -f G__XMLIO.cxx -cxxmodule -s /code/build/lib/libXMLIO.so -m RIO.pcm -excludePath /code/root_src -excludePath /code/build/ginclude -excludePath /code/build/externals -excludePath /code/build/builtins -I/code/build/include -I/code/root_src/io/xml/inc -I/code/root_src/core/unix/inc -I/code/root_src/core/foundation/v7/inc -I/code/root_src/core/base/v7/inc -I/code/root_src/core/clingutils/inc -I/code/root_src/core/textinput/inc -I/code/root_src/core/thread/inc -I/code/root_src/core/zip/inc -I/code/root_src/core/rint/inc -I/code/root_src/core/clib/inc -I/code/root_src/core/meta/inc -I/code/root_src/core/gui/inc -I/code/root_src/core/cont/inc -I/code/root_src/core/foundation/inc -I/code/root_src/core/base/inc -I/code/build/ginclude -I/code/root_src/io/io/v7/inc -I/code/root_src/io/io/inc -I/code/root_src/core/clib/res -I/code/root_src/builtins TBufferXML.h TKeyXML.h TXMLEngine.h TXMLFile.h TXMLPlayer.h TXMLSetup.h /code/root_src/io/xml/inc/LinkDef.h

with no compilation flags passed explicitly

Please don’t use GCC 4.8 for building C++14 code. Either configure to use c++11, or use a more modern GCC. Would that be an option?

1 Like

Either configure to use c++11, or use a more modern GCC. Would that be an option?

Ah. That’s an excellent point @Axel that I totally missed. I had blindly been setting CXX14 given that root7 features require it

but I don’t need root7 for this, so let me try to rebuild with

        -DCMAKE_CXX_STANDARD=11 \
        -Droot7=OFF \

Thanks very much @Axel — this indeed fixes things

--- a/Dockerfile
+++ b/Dockerfile
@@ -33,8 +33,8 @@ RUN yum update -y && \
         -Dall=OFF \
         -Dsoversion=ON \
         -Dgsl_shared=ON \
-        -DCMAKE_CXX_STANDARD=14 \
-        -Droot7=ON \
+        -DCMAKE_CXX_STANDARD=11 \
+        -Droot7=OFF \
         -Dfortran=ON \
         -Droofit=ON \
         -Droostats=ON \

Thanks very much @eguiraud and @oshadura for your time and help as well!

1 Like

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