Re: Re: How to link .so lib into a PHP Extension
| From: | Michael J. Pawlowsky | Date: | Mon, 18 Jul 2005 13:42:47 +0000 |
| Subject: | Re: Re: How to link .so lib into a PHP Extension | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2627@lists.php.net to get a copy of this message | ||
Sara Golemon wrote:
Without seeing what your config.m4 currently looks like I can only offer general hints... The "simple" answer is: PHP_ADD_LIBRARY(hsbc,,HSBCEXT_SHARED_LIBADD) PHP_SUBST(HSBCEXT_SHARED_LIBADD) Which assumes that the library name is libhsbc and the extension name is hsbcext (replace as needed).Hi Sara... First just wanted to say thanks for the reply, as well as the tutorials. I'm anxiously awaiting the next part. Unfortunately I am still unable to get this extension to load. When compiling I know get the following error message: gcc -shared .libs/hsbc_cpi.o -L/usr/local -lCcCpiTools -Wl,-rpath -Wl,/usr/local -Wl,-soname -Wl, hsbc_cpi.so -o .libs/hsbc_cpi.so /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../libCcCpiTools.so: file not recognized: File format not recognized collect2: ld returned 1 exit status make: *** [hsbc_cpi.la] Error 1 Which is the same thing that was happening to me when I was manually editing the Makefile to include the Lib. If I "file" it, I get: [root@milou hsbc_cpi]# file /usr/lib/libCcCpiTools.so /usr/lib/libCcCpiTools.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped All looks good there. What is more odd, is that I can compile a reguar "C" app using it and that compiles and runs without any errors. Right now I'm keeping config.m4 as simple as possible.. it looks like: [ --enable-hsbc-cpi Enable HSBC CPI support]) if test "$PHP_HSBC_CPI" = "yes"; then AC_DEFINE(HAVE_HSBC_CPI, 1, [Whether you have HSBC CPI]) PHP_NEW_EXTENSION(hsbc_cpi, hsbc_cpi.c, $ext_shared) PHP_ADD_LIBRARY_WITH_PATH(CcCpiTools,/usr/local,HSBC_CPI_SHARED_LIBADD) PHP_SUBST(HSBC_CPI_SHARED_LIBADD) fi Any ideas? Thanks for any assistance, Mike