From: sbraun at emlix dot com
Operating system: linux
PHP version: 5.3.0
PHP Bug Type: Dynamic loading
Bug description: cross compile fails to find dlopen, libdl, HAVE_DLOPEN,
HAVE_LIBDL
Description:
------------
I cross compile libphp5.so in a i486-pc-linux-gnu chroot, the compiler is
an i486-pc-linux-gnu-gcc that produces code for an i686-pc-linux-gnu target
(the compile runs as part of an embedded systems build system).
When I load the libphp5.so into apache, it fails with:
httpd: Syntax error on line 54 of /etc/httpd/conf/httpd.conf: Cannot load
/usr/lib/apache/libphp5.so into server: /usr/lib/apache/libphp5.so:
undefined symbol: php_load_extension
php_load_extension from dl.c is guarded by #ifdef HAVE_LIBDL
objdump -x libphp5.so:
00000000 *UND* 00000000 php_load_extension
In my cross_compile situtation, the #defines for dlopen and libdl are not
set, thus HAVE_DLOPEN and HAVE_LIBDL are not in main/php_config.h, yet my
system provides dlopen() via dl.so.
Naturally, dl.so is there in my chroot and provides dlopen(), and the
configure script finds this fact when searching for dlopen() respectively
__dlopen(), yet then it throws the findings away, the relevant lines in the
configure script are:
------------------
if test "$found" = "yes"; then
ac_libs=$LIBS
LIBS="$LIBS -ldl"
if test "$cross_compiling" = yes; then
found=no
else
------------------
Later, writing the #defines HAVE_DLOPEN and HAVE_LIBDL is guarded by:
------------------
if test "$found" = "yes"; then
------------------
Reproduce code:
---------------
autoconf configure.in > configure
build_platform=i486-pc-linux-gnu
target_platform=i486-pc-linux-gnu
PKG_CONFIG_PATH=${sysroot}/usr/lib/pkgconfig \
./configure \
--prefix=${_prefix} \
--build=${build_platform} \
--host=${target_platform} \
--target=${target_platform} \
--mandir=${_mandir} \
--with-apxs2="${sysroot}${_sbindir}/apxs" \
--with-libxml-dir="${sysroot}${_prefix}" \
--with-openssl \
--without-iconv \
--disable-cli \
;
start apache with a line in httpd.conf:
LoadModule php5_module /usr/lib/apache/libphp5.so
you get the error described above
Expected result:
----------------
well, it should load and stuff
Actual result:
--------------
Instead I will provide some bugfix suggestion:
I am not so much a friend of autoconf, so i think i am maybe not the right
person to provide a patch directly. Maybe there is a reason for the
behaviour. I am going to comment the problematic line out in my project,
patch would be welcome.
# phps configure mysteriously refuses to use found libdl
# if test "$cross_compiling" = yes; then
# found=no
regards
Simon Braunschmidt
--
Edit bug report at http://bugs.php.net/?id=49314&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49314&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49314&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49314&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49314&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49314&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49314&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49314&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49314&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49314&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49314&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49314&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49314&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49314&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49314&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49314&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49314&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49314&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49314&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49314&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49314&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49314&r=mysqlcfg