php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51276 php_load_extension is called when HAVE_LIBDL is not defined.
Submitted: 2010-03-11 18:08 UTC Modified: 2010-06-08 14:54 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:2 (40.0%)
From: tsteiner at nerdclub dot net Assigned: tony2001
Status: Closed Package: Compile Failure
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID:
 [2010-03-11 18:08 UTC] tsteiner at nerdclub dot net
Description:
------------
When HAVE_LIBDL is not defined in main/php_config.h, the function php_load_extension is not compiled in ext/standard/dl.c.  However, the function php_load_php_extension_cb() will always be compiled with a call to php_load_extension.  This causes compilation to fail with the following message:

main/php_ini.o: In function `php_load_php_extension_cb':
[path removed]/main/php_ini.c:350: undefined reference to `php_load_extension'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

This appears to be the only place php_load_extension is called.  Furthermore, php_load_php_extension_cb is only referenced by php_ini_register_extensions(), which is only called in at main/main.c:2021.  It would seem that on architectures that don't HAVE_LIBDL, the preceding functions should be inside #if defined() checks.

I found this bug while cross-compiling from x86_64 to powerpc but I don't believe it is a cross-compiling issue.

Test script:
---------------
CC=${CROSS_COMPILE}gcc ../php-5.3.2/configure --host=powerpc-unknown-linux
make

Expected result:
----------------
PHP should compile without errors.

Actual result:
--------------
main/php_ini.o: In function `php_load_php_extension_cb':
[path removed]/main/php_ini.c:350: undefined reference to `php_load_extension'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

Patches

php-5.3.2-nolibdl-compile-error (last revision 2010-03-11 17:10 UTC) by tsteiner at nerdclub dot net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-19 16:42 UTC] richard at webdezign dot co dot uk
I have this problem too on CentOS 5.3.

I run:
../php-5.3.2/configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu
make

and get the same error. I do have libdl.so.2 in my lib64 directory.

But if I apply the php-5.3.2-nolibdl-compile-error patch, does that mean that the PHP I compile will not be able to load extensions dynamically?
 [2010-06-08 14:54 UTC] tony2001@php.net
Automatic comment from SVN on behalf of tony2001
Revision: http://svn.php.net/viewvc/?view=revision&revision=300272
Log: fix bug #51276 (php_load_extension() is missing when HAVE_LIBDL is undefined)
 [2010-06-08 14:54 UTC] tony2001@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: tony2001
 [2010-06-08 14:54 UTC] tony2001@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 18:01:55 2014 UTC