Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: Libtool, static libraries, and NSE modules
From: Vijay Sankar <vsankar () foretell ca>
Date: Mon, 22 Oct 2007 21:52:06 -0500

On October 22, 2007 02:04:37 pm David Fifield wrote:
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

!DSPAM:1,471d4e284561006886880!

I had the following problem on OpenBSD 4.1.

nmap -sS -P0 -vv 192.168.10.5

OR

nmap -A -P0 -vv 192.168.10.5

gives me:

Starting Nmap 4.22SOC7 ( http://insecure.org ) at 2007-10-22 20:43 CDT
Warning: File ./nmap-services exists, but Nmap is 
using /usr/local/share/nmap/nmap-services for security and consistency 
reasons.  set NMAPDIR=. to give priority to files in your local directory 
(may affect the other data files too).
Initiating ARP Ping Scan at 20:43
Scanning 192.168.10.5 [1 port]
Completed ARP Ping Scan at 20:43, 0.23s elapsed (1 total hosts)
Read data files from: /usr/local/share/nmap
Nmap done: 1 IP address (0 hosts up) scanned in 0.337 seconds
           Raw packets sent: 2 (84B) | Rcvd: 0 (0B)

However the following works

nmap -sT -P0 -vv 192.168.10.5

Starting Nmap 4.22SOC7 ( http://insecure.org ) at 2007-10-22 21:45 CDT
Warning: File ./nmap-services exists, but Nmap is 
using /usr/local/share/nmap/nmap-services for security and consistency 
reasons.  set NMAPDIR=. to give priority to files in your local directory 
(may affect the other data files too).
Initiating Parallel DNS resolution of 1 host. at 21:45
Completed Parallel DNS resolution of 1 host. at 21:45, 6.52s elapsed
Initiating Connect Scan at 21:45
Scanning 192.168.10.5 [1705 ports]
Discovered open port 80/tcp on 192.168.10.5
Discovered open port 443/tcp on 192.168.10.5
Discovered open port 22/tcp on 192.168.10.5
Discovered open port 8080/tcp on 192.168.10.5
Completed Connect Scan at 21:46, 7.39s elapsed (1705 total ports)
Host 192.168.10.5 appears to be up ... good.
Interesting ports on 192.168.10.5:
Not shown: 1701 filtered ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
8080/tcp open  http-proxy

Read data files from: /usr/local/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 13.996 seconds




-- 
Vijay Sankar, M.Eng., P.Eng.
President & CEO
ForeTell Technologies Limited
59 Flamingo Avenue, Winnipeg, MB Canada R3J 0X6
Phone: +1 204 885 9535, E-Mail: vsankar () foretell ca

_______________________________________________
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 ]