Solaris7 link bug when trying DSO

From: Date: Wed, 20 Dec 2000 17:38:07 +0000
Subject: Solaris7 link bug when trying DSO
Groups: php.install 
Request: Send a blank email to php-install+get-1299@lists.php.net to get a copy of this message
I hope this mail will help all solaris user wanting to run PHP as a DSO module of apache, since I haven't seen any report on that problem. I am working on a Sun workstation with Solaris7 installed and Sun Workshop 6 Update 1. Compilation and installation of Apache 1.3.14 with DSO went smoothly: % ./configure --prefix=/usr/local/apache --enable-module=so % make % make install Then I tried to compile PHP4 (4.0.3pl1 and the latest snapshot php4-200012200445). Compilation was OK: % ./configure --with-apxs=/usr/local/apache/bin/apxs -with-mysql=/usr/local/mysql-3.23.28-gamma-sun-solaris2.7-sparc % make % make install But when I have tried to rerun apache, the following problem happened: % bin/apachectl start Syntax error on line 207 of /usr/local/apache/conf/httpd.conf: Can't locate API module structure `php4_module' in file /usr/local/apache/libexec/libphp4.so: ld.so.1: /usr/local/apache/bin/httpd: fatal: php4_module: can't find symbol bin/apachectl start: httpd could not be started After some search, I found that the final link was discarding a lot of symbols from the original libraries. For example, the symbol php4_module could be found in libsapi.al, but not in libphp4. It seems that the Sun linker has problem linking from static archive libraries to a dynamic library. Here's the workaround I have used: I have extract all the object files from the static archives to link. % foreach f ( Zend/.libs/libZend.al sapi/apache/.libs/libsapi.al main/.libs/libmain.al regex/.libs/libregex.al ext/mysql/.libs/libmysql.al ext/pcre/.libs/libpcre.al ext/posix/.libs/libposix.al ext/session/.libs/libsession.al ext/standard/.libs/libstandard.al ext/xml/.libs/libxml.al TSRM/.libs/libtsrm.al ) %% ar -xv $f %% end Then, I have removed the --silent option from the final libtool link of libphp4.so to see the link command issued by libtool and I replaced the static archive files by all the object files: % CC -G -h libphp4.so -o .libs/libphp4.so stub.lo -z allextract *.lo -z defaultextract -L/usr/ucblib -L/usr/local/mysql-3.23.28-gamma-sun-solaris2.7-sparc/lib -lpam -ldl -lmysqlclient -lresolv -lresolv -lm -ldl -lcrypt -lnsl -lsocket -lsocket -lpam -ldl -lmysqlclient -lresolv -lresolv -lm -ldl -lcrypt -lnsl -lsocket -lsocket -lc -ldl As you can see, there's a little difference in the size of the final library % ls -l libphp4* -rwxr-xr-x 1 root iaa-v3d 108808 Dec 20 18:00 libphp4.so.bad -rwxr-xr-x 1 root iaa-v3d 3262764 Dec 20 17:05 libphp4.so Then, apache can be started without any problem.

« previous php.install (#1299) next »