tags:

views:

392

answers:

2

Hi,

Im trying to compile a php interface for my linux shared object and i have managed to get it to compile all right using the output from swig, however when i try and load the so it complains of a missing symbol:

error: undefined symbol: zend_register_long_constant

Now i have had a look at zend and it seems to be a php framework. I think im missing a library to link against but i dont know which library.

Any one else done this before and got it to work?

Edit:

 ldd xxxx.so 
    linux-gate.so.1 =>  (0xb7fdb000)
    libcurl-gnutls.so.4 => /usr/lib/libcurl-gnutls.so.4 (0xb7f0a000)
    libboost_date_time-gcc42-1_34_1.so.1.34.1 => /usr/lib/libboost_date_time-gcc42-1_34_1.so.1.34.1 (0xb7efb000)
    libboost_thread-gcc42-mt-1_34_1.so.1.34.1 => /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1 (0xb7eed000)
    libboost_filesystem-gcc42-1_34_1.so.1.34.1 => /usr/lib/libboost_filesystem-gcc42-1_34_1.so.1.34.1 (0xb7ee1000)
    libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7eaf000)
    libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7e9b000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7e92000)
    libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb7d55000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7d51000)
    libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7d38000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c49000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7c23000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7c14000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ab5000)
    libidn.so.11 => /usr/lib/libidn.so.11 (0xb7a83000)
    libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0xb7a41000)
    libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb79af000)
    libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb798b000)
    libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7987000)
    libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb795c000)
    libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0xb78bf000)
    libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0xb78ad000)
    libz.so.1 => /usr/lib/libz.so.1 (0xb7897000)
    libgcrypt.so.11 => /lib/libgcrypt.so.11 (0xb782e000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7814000)
    /lib/ld-linux.so.2 (0xb7fdc000)
    liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0xb7806000)
    libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb77ee000)
    libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb77e5000)
    libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xb77e1000)
    libgpg-error.so.0 => /lib/libgpg-error.so.0 (0xb77dc000)
+1  A: 

If you were missing a library during the link stage, you wouldn't have gotten it to compile and link.

Could you please ldd that shared object and post the results?

Edit:

You don't get a link error when you build? I believe there should be a link to libphp in there.

Robert Rouse
Gah, that comment was to another post. LOL, ive added the info you wanted and a rep bounty as well
Lodle
+1  A: 

From the ldd output, it looks like you're not linking to libphp dynamically. It may be a bug with the Swig-generated Makefile.

You might want to look into using the correct toolset for building PHP extensions instead of using Swig. This process varies from version to version of PHP. This usually starts though with using the tool 'phpize' that comes with the PHP distribution you're using -- this creates a skeleton build from a set of files that you're going to be building from.

Dean Michael
i was looking into phpize but it involves alot more work. I was looking at the php source and the zend code is there, might try compiling that into a library and linking against it.
Lodle