Search code examples
pythonc++dockercompilationgraph-tool

Cannot compile graph-tool under RockyLinux8 Docker container


I am trying to build Graph Tool from source in a RockyLinux8 Docker container. I cannot seem to find an .rpm that fits the specific Python installation I require for other purposes. I am specifically downloading graph-tool-release-2.77 from the developer's repository. My Dockerfile looks like so:

FROM docker.io/nvidia/cuda:12.0.1-cudnn8-devel-rockylinux8 AS base

# Set root password and create a user within the container
RUN echo 'root:pass' | chpasswd
RUN useradd -m -s /bin/bash contuser && echo "contuser:pass" | chpasswd

# Install python3.8 and make venv
RUN dnf install --setopt=sslverify=false -y python38 python38-devel python38-pip
RUN python3.8 -m venv /venvs/py38 --system-site-packages
RUN . /venvs/py38/bin/activate && \
    pip install --upgrade pip wheel setuptools && \
    pip install numpy scipy matplotlib 

# Enable EPEL (CGAL-devel) and PowerTools (boost-python3-devel) packages.
RUN dnf install --setopt=sslverify=false -y epel-release dnf-plugins-core
RUN dnf config-manager --set-enabled powertools

# Copy required packages and graphtool source
COPY support_files/graph-tool-2.77/ /tmp/graph-tool-2.77/

# Download the packages needed for graph-tool build into
RUN dnf install --setopt=sslverify=false -y ncurses libtool automake
RUN dnf install --setopt=sslverify=false -y \
    python3-devel boost-python3 boost-python3-devel boost-devel expat-devel CGAL-devel

# Build graph-tool from source
RUN . /venvs/py38/bin/activate && \
    cd /tmp/graph-tool/ && \
    ./configure PYTHON=/venvs/py38/bin/python3.8 \
    --prefix=/venvs/py38 \
    --with-python-module-path=/venvs/py38/lib/python3.8/site-packages \
    --disable-cairo --disable-sparsehash && \
    make -j 16 && make install

# Entrypoint
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

After the make -j 16 begins I start to see some errors in the format:

 ../template/base_vec.cc
 ^
src/graph/inference/uncertain/dynamics/lotka_volterra/base_vec.cc:1:1: error: expected unqualified-id before ‘.’ token
 ../template/base_vec.cc
 ^
src/graph/inference/uncertain/dynamics/pseudo_cising/base_vec.cc:1:1: error: expected unqualified-id before ‘.’ token
 ../template/base_vec.cc
 ^

The compilation process continues, but when make install is ran I receive a similar error message and the library is not installed in the venv site-packages.

Here are the versions of what I assume are the relevant packages used during the build process:

$ gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22)
$ aclocal --version
aclocal (GNU automake) 1.16.1
$ autoconf --version
autoconf (GNU Autoconf) 2.69
$ make --version
GNU Make 4.2.1

Seemingly unrelated, but another issue I found is that the file /graph-tool-2.77/src/graph/inference/blockmodel/graph_blockmodel_emat.hh seemingly has an error on approximately line 125. make says that min_load_factor is no defined. It just seems odd to me that the source I downloaded, that seemingly passes all of the developer's tests, and has some rpms for, has a compilation error like this. I don't see how it's related to my issue, but just odd. For posterity, I simply comment that line (_h.min_load_factor(.25);) of the file and compilation "works", albeit with the issues above.


Solution

  • src/graph/inference/uncertain/dynamics/lotka_volterra/base_vec.cc
    src/graph/inference/uncertain/dynamics/pseudo_cising/base_vec.cc
    

    These paths are symbolic links in their GIT repository.

    1. You have downloaded and used the zip file graph-tool-release-2.77.zip that is not a file archive and Docker's unzip unlikely supports symbolic links. You should download and use another file with a tar file archive, that natively supports symbolic links, for example graph-tool-release-2.77.tar.bz2.
    2. Another option, COPY support_files/graph-tool-2.77/ /tmp/graph-tool-2.77/ - you likely extracted the archive into support_files/graph-tool-2.77 on Windows and lost symbolic links. You should extract the archive in Docker.