我正在构建一个蚊子docker镜像,当调用make install时遇到以下错误消息“安装:无法识别的选项:strip-program = strip”,请帮助,谢谢。

install -d /usr/local/lib/
install -s --strip-program=strip libmosquitto.so.1
/usr/local/lib/libmosquitto.so.1
install: unrecognized option: strip-program=strip
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.

Usage: install [-cdDsp] [-o USER] [-g GRP] [-m MODE] [-t DIR] [SOURCE]... DEST

Copy files and set attributes

    -c  Just copy (default)
    -d  Create directories
    -D  Create leading target directories
    -s  Strip symbol table
    -p  Preserve date
    -o USER Set ownership
    -g GRP  Set group ownership
    -m MODE Set permissions
    -t DIR  Install to DIR
make[1]: *** [Makefile:28: install] Error 1
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/lib'
make: *** [Makefile:38: install] Error 2

我的Dockfile的一部分:
FROM alpine:3.7
RUN apk add --update --no-cache build-base openssl openssl-dev c-ares-dev util-linux-dev libwebsockets-dev libxslt && \
    cd /usr/local && \
    mkdir src && \
    cd src && \
    wget https://mosquitto.org/files/source/mosquitto-1.4.15.tar.gz && \
    tar -zxvf mosquitto-1.4.15.tar.gz && \
    cd mosquitto-1.4.15 && \
    make && make install

在最后几条结果行中调用make:
cc -Wall -ggdb -O2  -c mosquitto_passwd.c -o mosquitto_passwd.o
cc mosquitto_passwd.o -o mosquitto_passwd  -lcrypto
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/src'
set -e; for d in man; do make -C ${d}; done
make[1]: Entering directory '/usr/local/src/mosquitto-1.4.15/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/man'

最佳答案

问题是,您正在安装带有mosquitto 版本的/usr/bin/install tar.gz:BusyBox v1.27.2 ,并且使用wget下载的mosquitto的tar.gz需要GNU coreutils 8.25 的/usr/bin/install 版本,其中包括缺少的选项strip-program


FROM alpine:3.7
RUN apk add --update --no-cache build-base openssl openssl-dev c-ares-dev util-linux-dev libwebsockets-dev libxslt && \
    apk add mosquitto

它将安装版本1.4.15。

关于docker - 使用Alpine Linux的Docker Build Software出现错误 'install: unrecognized option: strip-program=strip',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51185048/

10-13 09:15