使用`docker-php-ext-install bz2`失败(在php:7.0-fpm-alpine,使用alpine 3.4)

时间:2017-10-25 12:59:07

标签: php docker php-extension alpine

我尝试在php:7.0-fpm-alpine上安装bz2扩展名(基于alpine 3.4):

FROM php:7.0-fpm-alpine
RUN docker-php-ext-install bz2

但它失败了:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/33) Upgrading musl (1.1.14-r15 -> 1.1.14-r16)
(2/33) Installing m4 (1.4.17-r1)
(3/33) Installing perl (5.22.3-r0)
(4/33) Installing autoconf (2.69-r0)
(5/33) Installing pkgconf (0.9.12-r0)
(6/33) Installing pkgconfig (0.25-r1)
(7/33) Installing dpkg-dev (1.18.7-r0)
(8/33) Installing libbz2 (1.0.6-r5)
(9/33) Installing dpkg (1.18.7-r0)
(10/33) Installing libmagic (5.27-r0)
(11/33) Installing file (5.27-r0)
(12/33) Installing libgcc (5.3.0-r0)
(13/33) Installing libstdc++ (5.3.0-r0)
(14/33) Installing binutils-libs (2.26-r1)
(15/33) Installing binutils (2.26-r1)
(16/33) Installing gmp (6.1.0-r0)
(17/33) Installing isl (0.14.1-r0)
(18/33) Installing libgomp (5.3.0-r0)
(19/33) Installing libatomic (5.3.0-r0)
(20/33) Installing mpfr3 (3.1.2-r0)
(21/33) Installing mpc1 (1.0.3-r0)
(22/33) Installing gcc (5.3.0-r0)
(23/33) Installing musl-dev (1.1.14-r16)
(24/33) Installing libc-dev (0.7-r0)
(25/33) Installing g++ (5.3.0-r0)
(26/33) Installing make (4.1-r1)
(27/33) Installing libpcre16 (8.38-r1)
(28/33) Installing libpcre32 (8.38-r1)
(29/33) Installing libpcrecpp (8.38-r1)
(30/33) Installing pcre-dev (8.38-r1)
(31/33) Installing re2c (0.14.3-r0)
(32/33) Installing .phpize-deps (0)
(33/33) Upgrading musl-utils (1.1.14-r15 -> 1.1.14-r16)
Executing busybox-1.24.2-r13.trigger
OK: 223 MiB in 58 packages
+ cd bz2
+ phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
+ ./configure --build=x86_64-linux-musl
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
checking for cc... cc
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 cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/    usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.14.3 (ok)
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for BZip2 support... yes, shared
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

即使我尝试安装libbz2:apk add --update libbz2

知道如何安装此扩展程序吗?

2 个答案:

答案 0 :(得分:2)

安装bzip2-dev package可解决此问题。

例如:

apk add --update bzip2-dev

答案 1 :(得分:0)

  

@yosifkit
  在我看来,这是Alpine Linux中的包装错误。 libbz2包应该附带bzlib.h文件,就像Debian包那样:https://packages.debian.org/stretch/amd64/libbz2-dev/filelist

source