Hi

php-4.1.2
linux RH 7.2

I have created a small php extension. The extension works as expected 
when I compile it using

$ ./configure --with-foo && make  # foo is the extension

It gets compiled into the php binary. All is well, but I would like to 
compile my extension as a loadable modules (ie to use with the dl() 
function). Thus

$ ./configure --with-foo=shared && make

The compilation completes with no errors. The php binary works (my foo 
ext is not included in the binary), but I end up with *no* 'foo.so' 
file. Instead I get this

$ ls -l modules/
  51776 Apr  5 13:11 foo.a
    647 Apr  5 13:11 foo.la


I expected to see a 'foo.so' file.

Obviously I cannot use dl() on these files.

The foo extension is as simple as possible, just to illustrate the 
problem. It was created using these commands:

1.  $ cd ~/php-4.1.2/ext
2.  $ ./ext_skel --extname=foo
3.  $ cd ..
4.  $ vi ext/foo/config.m4
5.  $ ./buildconf
6.  $ ./configure --with-foo=shared
7.  $ make

The whole config.m4:

PHP_ARG_WITH(foo, for foo support,
[  --with-foo             Include foo support])

if test "$PHP_FOO" != "no"; then
   PHP_EXTENSION(foo, $ext_shared)
fi


Output from make:

make[3]: Entering directory `/home/wic/php-4.1.2/ext/foo'
/bin/sh /home/wic/php-4.1.2/libtool --silent --mode=compile gcc -I. 
-I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main 
-I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend 
-I/home/wic/php-4.1.2/ext/mysql/libmysql 
-I/home/wic/php-4.1.2/ext/xml/expat  -I/home/wic/php-4.1.2/TSRM -g -O2 
-prefer-pic  -c foo.c && touch foo.slo
/bin/sh /home/wic/php-4.1.2/libtool --silent --mode=link gcc  -I. 
-I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main 
-I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend 
-I/home/wic/php-4.1.2/ext/mysql/libmysql 
-I/home/wic/php-4.1.2/ext/xml/expat  -I/home/wic/php-4.1.2/TSRM -g -O2 
-prefer-non-pic -static   -o foo.la -avoid-version -module -rpath 
/home/wic/php-4.1.2/modules  foo.lo
/bin/sh /home/wic/php-4.1.2/libtool --silent --mode=install cp foo.la 
/home/wic/php-4.1.2/modules
PATH="$PATH:/sbin" ldconfig -n /home/wic/php-4.1.2/modules
----------------------------------------------------------------------
Libraries have been installed in:
    /home/wic/php-4.1.2/modules

  [etc...]


Note that I can manually create a so-file from the foo.a file using ld 
as in:

$ cd modules; ar x foo.a; ld -Bshareable -o foo.so foo.o

and then call dl("foo.so"), but that is not the way to go, right???

I think there is some arcance libtool switch missing in the Makefile, 
or I need something else in the config.m4 file

Btw, my real extension is a lot more complex, but it has the same 
problems so I figured this foo-thing would be a bit easier to debug :-)

I have searched high and low for any leads, but nothing has turned up 
so far.


/Regards


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to