ID:               49314
 Updated by:       j...@php.net
 Reported By:      sbraun at emlix dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Dynamic loading
 Operating System: linux
 PHP Version:      5.3.0
 New Comment:

Unfortunately we don't support cross-compiling out-of-box. Best way to
do this is to first generate rough template Makefile (which you bascally
got already) and then manually fix the LIBS, and such.


Previous Comments:
------------------------------------------------------------------------

[2009-08-20 16:15:31] sbraun at emlix dot com

The compiler is an i686 compiler, which runs in an i486-pc-linux-gnu
chroot. So the first lines should read:

I cross compile libphp5.so in a i486-pc-linux-gnu chroot, the compiler
is an i686-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).

------------------------------------------------------------------------

[2009-08-20 16:13:04] sbraun at emlix dot com

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 this bug report at http://bugs.php.net/?id=49314&edit=1

Reply via email to