Re: dl(): Invalid library (maybe not a PHP library)
| From: | Anas Mughal | Date: | Sat, 06 Dec 2003 05:56:53 +0000 |
| Subject: | Re: dl(): Invalid library (maybe not a PHP library) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172047@lists.php.net to get a copy of this message | ||
I found one problem. I had to add "=shared" after --enable-my_ext.
So, this is what I did:
./configure --enable-my_ext=shared
Now, the makefile looks much better. (I have attached the Makefile.)
However, I get errors in make. Those errors are generated when invoking
the libtool command.
[anas@localhost tryExtendPHP4.3.3]$ make
/bin/sh /home/anas/shop/tryExtendPHP4.3.3/libtool --mode=compile gcc
-I. -I/home/anas/shop/tryExtendPHP4.3.3 -DPHP_ATOM_INC
-I/home/anas/shop/tryExtendPHP4.3.3/include
-I/home/anas/shop/tryExtendPHP4.3.3/main
-I/home/anas/shop/tryExtendPHP4.3.3 -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/Zend
-I/usr/local/include/php/TSRM -DHAVE_CONFIG_H -g -O2 -prefer-pic -c
/home/anas/shop/tryExtendPHP4.3.3/my_ext.c -o my_ext.lo
/home/anas/shop/tryExtendPHP4.3.3/libtool: s%^.*/%%: No such file or
directory
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
: compile: cannot determine name of library object from `'
make: *** [my_ext.lo] Error 1
I don't know what is going on. Could some expert please advise.
Thank you.
Here is output of the same command with --debug option:
[anas@localhost tryExtendPHP4.3.3]$ make
/bin/sh /home/anas/shop/tryExtendPHP4.3.3/libtool --debug --mode=compile
gcc -I. -I/home/anas/shop/tryExtendPHP4.3.3 -DPHP_ATOM_INC
-I/home/anas/shop/tryExtendPHP4.3.3/include
-I/home/anas/shop/tryExtendPHP4.3.3/main
-I/home/anas/shop/tryExtendPHP4.3.3 -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/Zend
-I/usr/local/include/php/TSRM -DHAVE_CONFIG_H -g -O2 -prefer-pic -c
/home/anas/shop/tryExtendPHP4.3.3/my_ext.c -o my_ext.lo
/home/anas/shop/tryExtendPHP4.3.3/libtool: s%^.*/%%: No such file or
directory
: enabling shell trace mode
+ test 20 -gt 0
+ arg=--mode=compile
+ shift
++ echo X--mode=compile
++ -e '1s/^X//' -e 's/[-_a-zA-Z0-9]*=//'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ optarg=
+ test -n ''
+ mode=
+ test 19 -gt 0
+ arg=gcc
+ shift
+ optarg=
+ test -n ''
+ nonopt=gcc
+ break
+ test -n ''
+ exec_cmd=
+ test -z ''
+ test -z ''
+ mode=link
+ mode=compile
+ break
+ test -n ''
+ generic_help=Try ` --help' for more information.
+ help=Try ` --help --mode=compile' for more information.
+ modename=: compile
+ base_compile=
+ prev=
+ lastarg=
+ srcfile=gcc
+ suppress_output=
+ user_target=no
+ lastarg=gcc
+ srcfile=-I.
++ echo Xgcc
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z ''
+ base_compile=""
+ lastarg=-I.
+ srcfile=-I/home/anas/shop/tryExtendPHP4.3.3
++ echo X-I.
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '""'
+ base_compile="" ""
+ lastarg=-I/home/anas/shop/tryExtendPHP4.3.3
+ srcfile=-DPHP_ATOM_INC
++ echo X-I/home/anas/shop/tryExtendPHP4.3.3
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" ""'
+ base_compile="" "" ""
+ lastarg=-DPHP_ATOM_INC
+ srcfile=-I/home/anas/shop/tryExtendPHP4.3.3/include
++ echo X-DPHP_ATOM_INC
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" ""'
+ base_compile="" "" "" ""
+ lastarg=-I/home/anas/shop/tryExtendPHP4.3.3/include
+ srcfile=-I/home/anas/shop/tryExtendPHP4.3.3/main
++ echo X-I/home/anas/shop/tryExtendPHP4.3.3/include
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" ""'
+ base_compile="" "" "" "" ""
+ lastarg=-I/home/anas/shop/tryExtendPHP4.3.3/main
+ srcfile=-I/home/anas/shop/tryExtendPHP4.3.3
++ echo X-I/home/anas/shop/tryExtendPHP4.3.3/main
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" ""'
+ base_compile="" "" "" "" "" ""
+ lastarg=-I/home/anas/shop/tryExtendPHP4.3.3
+ srcfile=-I/usr/local/include/php
++ echo X-I/home/anas/shop/tryExtendPHP4.3.3
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""'
+ base_compile="" "" "" "" "" ""
""
+ lastarg=-I/usr/local/include/php
+ srcfile=-I/usr/local/include/php/main
++ echo X-I/usr/local/include/php
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
""'
+ base_compile="" "" "" "" "" ""
"" ""
+ lastarg=-I/usr/local/include/php/main
+ srcfile=-I/usr/local/include/php/Zend
++ echo X-I/usr/local/include/php/main
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" ""'
+ base_compile="" "" "" "" "" ""
"" "" ""
+ lastarg=-I/usr/local/include/php/Zend
+ srcfile=-I/usr/local/include/php/TSRM
++ echo X-I/usr/local/include/php/Zend
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" ""'
+ base_compile="" "" "" "" "" ""
"" "" "" ""
+ lastarg=-I/usr/local/include/php/TSRM
+ srcfile=-DHAVE_CONFIG_H
++ echo X-I/usr/local/include/php/TSRM
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" "" ""'
+ base_compile="" "" "" "" "" ""
"" "" "" "" ""
+ lastarg=-DHAVE_CONFIG_H
+ srcfile=-g
++ echo X-DHAVE_CONFIG_H
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" "" "" ""'
+ base_compile="" "" "" "" "" ""
"" "" "" "" "" ""
+ lastarg=-g
+ srcfile=-O2
++ echo X-g
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" "" "" "" ""'
+ base_compile="" "" "" "" "" ""
"" "" "" "" "" "" ""
+ pic_mode=yes
+ continue
+ lastarg=-O2
+ srcfile=-c
++ echo X-O2
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" "" "" "" "" ""'
+ base_compile="" "" "" "" "" ""
"" "" "" "" "" "" ""
""
+ lastarg=-c
+ srcfile=/home/anas/shop/tryExtendPHP4.3.3/my_ext.c
++ echo X-c
++ -e '1s/^X//' -e 's/\([\\`\\"$\\\\]\)/\\\1/g'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ lastarg=
+ lastarg=""
+ test -z '"" "" "" "" "" ""
"" "" "" "" "" "" ""
""'
+ base_compile="" "" "" "" "" ""
"" "" "" "" "" "" ""
"" ""
+ test no '!=' no
+ user_target=next
+ user_target=yes
+ continue
+ user_target=set
+ libobj=my_ext.lo
+ continue
+ xform=[cCFSfmso]
++ echo Xmy_ext.lo
++ -e '1s/^X//' -e 's/\.[cCFSfmso]$/.lo/'
/home/anas/shop/tryExtendPHP4.3.3/libtool: -e: command not found
+ libobj=
+ echo ': compile: cannot determine name of library object from `'\'''
: compile: cannot determine name of library object from `'
+ exit 1
make: *** [my_ext.lo] Error 1
Curt Zirzow wrote:
> * Thus wrote Anas Mughal (am786@optonline.net):
>
>>I have followed the instructions in the PHP documentation on how to
>>build a custom dynamic extension. After running ext_skel, I did NOT add
>>any custom methods. I built the extension using the followind commands:
>>
>>Compiling cc -fpic -DCOMPILE_DL=1 -I/usr/local/include -I. -I..
>>-I../Zend -c -o <your_object_file> <your_c_file>
>>
>>Linking cc -shared -L/usr/local/lib -rdynamic -o <your_module_file>
>><your_object_file(s)>
>>
>
> 1. edit the config.m4 and remove the dnl's on the lines that look
> somethign like:
> dnl PHP_ARG_ENABLE(baz, whether to enable baz support,
> dnl Make sure that the comment is aligned:
> dnl [ --enable-baz Enable baz support])
>
> 2. ./phpize
>
> Creates the configure environment
>
> 3. ./configure --enable-baz
> 4. make
> 5. make install
>
> the make install just copies the file in the modules/ dir to your
> php module directory.
>
> HTH,
>
> Curt
>