Re: dl(): Invalid library (maybe not a PHP library)

From: Date: Thu, 04 Dec 2003 21:11:06 +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-171892@lists.php.net to get a copy of this message
Yes, I had uncommented those lines already. This how they look in my config.m4 file: PHP_ARG_ENABLE(my_ext, whether to enable my_ext support, dnl Make sure that the comment is aligned:
[  --enable-my_ext           Enable my_ext support])
Now, I ran the commands that you suggested (phpize, configure, make, make install). Here is what I get: [anas@localhost tryExtendPHP4.3.3]$ phpize Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20021010 [anas@localhost tryExtendPHP4.3.3]$ ./configure --enable-my_ext creating cache ./config.cache checking host system type... i686-pc-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking whether gcc and cc understand -c and -o together... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes 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/Zend -I/usr/local/include/php/TSRM checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20020429 checking how to run the C preprocessor... gcc -E checking for gawk... gawk checking whether to enable my_ext support... yes, shared checking for Cygwin environment... no checking for mingw32 environment... no checking build system type... i686-pc-linux-gnu checking for ld used by GCC... /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 recognise dependant libraries... pass_all checking for object suffix... o checking for executable suffix... no checking command to parse /usr/bin/nm -B output... ok checking for dlfcn.h... yes checking for ranlib... ranlib checking for strip... strip checking for objdir... .libs checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.lo... yes checking if gcc supports -fno-rtti -fno-exceptions... yes checking whether the linker (/usr/bin/ld) supports shared libraries... yes checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking dynamic linker characteristics... GNU/Linux ld.so checking if libtool supports shared libraries... yes checking whether -lc should be explicitly linked in... no creating libtool mkdir: too few arguments Try `mkdir --help' for more information. updating cache ./config.cache creating ./config.status creating config.h [anas@localhost tryExtendPHP4.3.3]$ make Build complete. (It is safe to ignore warnings about tempnam and tmpnam). [anas@localhost tryExtendPHP4.3.3]$ make install Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ The command said that it installed the shared extension in /usr/local/lib/php/extensions/no-debug-non-zts-20020429. However, I don't see anything in there! (Is the mkdir error produced by configure okay? See above.) Please help... P.S. Please note that I need a dynamic extension. I need to load it using the dl() command. 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


« previous php.general (#171892) next »