Hi All,
I'm having a problem getting a new extension created for my PHP 5.2.6 on Fedora 9 environment. Basically I'm attempting to create a wrapper for a pre-compiled shared library that was created by a 3rd party. I have the 3rd library and header and have included the header in my_mytest.c. Top part of the my_mytest.c:
/ include standard header /
#include "php.h"
#include "my_mytest.h"
#include "vendorapp.h"
The module appears to compile fine, but when I attempt to run a quick test in PHP (at the cli) I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mytest.so' - /usr/lib/php/modules/mytest.so: undefined symbol: APPUnlock in Unknown on line 0
APPUnlock is a function in the 3rd party library.
In order to build the wrapper library, I created the my_mytest.c code, the my_mytest.h header and the config.m4. I put all of these files in /usr/include/php/ext/mytest/ and the 3rd party header file in here. Then I ran phpize in the mytest directory. My config.m4 looks like:
PHP_ARG_WITH(mytest, whether to enable mytest support,
[ --with-mytest Enable mytest support])
PHP_ADD_INCLUDE(/opt/vendor/APP/include)
PHP_ADD_LIBRARY_WITH_PATH(libvendorapp.so, /opt/vendor/APP/lib)
PHP_NEW_EXTENSION(mytest, my_mytest.c, $ext_shared)
I ran ./configure --with-mytest next and it appeared to complete successfully (no warnings or errors)
I ran make (no warnings or errors)
I ran make install (no warnings or errors)
The error I am getting seems to be a linking error, I do not believe it is actually including the libvendorapp.so library. I've checked through an LD_DEBUG=file, and just do not ever see it linking to this library. I am fairly new to this side of PHP, so I am probably missing something obvious. Any help anyone could provide would be very useful.
Thank you.