我的映像正在尝试基于centos7从源构建protobuf 3.9.1。更新并安装依赖项后,第一步是从protobuf存储库运行./configure
脚本。这将遍历并找到构建所需的一堆依赖项。
docker build
在RUN ./configure
上失败,原因为checking for g++... no
。通过在失败步骤之前直接在层中执行docker run
来手动运行脚本,./configure
可以找到g ++:checking for g++... g++
。
在docker build
与手动执行步骤之间,关于什么可能导致这种不同行为的任何建议?感谢您的阅读!
Docker文件:
FROM centos:7
ENV PROJECTDIR=/src
RUN mkdir -p $PROJECTDIR
WORKDIR $PROJECTDIR
RUN yum -y update && yum clean all
RUN yum install -y epel-release centos-release-scl
RUN yum install -y cmake3 devtoolset-7-gcc* devtoolset-7-gdb* llvm-toolset-7-llvm-devel llvm-toolset-7-clang-devel llvm-toolset-7-lldb make boost169-devel boost169-static openssh-server rsync git ccache autoconf automake libtool unzip tree
RUN echo 'root:root' | chpasswd
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "path = /opt/rh/devtoolset-7/root/usr/bin:/opt/rh/llvm-toolset-7/root/usr/bin" > /etc/ccache.conf
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/c++
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/g++
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/x86_64-redhat-linux-c++
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/x86_64-redhat-linux-g++
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/clang
RUN ln -sf ../../bin/ccache /usr/lib64/ccache/clang++
RUN /usr/sbin/sshd-keygen
# Protobuf C++ Install
RUN mkdir $PROJECTDIR/protobuf
ADD https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protobuf-cpp-3.9.1.tar.gz $PROJECTDIR/protobuf/protobuf-cpp-3.9.1.tar.gz
RUN tar -xf $PROJECTDIR/protobuf/protobuf-cpp-3.9.1.tar.gz -C $PROJECTDIR/protobuf/
WORKDIR $PROJECTDIR/protobuf/protobuf-3.9.1
RUN ./configure
make && \
make check && \
make install && \
ldconfig
RUN mkdir -p /root/.ssh
ENV PATH="$PROJECTDIR:${PATH}"
CMD bash
编辑:
我尝试了在没有cacche
和没有display: inline-block;
vertical-align: middle;
float: none;
的情况下进行docker构建
答案 0 :(得分:1)
您缺少GNU Compiler Collection,因此应将其安装为依赖项。
如果您尝试使用make进行构建,请确保已安装gcc-g ++ 包!没有它,您的构建将以您看到的方式失败。
在配置之前先安装gcc-c++
RUN yum install gcc-c++ -y
也请更正您的configure命令,使其缺少&& \
RUN yum install gcc-c++ -y
RUN ./configure && \
make && \
make check && \
make install && \
ldconfig