0

I cleared up some things in my mind and on my server and want to rewrite my question:

I got two packages from NetManagement, both belonging to nmcryptgate:

  • a PHP extension (source code)
  • a compiled library (the tar named nmcryptgate_client_1.7.16-i386-unknown-freebsdelf4.2)

I want to install these on my Debian 5.0.8 server.

I (./configure && make && make install)'d the PHP extension succesfully. phpinfo() states that the extension is enabled.

The created files went to

/usr/lib/php5/20060613+lfs/nmcryptgate.la
/usr/lib/php5/20060613+lfs/nmcryptgate.so

I moved the files from the compiled library as following (derived from the structure inside the tar):

/usr/local/bin/nmcryptgate
/usr/local/doc/nmcryptgate/developer.txt (of no help)
/usr/local/include/nmcryptgate.h
/usr/local/lib/libnmcryptgate.so.1
/usr/local/lib/libnmcryptgate.la
/usr/local/lib/libnmcryptgate.so (symlink directing to libnmcryptgate.so.1)

I called following methods after doing so:

ldconfig
libtool --finish

BUT: Whenever calling a method from the extension Apache will come up with this error:

/usr/sbin/apache2: symbol lookup error: /usr/lib/php5/20060613+lfs/nmcryptgate.so: undefined symbol: nmlistalloc

/usr/local/lib is included inside /etc/ld.so.conf.d/libc.conf

/usr/lib/php5/20060613+lfs/nmcryptgate.la reads:

# nmcryptgate.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).  
dlname='nmcryptgate.so'  

# Names of this library.  
library_names='nmcryptgate.so nmcryptgate.so nmcryptgate.so'  

# The name of the static archive.  
old_library=''  

# Libraries that this one depends upon.  
dependency_libs=''  

# Version information for nmcryptgate.  
current=0  
age=0  
revision=0  

# Is this an already installed library?  
installed=yes  

# Should we warn about portability when linking against -modules?  
shouldnotlink=yes  

# Files to dlopen/dlpreopen  
dlopen=''  
dlpreopen=''  

# Directory that this library needs to be installed in:  
libdir='/usr/local/lib'  
#libdir='/usr/lib/php5/20060613+lfs'  

/usr/local/lib/libnmcryptgate.la

# libnmcryptgate.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.3.4 (1.385.2.196 1999/12/07 21:47:57)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).  
dlname=''  

# Names of this library.  
library_names='libnmcryptgate.so.1 libnmcryptgate.so libnmcryptgate.so'  

# The name of the static archive.  
old_library=''  

# Libraries that this one depends upon.  
dependency_libs=' -L. -L/usr/ssl/lib -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto'  

# Version information for libnmcryptgate.  
current=1  
age=0  
revision=29  

# Is this an already installed library?  
installed=yes  

# Directory that this library needs to be installed in:  
libdir='/usr/local/lib'  

In my thinking/guessing the whole process should work this way:

  1. php encounters a method call handled by the extension
  2. the respective extension method is called
  3. the extension being just a php wrapper (my guess) calls the underlying binary
  4. until x. ... and returning back to php script

I guess that step 3 is the problem here: somehow the extension can't find the underlying binary lib - just a guess.

Am I right on this one? Or what's the prob? Can someone help out on this?

Thanks to all and regards, Christian

PS: I just recompiled it and found an error inside the config.log:

config.log:/usr/bin/ld: h_errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in /usr/local/lib/libnmcryptgate.so

I included /usr/local/lib/libnmcryptgate.so in the Makefile by appending

DEFAULT_INCLUDES = -include /usr/local/include/nmcryptgate.h

Still the same error ...

1 Answer 1

0

You have to add /usr/local/lib to library path. Create /etc/ld.so.conf.d/nmcryptgate.conf with the following content:

/usr/local/lib

Then run:

sudo ldconfig

Test the PHP again. Apache restart might be required.

6
  • Thanks for your help but it didn't :) The path was already included there from another file (libc.conf)
    – pong
    Feb 17, 2011 at 17:09
  • Then you can use strace to see what is happening. Configure apache to start only one worker, then restart it. Strace the worker process: strace -fp WORKER_PID. Try to use again the nmcrypt functions. Add the lines before the error in your question. Feb 18, 2011 at 3:50
  • What OS/kernel are you running? Feb 18, 2011 at 3:50
  • Hi Mircea, thanks again for your very appreciated help! I started it via php-cli and after much debugging I ran into the possibility that I got the wrong library from the vendor. The ELF header says something about OS/ABI: UNIX - FreeBSD. Don't know if ELF is compatible this way? I'm running Debian/GNU-Linux 5.0.8, Kernel 2.6.18 I guess. I tried preloading the library via config option and get a message that the lib can't be preloaded and instead will be ignored. When I do a ldconfig -p I see that the type is not deducted automatically - it says ELF instead of libcX - does this mean anything?
    – pong
    Feb 19, 2011 at 12:33
  • ELF is the binary format. But I do not think that you can run FreeBSD code on Linux. Or of it is possible you might need some kernel modules and all libraries that are linked by the nmcrypt Feb 19, 2011 at 18:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .