|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-03-05 16:38 UTC] dtm2mcs at gmail dot com
Description: ------------ Compile crash when trying to compile PHAR Test script: --------------- Compile PHP with PHAR Expected result: ---------------- Compiled PHP Actual result: -------------- 11384 Segmentation fault ` if test -x "/root/php53/php-5.3.2/sapi/cli/php"; then /root/php53/php-5.3.2/build/shtool echo -n -- "/root/php53/php-5.3.2/sapi/cli/php -n"; if test "x" != "x"; then /root/php53/php-5.3.2/build/shtool echo -n -- " -d extension_dir=/root/php53/php-5.3.2/modules"; for i in bz2 zlib phar; do if test -f "/root/php53/php-5.3.2/modules/$i.la"; then . /root/php53/php-5.3.2/modules/$i.la; /root/php53/php-5.3.2/build/shtool echo -n -- " -d extension=$dlname"; fi; done; fi; else /root/php53/php-5.3.2/build/shtool echo -n -- "/root/php53/php-5.3.2/sapi/cli/php"; fi;` -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0' /root/php53/php-5.3.2/ext/phar/build_precommand.php >ext/phar/phar.php make: *** [ext/phar/phar.php] Error 139 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
Not PHAR related, this is actually the php-cli binary segfaulting during the make process. Here is a trace : 0x0839c8f4 in zend_startup_module_ex (module=0x8732210, tsrm_ls=0x8712070) at /usr/src/php-5.3.2/Zend/zend_API.c:1618 1618 EG(current_module) = NULL; (gdb) where #0 0x0839c8f4 in zend_startup_module_ex (module=0x8732210, tsrm_ls=0x8712070) at /usr/src/php-5.3.2/Zend/zend_API.c:1618 #1 0x083a177a in zend_hash_apply (ht=0x8711460, apply_func=0x839c850 <zend_startup_module_ex>, tsrm_ls=0x8712070) at /usr/src/php-5.3.2/Zend/zend_hash.c:673 #2 0x0839c75a in zend_startup_modules (tsrm_ls=0x8712070) at /usr/src/php-5.3.2/Zend/zend_API.c:1662 #3 0x083372f0 in php_module_startup (sf=0x86f82c0, additional_modules=0x0, num_additional_modules=0) at /usr/src/php-5.3.2/main/main.c:2022 #4 0x084299f1 in php_cli_startup (sapi_module=0x86f82c0) at /usr/src/php-5.3.2/sapi/cli/php_cli.c:401 #5 0x0842a32c in main (argc=1, argv=0xbfffcf74) at /usr/src/php-5.3.2/sapi/cli/php_cli.c:775 This was reproduced on debian 5.0.4 x86I'm getting the same thing with Solaris 10 and gcc 4.4.3. It seems the Makefile is not generating a full ext/phar/phar.php (when compared to ext/phar/phar/phar.php). The code ends with an open curly brace: Generating phar.php Segmentation Fault - core dumped make: *** [ext/phar/phar.php] Error 139 /app/psoft/devl/packages/php/php-5.3.2/ hdlmpdu4/blk10.1/dev > ll ext/phar/phar.php -rw-r--r-- 1 lmpjob lmpjob 351 Apr 7 16:10 ext/phar/phar.php /app/psoft/devl/packages/php/php-5.3.2/ hdlmpdu4/blk10.1/dev > ll ext/phar/phar/phar.php -rwxr-xr-x 1 lmpjob lmpjob 992 Aug 1 2008 ext/phar/phar/phar.php /app/psoft/devl/packages/php/php-5.3.2/ hdlmpdu4/blk10.1/dev > cat ext/phar/phar.php <?php /** @file phar.php * @ingroup Phar * @brief class Phar Pre Command * @author Marcus Boerger * @date 2007 - 2008 * * Phar Command */ foreach(array("SPL", "Reflection", "Phar") as $ext) { if (!extension_loaded($ext)) { echo "$argv[0] requires PHP extension $ext.\n"; exit(1); } } if (!class_exists('DirectoryTreeIterator', 0)) { As far as I can tell this part of the Makefile is where the problem is: ext/phar/phar.php: /app/psoft/devl/packages/php/php-5.3.2/ext/phar/build_precommand.php /app/psoft/devl/packages/php/php-5.3.2/ext/phar/phar/*.inc /app/psoft/devl/packages/php/php-5.3.2/ext/phar/phar/*.php $(SAPI_CLI_PATH) -@echo "Generating phar.php" @$(PHP_PHARCMD_EXECUTABLE) $(PHP_PHARCMD_SETTINGS) /app/psoft/devl/packages/php/php-5.3.2/ext/phar/build_precommand.php > ext/phar/phar.php My configure options were: /app/psoft/devl/packages/php/php-5.3.2/ hdlmpdu4/blk10.1/dev > cat config.nice #! /bin/sh # # Created by configure './configure' \ '--prefix=/app/psoft/scripts/pkg/php5' \ '--enable-cli' \ '--disable-cgi' \ '--with-bz2' \ '--with-zlib' \ '--with-png-dir=/app/psoft/scripts/pkg/png-1.4.1' \ '--with-gd' \ '--with-oci8=/app/oracle/product/10.2.0' \ "$@"The problem is in build_precommand.php. When I run it it gets to the open curly brace and churns for a couple seconds, then it Seg faults. I'm not sure how to fix it but will try changing it. /app/psoft/devl/packages/php/php-5.3.2/ext/phar/ hdlmpdu4/blk10.1/dev > ./build_precommand.php <?php /** @file phar.php * @ingroup Phar * @brief class Phar Pre Command * @author Marcus Boerger * @date 2007 - 2008 * * Phar Command */ foreach(array("SPL", "Reflection", "Phar") as $ext) { if (!extension_loaded($ext)) { echo "$argv[0] requires PHP extension $ext.\n"; exit(1); } } if (!class_exists('DirectoryTreeIterator', 0)) { Segmentation Fault(coredump)I've got a workaround. The problem seems to be that the build_precommand.php script cannot run on systems that do not have a working version of php. I think the Makefile is doing this for me already but just to be sure I tried changing the shebang from #!/usr/bin/php to my local #!/app/psoft/devl/packages/php/php-5.3.2/sapi/cli/php (based on what I thought the Makefile was doing). I kept running it from the command line and getting things like this (I was adding my own debugging info on lines that begin with // ): /app/psoft/devl/packages/php/php-5.3.2/ext/phar/ hdlmpdu4/blk10.1/dev > ./build_precommand.php <?php /** @file phar.php * @ingroup Phar * @brief class Phar Pre Command * @author Marcus Boerger * @date 2007 - 2008 * * Phar Command */ foreach(array("SPL", "Reflection", "Phar") as $ext) { if (!extension_loaded($ext)) { echo "$argv[0] requires PHP extension $ext.\n"; exit(1); } } if (!class_exists('DirectoryTreeIterator', 0)) { // name == DirectoryTreeIterator // file(dirname('__FILE__') . '/phar/' . strtolower('DirectoryTreeIterator') . '.inc'); // g == __FILE__/phar/$name.inc Segmentation Fault(coredump) Finally I decided to bring over a working php executable from another server and give it a try: /app/psoft/devl/packages/php/php-5.3.2/ext/phar/ hdlmpdu4/blk10.1/dev > which php /app/psoft/devl/bin/php /app/psoft/devl/packages/php/php-5.3.2/ext/phar/ hdlmpdu4/blk10.1/dev > /app/psoft/devl/bin/php --version PHP 5.0.2 (cli) (built: Oct 21 2004 17:00:20) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.2, Copyright (c) 1998-2004 Zend Technologies /app/psoft/devl/packages/php/php-5.3.2/ext/phar/ hdlmpdu4/blk10.1/dev > ./build_precommand.php <?php /** @file phar.php * @ingroup Phar * @brief class Phar Pre Command * @author Marcus Boerger * @date 2007 - 2008 * * Phar Command */ foreach(array("SPL", "Reflection", "Phar") as $ext) { if (!extension_loaded($ext)) { echo "$argv[0] requires PHP extension $ext.\n"; exit(1); } } if (!class_exists('DirectoryTreeIterator', 0)) { // name == DirectoryTreeIterator // file(dirname('__FILE__') . '/phar/' . strtolower('DirectoryTreeIterator') . '.inc'); // g == __FILE__/phar/$name.inc // f == Array // f == Array // c == 53 /** @file directorytreeiterator.inc * @ingroup Examples * @brief class DirectoryTreeIterator * @author Marcus Boerger * @date 2003 - 2008 * * SPL - Standard PHP Library */ /** @ingroup Examples * @brief DirectoryIterator to generate ASCII graphic directory trees * @author Marcus Boerger * @version 1.1 */ class DirectoryTreeIterator extends RecursiveIteratorIterator { /** Construct from a path. * @param $path directory to iterate */ function __construct($path) So, the problem is that the php executable that's built as an interem version for running the build_precommand.php script is not able to use the strtolower() function or the dirname() function (as far as my testing got, it bombed on each of those isolated cases). I was able to make a kludge workaround by modifing the Makefile replacing $(PHP_PHARCMD_EXECUTABLE) with my executable, but the next step failed (target ext/phar/phar.phar:). So I had to disable phar.I have a working php 5.3.5 and all I'm trying to add is gd stuff: Generating phar.php /bin/sh: line 1: 17327 Segmentation fault ./configure \ --with-mysql=/usr/bin\ \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli=mysqlnd \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl-dir=/usr/local/ssl \ --with-libxml-dir=/usr/lib64 \ --disable-cgi \ --with-zlib-dir=/usr/local/lib \ --with-imap=/usr/local/imap-2007e \ --with-imap-ssl \ --with-mcrypt=/usr/lib \ --enable-zip \ --with-gettext \ --enable-mbstring \ --with-curl=/usr/bin/curl \ --enable-sockets \ --with-jpeg-dir=/usr/lib64 \ --with-png-dir=/usr/lib64 \ --with-gdand now even stranger: ./configure \ --with-mysql=/usr/bin\ \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli=mysqlnd \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl-dir=/usr/local/ssl \ --with-libxml-dir=/usr/lib64 \ --disable-cgi \ --with-zlib-dir=/usr/local/lib \ --with-imap=/usr/local/imap-2007e \ --with-imap-ssl \ --with-mcrypt=/usr/local/lib \ --enable-zip \ --with-gettext \ --enable-mbstring \ --with-curl=/usr/bin/curl \ --enable-sockets \ --with-gd=/usr/local/ /usr/local/imap-2007e/c-client/libc-client.a(osdep.o): In function `ssl_onceonlyinit': /usr/local/imap-2007e/c-client/osdep.c:337: warning: the use of `tmpnam' is dangerous, better use `mkstemp' Generating phar.php /bin/sh: line 1: 19438 Segmentation fault ` if test -x "/usr/local/src/php-5.3.5/sapi/cli/php"; then /usr/local/src/php-5.3.5/build/shtool echo -n -- "/usr/local/src/php-5.3.5/sapi/cli/php -n"; if test "x" != "x"; then /usr/local/src/php-5.3.5/build/shtool echo -n -- " -d extension_dir=/usr/local/src/php-5.3.5/modules"; for i in bz2 zlib phar; do if test -f "/usr/local/src/php-5.3.5/modules/$i. la"; then . /usr/local/src/php-5.3.5/modules/$i.la; /usr/local/src/php-5.3.5/build/shtool echo -n -- " -d extension=$dlname"; fi; done; fi; else /usr/local/src/php-5.3.5/build/shtool echo -n -- "/usr/l ocal/src/php-5.3.5/sapi/cli/php"; fi;` -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0' /usr/local/src/php-5.3.5/ext/phar/build_precommand.php > ext/p har/phar.php make: *** [ext/phar/phar.php] Error 139 Generating phar.phar make: *** [ext/phar/phar.phar] Segmentation fault./configure \ --with-mysql=/usr/bin\ \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli=mysqlnd \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl-dir=/usr/local/ssl \ --with-libxml-dir=/usr/lib64 \ --with-zlib-dir=/usr/local/lib \ --with-imap=/usr/local/imap-2007e \ --with-imap-ssl \ --with-mcrypt=/usr/local/lib \ --with-jpeg-dir=/usr/lib64 \ --with-png-dir=/usr/lib64 \ --enable-zip \ --with-gettext \ --enable-mbstring \ --with-curl=/usr/bin/curl \ --enable-sockets \ --with-pdo-mysql=/usr/bin/mysql \ --with-gd=/usr/local produces: /usr/local/imap-2007e/c-client/libc-client.a(osdep.o): In function `ssl_onceonlyinit': /usr/local/imap-2007e/c-client/osdep.c:337: warning: the use of `tmpnam' is dangerous, better use `mkstemp' Generating phar.php /bin/sh: line 1: 6945 Segmentation fault ` if test -x "/usr/local/src/php-5.3.5/sapi/cli/php"; then /usr/local/src/php-5.3.5/build/shtool echo -n -- "/usr/local/src/php-5.3.5/sapi/cli/php -n"; if test "x" != "x"; then /usr/local/src/php-5.3.5/build/shtool echo -n -- " -d extension_dir=/usr/local/src/php-5.3.5/modules"; for i in bz2 zlib phar; do if test -f "/usr/local/src/php-5.3.5/modules/$i. la"; then . /usr/local/src/php-5.3.5/modules/$i.la; /usr/local/src/php-5.3.5/build/shtool echo -n -- " -d extension=$dlname"; fi; done; fi; else /usr/local/src/php-5.3.5/build/shtool echo -n -- "/usr/l ocal/src/php-5.3.5/sapi/cli/php"; fi;` -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0' /usr/local/src/php-5.3.5/ext/phar/build_precommand.php > ext/p har/phar.php make: *** [ext/phar/phar.php] Error 139 Generating phar.phar make: *** [ext/phar/phar.phar] Segmentation fault :-((so I tried something different: ./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl-dir=/usr/local/ssl \ --with-mysql=/usr/bin/ \ --enable-libgcc \ --with-libdir=lib64 \ --with-libxml-dir=/usr/lib64 \ --disable-cgi \ --with-zlib-dir=/usr/local/include \ --enable-zip \ --with-gd \ --with-png-dir=/usr/lib \ --with-jpeg-dir=/usr/lib \ --with-mcrypt=/usr/lib \ --with-gettext \ --enable-mbstring \ --with-curl=/usr/bin/curl \ --enable-sockets \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --with-mysqli=mysqlnd and I got: -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -o sapi/cli/php Generating phar.php /usr/local/src/php-5.3.5/sapi/cli/php: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory make: *** [ext/phar/phar.php] Error 127 Generating phar.phar /usr/local/src/php-5.3.5/sapi/cli/php: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory make: *** [ext/phar/phar.phar] Error 127