Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何跟踪pecl zip安装操作(使用旧版PHP)中编译错误的原因?_Php_C_Centos_Php Extension - Fatal编程技术网

如何跟踪pecl zip安装操作(使用旧版PHP)中编译错误的原因?

如何跟踪pecl zip安装操作(使用旧版PHP)中编译错误的原因?,php,c,centos,php-extension,Php,C,Centos,Php Extension,我不可避免地需要开发基于PHP5.4的系统。我知道这完全是出于安全更新,但这是我现在所拥有的。我希望为开发目的创建一个PHP5.4Docker映像。从历史上看,我的团队和我一直在使用基于Centos的PHP5.6映像,因为没有可用的5.4 Centos映像 因此,我试图编译PHP5.4。经过大量的尝试和错误,我已经能够用最小的编译扩展来编译PHP,然后在上面使用一堆可动态加载的扩展。这意味着我的各个下游项目可以通过添加正确的php.ini扩展命令来选择它们需要的扩展 这是我的Dockerfile

我不可避免地需要开发基于PHP5.4的系统。我知道这完全是出于安全更新,但这是我现在所拥有的。我希望为开发目的创建一个PHP5.4Docker映像。从历史上看,我的团队和我一直在使用基于Centos的PHP5.6映像,因为没有可用的5.4 Centos映像

因此,我试图编译PHP5.4。经过大量的尝试和错误,我已经能够用最小的编译扩展来编译PHP,然后在上面使用一堆可动态加载的扩展。这意味着我的各个下游项目可以通过添加正确的php.ini扩展命令来选择它们需要的扩展

这是我的Dockerfile:

除了最后一块,这是拉链延伸部分的pecl安装,这是完全有效的。以下是Docker步骤的控制台输出:

Step 52/70 : RUN pecl install zip-1.11.0
 ---> Running in 06d2ef53ba56
downloading zip-1.11.0.tgz ...
Starting to download zip-1.11.0.tgz (263,909 bytes)
......................................................done: 263,909 bytes
93 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
building in /tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0
running: /tmp/pear/temp/zip/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
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-20100525
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... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for zip archive read/writesupport... yes, shared
checking for the location of libz... no
checking pcre install prefix... no
checking for the location of zlib... /usr
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for ssize_t... yes
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of off_t... 8
checking size of size_t... 8
checking for touch... /usr/bin/touch
checking for unzip... no
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
/tmp/pear/temp/zip/configure: line 6197: /usr/bin/file: No such file or directory
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0/libtool --mode=compile cc  -I. -I/tmp/pear/temp/zip -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0/include -I/tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0/main -I/tmp/pear/temp/zip -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  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/zip/php_zip.c -o php_zip.lo
mkdir .libs
 cc -I. -I/tmp/pear/temp/zip -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0/include -I/tmp/pear/temp/pear-build-defaultuserhYPzzK/zip-1.11.0/main -I/tmp/pear/temp/zip -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 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/zip/php_zip.c  -fPIC -DPIC -o .libs/php_zip.o
/tmp/pear/temp/zip/php_zip.c: In function 'php_zip_get_property_ptr_ptr':
/tmp/pear/temp/zip/php_zip.c:882:3: warning: passing argument 3 of 'std_hnd->get_property_ptr_ptr' makes pointer from integer without a cast [enabled by default]
   retval = std_hnd->get_property_ptr_ptr(object, member, type, key TSRMLS_CC);
   ^
/tmp/pear/temp/zip/php_zip.c:882:3: note: expected 'const struct _zend_literal *' but argument is of type 'int'
/tmp/pear/temp/zip/php_zip.c:882:3: error: too many arguments to function 'std_hnd->get_property_ptr_ptr'
/tmp/pear/temp/zip/php_zip.c: In function 'zm_startup_zip':
/tmp/pear/temp/zip/php_zip.c:2759:43: warning: assignment from incompatible pointer type [enabled by default]
  zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr;
                                           ^
