Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: Libtool, static libraries, and NSE modules
From: David Fifield <david () bamsoftware com>
Date: Mon, 22 Oct 2007 13:04:37 -0600

On Thu, Oct 18, 2007 at 07:46:14PM -0600, David Fifield wrote:
I've been working on fixing the build issue reported by Vijay on
OpenBSD. It looks like this:

  Compiling nse-standard-library
  gmake[1]: Entering directory `/home/vsankar/Downloads/nmap-4.22SOC7/nselib'
  ./libtool --tag=CC --silent --mode=compile 
  gcc -I../libpcre -I../liblua/ -Iliblua -I/usr/local/include -Ilibpcre -g -O2 -Wall  -fno-strict-aliasing 
-I/usr/include -I/usr/include -Inbase -Insock/include   -DHAVE_CONFIG_H -DNMAP_NAME=\"Nmap\" 
-DNMAP_URL=\"http://insecure.org\"; -DNMAP_PLATFORM=\"i386-unknown-openbsd4.1\" 
-DNMAPDATADIR=\"/usr/local/share/nmap\" -DNMAPLIBEXECDIR=\"/usr/local/libexec/nmap\" -c pcre.c
  ./libtool --tag=CC --silent --mode=link gcc -L../libpcre -lpcre -avoid-version -module -rpath /usr/local/lib -o 
pcre.la pcre.lo
  
  *** Warning: linker path does not have real file for library -lpcre.
  *** I have the capability to make that library automatically link in when
  *** you link to this library.  But I can only do this if you have a
  *** shared version of the library, which you do not appear to have
  *** because I did check the linker path looking for a file starting
  *** with libpcre and none of the candidates passed a file format test
  *** using a regex pattern. Last file 
  checked: /home/vsankar/Downloads/nmap-4.22SOC7/libpcre/libpcre.vcproj
  
  *** Warning: libtool could not satisfy all declared inter-library
  *** dependencies of module pcre.  Therefore, libtool will create
  *** a static module, that should work as long as the dlopening
  *** application is linked with the -dlopen flag.
  mv .libs/pcre.so pcre.so
  mv: .libs/pcre.so: No such file or directory
  gmake[1]: *** [pcre.so] Error 1
  gmake[1]: Leaving directory `/home/vsankar/Downloads/nmap-4.22SOC7/nselib'
  gmake: *** [nsestdlib] Error 2

This is caused because Libtool doesn't think it's safe to link a static
library (libpcre/libpcre.a) with a shared module (nselib/pcre.so).
Apparently this behavior isn't portable ("we can't support linking
archives into shared libs because it isn't portable"):
  http://osdir.com/ml/gnu.libtool.general/2003-02/msg00150.html
But apparently it works on some systems such as GNU/Linux, which is why
I haven't seen the error before.

...

So here's what I'm recommending: Revert r5485 for now, and get input
from some nselib developers on what should be done to handle this
situation in general. It looks like as long as we're using Libtool to
build NSE modules, all the libraries they depend on have to use Libtool
also.

This is what I have done. This doesn't solve the problem in general of
wanting to use NSE C modules that use static libraries. It's probably
worthwhile to investigate how other applications handle this issue. This
fixes the problem for now.

OpenBSD users, please update from Subversion and try building. I
committed a few other OpenBSD fixes while I was working on this problem.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]