Nmap Development mailing list archives

build svn nmap on mswin32 under cygwin


From: jah <jah () zadkiel plus com>
Date: Thu, 29 Nov 2007 03:35:45 +0000

It would be great if instructions for compiling nmap under cygwin on win32 were maintained, I'm sure there are windows users out there who would love to stay abreast of the latest developments in the coolest network tool on earth! I've compiled nmap several times in the past, but lately I've had some issues with the result and not had time to investigate the what and the why. The readily evident problem was a lack of fonts for zenmap, but other than that, I've been unable to take the time to find what else, if anything, was broken. Procrastination is a great thing though, because it gives me a reason to spend a bit of time with nmap...


So, I start off with a virgin svn checkout and make a small change to the nmap/mswin32/makefile:

Prepend "/cygdrive" to the paths for MAKENSIS and VCEXPRESS (lines 1 and 2) so they look like "/cygdrive/c/Program Files/..."

This may be necessary only because I'm not very experienced with cygwin, I don't know.

Then fire-up cygwin shell and cd to nmap/mswin32 (in my case: /cygdrive/c/nmap/mswin32) and "make winbuild" (I had been redirecting the output to a text file "make winbuild > buildlog.log", but I found that any errors don't get redirected to the text file and appear at the commandline which makes it a bugger to work out where the error occurred, so I don't do that anymore)

First issue:
$ make winbuild > nmap_6360_build.log
cp: cannot stat `nselib/*.dll': No such file or directory
make: *** [winbuild] Error 1

I found that "bit.dll" was located in nselib-bin rather than in nselib so nselib-bin.patch (attached for r6362) fixed that for me, but I'd love to know what's gone wrong here...

So having rolled back and started again with the newly modified mswin32/makefile I get something that appears to be an error:
cd ../zenmap && install_scripts/windows/copy_and_compile.bat
Setting installation variables...
Writing output to win_install.log
Removing old compilation...
The system cannot find the file specified.

On line 35 of zenmap/install_scripts/windows/copy_and_compile.bat:
rd %DistDir% /s /q > %Output%

%DistDir% refers to nmap/zenmap/dist/ which is created during compile and isn't present in a virgin svn checkout so I assume that this is not anything to worry about. However, being a bit of a pedant, I decided to prepend "IF EXIST %DistDir% " to line 35 and made sure that a) there was no longer a complaint if the dir was not present and b) the dir was removed if it was present (copy_compile.patch attached for r6362).

At this point, as far as the output from cygwin is concerned, everything looks good except for:
Compiling using py2exe...
warning: py2exe: Version Info will not be included:
 could not parse version number '4.23RC3'

The version number is in nmap/zenmap/umitCore/Version.py as "4.23RC3" and I assume that this is nothing to worry about either. I imagine that when the RC is removed for a proper release, it will again be parsable. Having said that, and being someone who likes to fiddle, as well as being a pedant, I thought I might see what happened if I used "4.23.0.3" instead. Gratifyingly, the version number seemed to be parsed OK this time. I won't, however, presume to offer a patch.

But after all of this, do I have a successful compile?  Do I fcuk!
In the attached *aaaarghh.zip* is *zen-sshot.jpg* so you can see what I mean about the zenmap fonts not being there, *cyg-out.txt* output from cygwin and *zenmap-win_install.log* which I'd be most grateful if somebody, anybody (everybody, scream) would cast their eye upon.

Additionally, here's some anomalies from the Visual C++ BuildLogs:

In nbase:
Compiling...
strcasecmp.c
nbase_time.c
nbase_str.c
.\nbase_str.c(208) : warning C4244: 'return' : conversion from '__w64 int' to 'int', possible loss of data
nbase_rnd.c
nbase_misc.c
nbase_memalloc.c
inet_pton.c
inet_ntop.c
getopt.c
Generating Code...
Creating library...
Results Build log was saved at "file://c:\nmap\nbase\Release\BuildLog.htm"
nbase - 0 error(s), 1 warning(s)

In nselib-bin:
Compiling...
bit.c
Compiling manifest to resources...
Linking...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
  Creating library .\bit.lib and object .\bit.exp
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Embedding manifest...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
  Creating library .\bit.lib and object .\bit.exp
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Performing Post-Build Event...
C:\nmap\mswin32\..\nselib-bin\bit.dll
1 File(s) copied
Results Build log was saved at "file://c:\nmap\nselib-bin\Release\BuildLog.htm"
nse_bitlib - 0 error(s), 4 warning(s)

In nsock:
Compiling...
nsock_write.c
nsock_utils.c
nsock_timers.c
nsock_read.c
nsock_pool.c
nsock_pcap.c
nsock_iod.c
nsock_event.c
nsock_core.c
nsock_connect.c
.\src\nsock_connect.c(106) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
netutils.c
gh_list.c
filespace.c
error.c
Generating Code...
Creating library...
Results Build log was saved at "file://c:\nmap\nsock\Release\BuildLog.htm"
nsock - 0 error(s), 1 warning(s)


jah

Attachment: aaaarghh.zip
Description:

Index: Makefile
===================================================================
--- Makefile    (revision 6362)
+++ Makefile    (working copy)
@@ -5,7 +5,7 @@
 COMMA_VERSION=$(shell echo $(NMAP_NUM_VERSION) | tr '.' ',')
 LOGLOC=c:nmapbuild.log
 NSE_FILES = scripts/script.db scripts/*.nse
-NSE_LIB_FILES = nselib/*.lua nselib/*.dll
+NSE_LIB_FILES = nselib/*.lua nselib-bin/*.dll
 
 winbuild:
 # VCExpress.exe is devenv.com with the commercial Visual Studio suite instead of VC++ Express
Index: copy_and_compile.bat
===================================================================
--- copy_and_compile.bat        (revision 6362)
+++ copy_and_compile.bat        (working copy)
@@ -32,7 +32,7 @@
 echo Writing output to %Output%
 
 echo Removing old compilation...
-rd %DistDir% /s /q > %Output%
+IF EXIST %DistDir% rd %DistDir% /s /q > %Output%
 
 echo Creating dist and dist\share directories...
 mkdir %DistDir%\share

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

Current thread: