Nmap Development mailing list archives

Re: Anyone try compiling with VS 2010 Express?


From: David Fifield <david () bamsoftware com>
Date: Thu, 4 Nov 2010 20:04:22 -0700

On Tue, Oct 19, 2010 at 10:24:53PM -0400, kx wrote:
It didn't work at first, and I had to make these changes:

\nmap-5.35DC1\nbase\nbase_winunix.h
#define _SYSTEM_ERROR_
#define _HAS_CPP0X 0

I think these are needed due to the new static_assert Declaration support.
http://msdn.microsoft.com/en-us/library/dd465215.aspx

The Output File property for liblua was "$(OutDir)liblua.lib" but
needs the quotes removed to be: $(OutDir)liblua.lib

The "dnet" project uses $(ProjectName) for its TargetName, but then
uses $(OutDir)libdnet-stripped.lib for its Output File, which will
fail. Renaming the project to libdnet-stripped fixes this.

libnetutil needs added as a dependency for the nmap project

After that it built.

Thanks. I followed your instructions and now everything should build
with 2010.

I was wary of the change regarding _SYSTEM_ERROR and _HAS_CPP0X. But I
spent a lot of time and couldn't find a better way. This is the comment
I added to explain what's going on:

/* Winsock defines its own error codes that are analogous to but
   different from those in <errno.h>. The error macros have similar
   names, for example
     EINTR -> WSAEINTR
     ECONNREFUSED -> WSAECONNREFUSED
   But the values are different. The errno codes are small integers,
   while the Winsock codes start at 10000 or so.
   http://msdn.microsoft.com/en-us/library/ms737828(v=VS.85).aspx

   Later in this file there is a block of code that defines the errno
   names to their Winsock equivalents, so that you can write code using
   the errno names only, and have it still work on Windows. However this
   causes some problems that are worked around in the following few
   lines. First, we prohibit the inclusion of <errno.h>, so that the
   only error codes visible are those we explicitly define in this file.
   This will cause a compilation error if someone uses a code we're not
   yet aware of instead of using an incompatible value at runtime.
   Second, because <errno.h> is not defined, the C++0x header
   <system_error> doesn't compile, so we pretend not to have C++0x to
   avoid it. */

I was able to make it build without these defines, by allowing <errno.h>
to be included. But that would allow someone to use an E* error code
that isn't mapped to a WSAE* equivalent in nbase_winunix.h, which would
compile but not run correctly on Windows, and which would be hard to
debug. So I decided that your suggestion was better.

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


Current thread: