php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33326 Cannot build extensions with phpize
Submitted: 2005-06-13 19:19 UTC Modified: 2005-08-12 17:17 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:0 of 1 (0.0%)
From: artooro at gmail dot com Assigned: sniper
Status: Closed Package: Compile Failure
PHP Version: 5CVS-2005-06-13 (dev) OS: darwin8.x
Private report: No CVE-ID:
 [2005-06-13 19:19 UTC] artooro at gmail dot com
Description:
------------
I cannot build extensions that are generated using ext_skel. Here are the steps to reproduce.

1) cd /php-src/ext
2) ./ext_skel --extname=test
3) cd test // And edit config.m4 to enable extension
4) phpize
5) ./configure; make

And I get the following output:
/bin/sh /Users/arthur/php-src/ext/test/libtool --mode=compile gcc  -I. -I/Users/arthur/php-src/ext/test -DPHP_ATOM_INC -I/Users/arthur/php-src/ext/test/include -I/Users/arthur/php-src/ext/test/main -I/Users/arthur/php-src/ext/test -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend  -DHAVE_CONFIG_H  -g -O2   -c /Users/arthur/php-src/ext/test/test.c -o test.lo 
mkdir .libs
 gcc -I. -I/Users/arthur/php-src/ext/test -DPHP_ATOM_INC -I/Users/arthur/php-src/ext/test/include -I/Users/arthur/php-src/ext/test/main -I/Users/arthur/php-src/ext/test -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -DHAVE_CONFIG_H -g -O2 -c /Users/arthur/php-src/ext/test/test.c  -fno-common -DPIC -o .libs/test.o
gcc -dynamic -flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC -I/Users/arthur/php-src/ext/test/include -I/Users/arthur/php-src/ext/test/main -I/Users/arthur/php-src/ext/test -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend  -DHAVE_CONFIG_H  -g -O2   -o test.so  test.lo 
/usr/bin/ld: test.lo bad magic number (not a Mach-O file)
collect2: ld returned 1 exit status
make: *** [test.so] Error 1


It should also be noted that it worked fine before, but either something in PHP broke it or Xcode 2.1. Because it worked fine with Xcode 2.0.

Reproduce code:
---------------
Not relevant

Expected result:
----------------
It should compile without errors.

Actual result:
--------------
See description.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-13 23:02 UTC] sniper@php.net
And you're really using the phpize from the same sources?
(ie. you first installed compiled PHP from it?)

 [2005-06-14 02:01 UTC] artooro at gmail dot com
That is correct. I built and installed PHP from CVS head. Created the extension inside that source tree, built it. And got the error.

I can't go back to Xcode 2.0 due to technical reasons but as soon as I have time I'll see if it works with php 5.0.4 as it did before.
 [2005-06-14 02:54 UTC] sniper@php.net
Exactly what is this 'xcode' thing you're referring to and what does it have to do with PHP and phpize?!

 [2005-06-14 03:08 UTC] rasmus@php.net
Apple's dev environment.  For our purposes it means gcc-4.0.0.
 [2005-06-14 15:15 UTC] artooro at gmail dot com
Yeah, Apple's Xcode includes GCC, linkers, autoconf, basically everything needed to build source code plus an IDE.

I'm testing php 5.0.4 now.
 [2005-06-14 15:42 UTC] sniper@php.net
Try using --without-pic with configure, that might be the issue here. (try with fresh sources!)

 [2005-06-14 17:07 UTC] artooro at gmail dot com
OK, I just compiled+installed php 5.0.4 and build an extension using it. And it worked without any problems.

So it seems this is a problem specific to php5.1.0-dev CVS. I believe it's a problem is phpize but am not totally sure yet.
 [2005-06-14 17:08 UTC] sniper@php.net
Please try the --without-pic option. And if possible, see how the generated Makefile's differ in HEAD vs. 5.0.4

 [2005-06-17 03:57 UTC] artooro at gmail dot com
I have determined the problem is not with the Makefile, but something in the build directory. I have not had the time to find out exactly what yet.
I know it's something in the builddir because if I set that one path to a php5.0.4 build dir it works.

I'll try the --without-pic option tomorrow, and maybe find out what exactly is causing this.
 [2005-06-22 18:05 UTC] artooro at gmail dot com
Well I have pin-pointed the problem to the libtool which is generated by the phpize generated configure script.

--with-pic does not help, not that I thought it would. I'm not sure what exactly is wrong with libtool yet but I'll look into that today.
 [2005-06-23 13:08 UTC] sniper@php.net
You're sure you have the correct build files installed?
(for example the libtool.m4 is totally different in HEAD)

 [2005-06-25 18:12 UTC] artooro at gmail dot com
Yes to your question. I checked that over and over again because I thought of that too.

There are so many changes between the 5.0.4 and CVS HEAD generated libtool (over 500 diffs) that I wasn't sure where to start :)
 [2005-06-30 11:28 UTC] bmansion at mamasam dot com
Just to confirm the problem on Mac OS X using Tiger both with GCC 4 and GCC 3.3. The problem seems definitely in the generated libtool. I am using PHP 5.1beta2 with phpize. I've had the same messages when I tried to compile PECL translit and mnogosearch extensions. I didn't test with other extensions but I guess the problem will be the same.
 [2005-06-30 16:24 UTC] sniper@php.net
Can you reproduce this on other machine(s) ?
(with same OS and versions of tools)

 [2005-07-26 01:18 UTC] jeffg at activestate dot com
this is still ocurring with php 5.1 b3. I'm trying to build xdebug and getting the same failures, seems to eb something wrong with libtool generated by configure.
 [2005-07-26 01:27 UTC] artooro at gmail dot com
sniper, I have no other machines with OSX so no I can't reproduce on other machine(s). But at least three other people have had this problem as well now.

I might be able to look into it some more tomorrow, if needed.
 [2005-07-26 02:00 UTC] rasmus@php.net
The temporary fix is to just copy-paste the final link line back with all the .lo filenames replaced with .libs/*.o

eg. to build pecl/apc I use:

gcc -dynamic -flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC -I/Users/rasmus/pecl/apc/include -I/Users/rasmus/pecl/apc/main -I/Users/rasmus/pecl/apc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend  -DHAVE_CONFIG_H  -g -O2   -o apc.so .libs/*.o

instead of:

gcc -dynamic -flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC -I/Users/rasmus/pecl/apc/include -I/Users/rasmus/pecl/apc/main -I/Users/rasmus/pecl/apc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend  -DHAVE_CONFIG_H  -g -O2   -o apc.so  apc.lo php_apc.lo apc_cache.lo apc_compile.lo apc_debug.lo apc_fcntl.lo apc_main.lo apc_mmap.lo apc_optimizer.lo apc_pair.lo apc_sem.lo apc_shm.lo apc_sma.lo apc_stack.lo apc_zend.lo
 [2005-08-12 12:22 UTC] sniper@php.net
This patch fixed same build problem on one Macosx machine I have access to:

  http://www.php.net/~jani/patches/bug33326.patch

It seemed to have GCC 3.3 though..but do try that.
Apply to acinclude.m4 in $prefix/lib/php/build/ or to the one you get after phpize.

 [2005-08-12 17:03 UTC] artooro at gmail dot com
I tested your patch on the PHP_5_1 branch and can verify that it fixes the problem.

Thanks.
 [2005-08-12 17:17 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC