#16194 closed defect (fixed)
nmap 4.68: upgrade fails (missing include path)
Reported by: | vinc17@… | Owned by: | opendarwin.org@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.6.0 |
Keywords: | nmap build | Cc: | danielluke (Daniel J. Luke) |
Port: |
Description
When upgrading nmap:
[...] Compiling nmap rm -f nmap /usr/bin/g++-4.0 -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -Lnbase -Lnsock/src/ -o nmap main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o osscan2.o output.o scan_engine.o timing.o charpool.o services.o protocols.o nmap_rpc.o portlist.o NmapOps.o TargetGroup.o Target.o FingerPrintResults.o service_scan.o NmapOutputTable.o MACLookup.o nmap_tty.o nmap_dns.o traceroute.o portreasons.o nse_main.o nse_nsock.o nse_init.o nse_fs.o nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_string.o -lnbase -lnsock -lpcre -lpcap -lssl -lcrypto libdnet-stripped/src/.libs/libdnet.a -llua -lm Compiling nse-standard-library ./libtool --tag=CC --silent --mode=compile /usr/bin/gcc-4.0 -no-cpp-precomp -O2 -Wall -fno-strict-aliasing -DHAVE_CONFIG_H -DNMAP_NAME=\"Nmap\" -DNMAP_URL=\"http://nmap.org\" -DNMAP_PLATFORM=\"powerpc-apple-darwin8.11.0\" -DNMAPDATADIR=\"/opt/local/share/nmap\" -DNMAPLIBEXECDIR=\"/opt/local/libexec/nmap\" -c bit.c In file included from bit.c:11: bit.h:6:21: error: lauxlib.h: No such file or directory bit.h:7:17: error: lua.h: No such file or directory [...]
I'd say that the problem is that -I/opt/local/include is missing. Indeed there was no problem in configure. From config.log:
configure:7459: checking lua.h usability configure:7476: /usr/bin/gcc-4.0 -c -O2 -Ilibdnet-stripped/include -I/opt/local/include -I/opt/local/include -I/opt/local/include conftest.c >&5 configure:7482: $? = 0 configure:7496: result: yes configure:7500: checking lua.h presence configure:7515: /usr/bin/cpp-4.0 -Ilibdnet-stripped/include -I/opt/local/include -I/opt/local/include -I/opt/local/include conftest.c configure:7521: $? = 0 configure:7535: result: yes configure:7563: checking for lua.h configure:7571: result: yes
Attachments (4)
Change History (16)
comment:1 Changed 16 years ago by jmroot (Joshua Root)
Cc: | dluke@… added |
---|
comment:2 Changed 16 years ago by danielluke (Daniel J. Luke)
Resolution: | → fixed |
---|---|
Status: | new → closed |
fixed in r38969
comment:3 Changed 16 years ago by vinc17@…
Resolution: | fixed |
---|---|
Status: | closed → reopened |
This doesn't solve the problem. I'll attach a patch that fixes it. The problem was a missing CPPFLAGS in "nselib-bin/Makefile.in".
Also, I don't know why /usr/local/lib is in this file, but the "-rpath /usr/local/lib" is needed, otherwise bit.o is generated instead of bit.so, and the mv fails.
comment:4 Changed 16 years ago by danielluke (Daniel J. Luke)
... but with the change in r38969 nmap shouldn't be building against the lua in ${prefix} so it shouldn't need the patch.
Can you attach the complete configure output with the updated portfile so I can see what's happening on your machine?
comment:5 Changed 16 years ago by vinc17@…
nselib-bin/Makefile.in contains
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) @LUAINCLUDE@ $(CFLAGS) -c bit.c
and I suppose that @LUAINCLUDE@ should be replaced by a -I flag to the liblua directory provided by nmap, but it is replaced by nothing. Indeed nselib-bin/Makefile contains:
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) -c bit.c
Changed 16 years ago by vinc17@…
Attachment: | nselib-bin-config.log added |
---|
comment:6 Changed 16 years ago by vinc17@…
The nselib-bin has its own configure script and config.log, which I've attached. You can see that this configure script doesn't do the right thing:
configure:18398: checking lua.h usability configure:18415: /usr/bin/gcc-4.0 -c -O2 -I/opt/local/include conftest.c >&5 configure:18421: $? = 0 configure:18435: result: yes configure:18439: checking lua.h presence configure:18454: /usr/bin/cpp-4.0 -I/opt/local/include conftest.c configure:18460: $? = 0 configure:18474: result: yes configure:18502: checking for lua.h configure:18509: result: yes
Instead of "-I/opt/local/include", this should be "-I../liblua".
IMHO, it would be simpler to use the lua provided by MacPorts (with my patch to add CPPFLAGS, since this variable is used by the configure scripts).
comment:7 follow-up: 8 Changed 16 years ago by danielluke (Daniel J. Luke)
Honestly, I wish MacPorts never decided to add ${prefix} to CPPFLAGS and LDFLAGS, since we then have to deal with autoconf finding things that we don't intend (like in this case).
I'll take a closer look at this in the next couple of days and get things patched.
Thanks for reporting the issue.
comment:8 Changed 16 years ago by vinc17@…
Replying to dluke@macports.org:
Honestly, I wish MacPorts never decided to add ${prefix} to CPPFLAGS and LDFLAGS, since we then have to deal with autoconf finding things that we don't intend (like in this case).
Adding ${prefix} to CPPFLAGS and LDFLAGS is not a problem. If header files from the source directory need to be used, then a -Isome_dir_relative_to_cwd must be added (whether or not ${prefix} has been added to CPPFLAGS and LDFLAGS). And it just needs to be inserted before CPPFLAGS and LDFLAGS, which almost all software does correctly.
comment:9 Changed 16 years ago by danielluke (Daniel J. Luke)
If ${prefix} weren't added to CPPFLAGS/LDFLAGS then the configure script wouldn't discover the macports-installed lua and would just use the internal one ... you can see this if you remove or deactivate your macports-installed lua and run the build (which works fine).
comment:10 Changed 16 years ago by vinc17@…
But this is the configure script which is broken. When requiring the included lua, LUAINCLUDE needs to be set unconditionally. The bug is here in nselib-bin/configure.ac:
AC_CHECK_HEADER([lua.h],,[AC_MSG_NOTICE(using lua-includefiles provided with nmap);[LUAINCLUDE=-I../liblua/]],)
It should just have been:
LUAINCLUDE=-I../liblua/
Also, without "--with-liblua=included", the build fails, and again this is a bug in nmap because it forgets CPPFLAGS that was used in its configure script.
comment:11 Changed 16 years ago by danielluke (Daniel J. Luke)
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Setting ac_cv_header_lua_h causes the nselib-bin configure to set LUAINCLUDE to use the nmap-supplied lua.
The build should work now with or without MacPorts lua installed.
This only happens when the lua port is active (it's not listed as a dependency of nmap). So it looks like configure is finding the lua in ${prefix} but build is not. I guess either lua should be added as a dependency and nmap should be taught where to find it, or it should be made to always use its included lua.