Docker 使用 Alpine Linux 构建软件,出现错误 'install: unrecognized option: strip-program=strip'
Docker Build SofteWare using Alphine Linux with Error 'install: unrecognized option: strip-program=strip'
我正在构建蚊子docker图像,在调用make install
时遇到这些错误消息'install: unrecognized option: 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
tar.gz /usr/bin/install
版本:BusyBox v1.27.2,以及您的 mosquitto tar.gz 使用 wget 下载需要 /usr/bin/install
来自 GNU coreutils 8.25 的版本,例如,其中包括您缺少的选项 strip-program
.
So, solution is simple: install a mosquitto version for alpine, not for generic Linux:
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 版本。
EDIT: If you need to install a plugin and compile a generic linux tar.gz, you have to install apk add coreutils
@mulg0r 给我的答案除外。我发现还有另一种方法可以解决这个问题。我认为这在有人遇到类似问题时也很有用。从 https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master 这个 link。来自 alpine Linux 的包裹。单击 Git repository
按钮,在该页面内,有此包的构建过程说明。一些代码更改以适应高山 Linux.
对于这个问题,从 https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master 中找到 APKBUILD 文件。这条线也解决了我的问题:
sed -i -e "s|(INSTALL) -s|(INSTALL)|g" \
-e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' \
*/Makefile */*/Makefile
以上只是在执行时注释掉--strip-program make install
我正在构建蚊子docker图像,在调用make install
时遇到这些错误消息'install: unrecognized option: 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
tar.gz /usr/bin/install
版本:BusyBox v1.27.2,以及您的 mosquitto tar.gz 使用 wget 下载需要 /usr/bin/install
来自 GNU coreutils 8.25 的版本,例如,其中包括您缺少的选项 strip-program
.
So, solution is simple: install a mosquitto version for alpine, not for generic Linux:
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 版本。
EDIT: If you need to install a plugin and compile a generic linux tar.gz, you have to install apk add coreutils
@mulg0r 给我的答案除外。我发现还有另一种方法可以解决这个问题。我认为这在有人遇到类似问题时也很有用。从 https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master 这个 link。来自 alpine Linux 的包裹。单击 Git repository
按钮,在该页面内,有此包的构建过程说明。一些代码更改以适应高山 Linux.
对于这个问题,从 https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master 中找到 APKBUILD 文件。这条线也解决了我的问题:
sed -i -e "s|(INSTALL) -s|(INSTALL)|g" \
-e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' \
*/Makefile */*/Makefile
以上只是在执行时注释掉--strip-program make install