简体   繁体   中英

Building GNATCOLL in an Alpine Linux Docker Container

I can't seem to get GNATCOLL to compile in an Alpine Linux based Docker Container.

My container so far is:

FROM alpine:edge

# Add extra repositories
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories; \
    echo 'http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories; \
    echo 'http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories;

RUN apk add --no-cache build-base coreutils curl-dev gcc-gnat git gmp-dev openssl

# Bootstrap GPRBuild
RUN git clone https://github.com/AdaCore/xmlada.git; \
    git clone https://github.com/AdaCore/gprbuild.git; \
    cd gprbuild; ./bootstrap.sh --with-xmlada=../xmlada; \
    cd ..; \
    rm -rf xmlada gprbuild

This works fine and gets me a container with a working GNAT GPR based Ada development environment. The issue comes when I try to install GNATCOLL in this container.

Running docker run -i -t <built_image> the following occurs:

/ # git clone https://github.com/AdaCore/gnatcoll-core.git
<Typical git clone output>
/ # cd gnatcoll-core/
/gnatcoll-core # make setup
/gnatcoll-core # make
gprbuild -p -m --target=x86_64-linux  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD  -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
        -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD gnatcoll.gpr
Setup
   [mkdir]        object directory for project GnatColl
   [mkdir]        library directory for project GnatColl
gnatcoll.gpr:24:06: unknown project file: "gpr"
make: *** [Makefile:128: build-static] Error 4

Based on the discussion in https://github.com/AdaCore/gnatcoll-core/issues/30 I checked my gprbuild version:

/gnatcoll-core # gprbuild --version
GPRBUILD Pro 18.0w (19940713) (x86_64-alpine-linux-musl)
Copyright (C) 2004-2016, AdaCore
This is free software; see the source for copying conditions.
See your AdaCore support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

So it would seem that gprbuild for musl is woefully out of date, leading to an inability to build GNATCOLL. Is there any way to get a more up-to-date version of gprbuild for musl-c? If not is there any other way to get GNATCOLL installed?

The issue is that ./bootstrap.sh in gprbuild doesn't install everything, it just creates a bare minimum gprbuild installation. Additionally it does not build gprlib, which is necessary for gnatcoll and also has to be installed.

The required steps are:

# As before...
git clone https://github.com/AdaCore/xmlada.git
git clone https://github.com/AdaCore/gprbuild.git
cd gprbuild; ./bootstrap.sh --with-xmlada=../xmlada

# New: build and install xmlada
cd ../xmlada; ./configure && make && make install

# New: build and install gprbuild fully
cd ../gprbuild
export GPR_PROJECT_PATH=/usr/local/share/gpr
make prefix=/usr/local setup && make all && make install

# New: build and install gprlib
make libgpr.build && make libgpr.install

With these additions I was able to build gnatcoll as specified in its project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM