简体   繁体   English

在Alpine Linux Docker容器中构建GNATCOLL

[英]Building GNATCOLL in an Alpine Linux Docker Container

I can't seem to get GNATCOLL to compile in an Alpine Linux based Docker Container. 我似乎无法在基于Alpine Linux的Docker Container中编译GNATCOLL。

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. 这很好用,让我得到一个容器,其中包含一个基于GNAT GPR的Ada开发环境。 The issue comes when I try to install GNATCOLL in this container. 当我尝试在此容器中安装GNATCOLL时出现问题。

Running docker run -i -t <built_image> the following occurs: 运行docker run -i -t <built_image>会发生以下情况:

/ # 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: 根据https://github.com/AdaCore/gnatcoll-core/issues/30中的讨论,我检查了我的gprbuild版本:

/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. 因此,看起来muspr的gprbuild已经过时了,导致无法构建GNATCOLL。 Is there any way to get a more up-to-date version of gprbuild for musl-c? 有没有办法为musl-c获得更新的gprbuild版本? If not is there any other way to get GNATCOLL installed? 如果没有,还有其他方法可以安装GNATCOLL吗?

The issue is that ./bootstrap.sh in gprbuild doesn't install everything, it just creates a bare minimum gprbuild installation. 问题是./bootstrap.sh中的./bootstrap.sh没有安装所有内容,只是创建了一个最小的gprbuild安装。 Additionally it does not build gprlib, which is necessary for gnatcoll and also has to be installed. 此外,它不构建gprlib,这是gnatcoll必需的,也必须安装。

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. 通过这些添加,我能够按照项目中的指定构建gnatcoll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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