使用 docker-compose 构建 Git 存储库时如何修复配置错误

How to fix configure error when building a Git repo using docker-compose

我正在尝试使用 docker-compose 从 Git 构建 OpenModelica。我已经下载了他们列出的所有依赖项 here。现在我将他们的构建指令用作 RUN 语句,并且在启动 /.configure 时出现错误。要执行的完整命令序列是

> autoconf
> ./configure CC=clang CXX=clang++
> make -j8
> build/bin/omc --version
> (cd testsuite/partest && ./runtests.pl)

我尝试从 ./configure 步骤中删除 clang 选项,但这并没有解决错误。

我的 Docker 文件和支持文件是:

Docker文件

FROM python:3.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY pips.txt /code/
COPY gets.txt /code/
RUN pip install -r pips.txt \
    && apt-get update \
    && xargs -a gets.txt apt-get -y install \
    && apt update \
    && apt install -y openscenegraph-3.4

COPY OpenModelica /code/OpenModelica
RUN cd /code/OpenModelica \
    && autoconf \
    && autoreconf -i
RUN cd /code/OpenModelica \
    && ./configure CC=clang-3.8 CXX=clang++-3.8
RUN make -j8 \
    && build/bin/omc --version \
    && (cd testsuite/partest && ./runtests.pl)

COPY . /code/

pips.txt

Django==2.2
psycopg2==2.8.2

gets.txt

...
clang-3.8
clang++-3.8
...

我在启动时收到这些错误消息 docker-compose build

ln: failed to create symbolic link '.git/hooks/pre-commit': File exists

我认为不是致命错误,然后代码继续执行几行,然后

configure: error: no

上下文中的完整错误消息是

Step 10/12 : RUN cd /code/OpenModelica  && ./configure CC=clang-3.8 CXX=clang++-3.8
 ---> Running in 9da205a757d3
checking for gcc... clang-3.8
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang-3.8 accepts -g... yes
checking for clang-3.8 option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether clang++-3.8 accepts -g... yes
checking how to run the C preprocessor... clang-3.8 -E
configure: OpenModelica pre-commit hook has been installed
ln: failed to create symbolic link '.git/hooks/pre-commit': File exists
configure: OpenModelica commit-msg hook has been installed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
build_short: x86_64-linux-gnu
host_short: x86_64-linux-gnu
checking if cppruntime is requested... no
checking for omlibrary target... core
checking for libraries directory... configure: error: no

我没能找到关于错误的任何有用信息,因为它太模糊了。我是 Docker 的新手,所以我不确定它是 Docker 的东西还是 OpenModelica 特有的东西。

错误

checking for libraries directory... configure: error: no

建议缺少子模块 OpenModelica/OMLibraries 中的文件夹库。

您是如何克隆 OpenModelica 存储库的?您需要使用所有子模块递归地克隆它。

# Faster pulling by using openmodelica.org read-only mirror (low latency in Europe; very important when updating all submodules)
# Replace the openmodelica.org pull URL with https://github.com/OpenModelica/OpenModelica.git if you want to pull directly from github
# The default choice is to push to your fork on github.com (SSH). Replace MY_FORK with OpenModelica to push directly to the OpenModelica repositories (if you have access)
>MY_FORK=MyGitHubUserName ; git clone https://openmodelica.org/git-readonly/OpenModelica.git --recursive && (cd OpenModelica && git remote set-url --push origin git@github.com:$MY_FORK/OpenModelica.git && git submodule foreach --recursive 'git remote set-url --push origin `git config --get remote.origin.url | sed s,^.*/,git@github.com:'$MY_FORK'/,`')

要查看用于在各种系统上构建和分发 OpenModelica 的 docker 文件,您可以查看 OpenModelica/OpenModelicaBuildScripts