Docker Community Forums

Share and learn in the Docker community.

Docker build fails with 'configure: error: C compiler cannot create executables'


(Lgiacomoni) #1

Hello,

I am trying to extend a Docker image with some python modules that I need.

I have been trying to modify the Dockerfile that came with the image, but during building I get:

/tmp/build/PKGBUILD: line 26: patch: command not found

If I include patch in the libraries to download, I get another error:

configure: error: in `/tmp/build/src/graph-tool-2.26':
configure: error: C compiler cannot create executables

I am running Docker on macOS High Sierra (10.13.4) and Docker Version 18.03.1-ce-mac65.

Here is the Dockerfile:

# VERSION           2
FROM base/archlinux:latest
MAINTAINER Tiago de Paula Peixoto <tiago@skewed.de>

RUN echo 'Server=https://archive.archlinux.org/repos/2017/11/23/$repo/os/$arch' > /etc/pacman.d/mirrorlist

RUN pacman-key --refresh-keys
RUN pacman -Syu --noconfirm
RUN pacman -S binutils make gcc patch fakeroot --noconfirm --needed
RUN pacman -S expac yajl git --noconfirm --needed
RUN pacman -S sudo grep file --noconfirm --needed

RUN pacman -S sudo boost python3 python3-scipy python3-numpy \
              cgal cairomm python-cairo sparsehash cairomm   \
	      autoconf-archive pkg-config --noconfirm --needed

ENV MAKEPKG_USER=mkpkg \
    MAKEPKG_GROUP=mkpkg \
    MAKEPKG_ROOT=/tmp/build

RUN groupadd "${MAKEPKG_USER}" \
    && useradd -g "${MAKEPKG_GROUP}" "${MAKEPKG_USER}"

RUN mkdir -p ${MAKEPKG_ROOT}; chown mkpkg:mkpkg ${MAKEPKG_ROOT}

WORKDIR ${MAKEPKG_ROOT}

USER ${MAKEPKG_USER}
RUN curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=python-graph-tool
RUN makepkg PKGBUILD --install --needed CXXFLAGS="-mtune=generic -O3 -pipe -flto=4 -ffunction-sections -fdata-sections" LDFLAGS="-Wl,--gc-sections"

USER root
RUN pacman -U python-graph-tool-*-x86_64.pkg.tar.xz --noconfirm --needed

WORKDIR /root

RUN rm -rf ${MAKEPKG_ROOT}/*

RUN pacman -S python-pip ipython gtk3 python-gobject python-matplotlib python-pandas jupyter-notebook mathjax python-cairocffi pandoc python-pymongo --noconfirm --needed

RUN useradd -m -g users user

What I am really interested in is a way to include python modules in the image so that I do not have to install them every time I start a new container. Any suggestion is very much appreciated.

Thanks a lot,
Luca


(Alexhha) #2

It’s because graph-tool trying to find libmpfr.so.4. At least in my case. I got the following error message in config.log

/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory

As a temporary workaround you can add the following line to the Dockerfile

RUN mkdir -p ${MAKEPKG_ROOT}; chown mkpkg:mkpkg ${MAKEPKG_ROOT} \
&& cd /usr/lib/ && ln -s libmpfr.so.6.0.1 libmpfr.so.4

Yoy can take a look on complete Dockerfile - https://gist.github.com/Alexhha/896e312b8999406e3f32b63bb2be2b47