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:
gmake: 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\"
-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
*** 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
*** 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: *** [pcre.so] Error 1
gmake: 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"):
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
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.
Sent through the nmap-dev mailing list
Archived at http://SecLists.Org