make: *** [php_zip.lo] Error 1
ERROR: `make' failed
这是一个意外的编译错误-太多的参数感觉像是库不匹配或其他什么,但我特别选择了1.11,它是生产服务器上的扩展版本。可能是我的libzip-devel版本太新了吗?如果是的话,我可以获得一个更早的版本,并让它在Centos的维护版本中工作吗

我没有在任何其他扩展上遇到过这个问题,所以可能是运气不好,我在最后一个扩展上遇到了一个骗子问题

使现代化 我正在使用的Centos版本中的libzip-devel的本机版本是0.10.1,它与生产服务器通过php-I报告的libzip版本相匹配。以下是Docker图像中的信息:

[root@0b093624d012 /]# yum info libzip-devel
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.freethought-internet.co.uk
 * epel: mirror.freethought-internet.co.uk
 * extras: mirror.freethought-internet.co.uk
 * updates: mirror.freethought-internet.co.uk
Available Packages
Name        : libzip-devel
Arch        : i686
Version     : 0.10.1
Release     : 8.el7
Size        : 77 k
Repo        : base/7/x86_64
Summary     : Development files for libzip
URL         : http://www.nih.at/libzip/index.html
License     : BSD
Description : The libzip-devel package contains libraries and header files for
            : developing applications that use libzip.

Name        : libzip-devel
Arch        : x86_64
Version     : 0.10.1
Release     : 8.el7
Size        : 77 k
Repo        : base/7/x86_64
Summary     : Development files for libzip
URL         : http://www.nih.at/libzip/index.html
License     : BSD
Description : The libzip-devel package contains libraries and header files for
            : developing applications that use libzip.
我怀疑更改我的C编译器是否会有所帮助,但我肯定会接受这方面的想法。

我终于解决了这个问题

如果记录不起作用的内容是有帮助的,我首先注意到我有一个补丁级别的PHP版本差异。我的生产服务器在5.4.16上,我是为5.4.45构建的。我调整了这一点,确信它会下载正确的代码与其他库链接,结果发现它没有什么不同


然后,我分析了在pecl zip扩展中需要增加多少版本号才能获得下一个可用的稳定版本,这使我从zip-1.11.0升级到zip-1.12.3。这很好。这并不理想,因为我的生产服务器确实混合了zip 1.11.0和PHP5.4.16,但没关系——我们已经使用5.6开发了大约一年,尽管我们的目标是生产5.4。因此,新映像仍然是一个巨大的胜利,因为它使我们更接近我们的生活环境。

我假设get_property_ptr_ptr是一个库函数。您可能有多个版本的libzip,而您的编译器选择了一个不需要的版本。编译目标文件时失败,请检查头文件。谢谢@BruceShen。我不认为我不可能安装多个libzip-devel,因为我在Docker,我假设它不是Centos 7的默认安装。不过好消息是,我有一个修复程序,我有空时会写出来。我从zip-1.11.0跳到zip-1.12.3,修复了它。这并不完全理想,因为我的prod服务器确实有带有zip-1.11.0的PHP5.4,但我认为这一微小的差异不会对该图像的预期开发用途产生很大影响。
[root@0b093624d012 /]# yum info libzip-devel
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.freethought-internet.co.uk
 * epel: mirror.freethought-internet.co.uk
 * extras: mirror.freethought-internet.co.uk
 * updates: mirror.freethought-internet.co.uk
Available Packages
Name        : libzip-devel
Arch        : i686
Version     : 0.10.1
Release     : 8.el7
Size        : 77 k
Repo        : base/7/x86_64
Summary     : Development files for libzip
URL         : http://www.nih.at/libzip/index.html
License     : BSD
Description : The libzip-devel package contains libraries and header files for
            : developing applications that use libzip.

Name        : libzip-devel
Arch        : x86_64
Version     : 0.10.1
Release     : 8.el7
Size        : 77 k
Repo        : base/7/x86_64
Summary     : Development files for libzip
URL         : http://www.nih.at/libzip/index.html
License     : BSD
Description : The libzip-devel package contains libraries and header files for
            : developing applications that use libzip.