Nmap Development mailing list archives

Re: nmap doesn't compile on Solaris 9 with Sun Studio Pro


From: Andreas Ericsson <ae () op5 se>
Date: Fri, 15 Dec 2006 10:43:04 +0100

Leo Zhadanovsky wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am trying to compile nmap 4.20 on Solaris 9 with Sun Studio Pro. Here
is my build environment:

PATH="/opt/SUNWspro/bin:${PATH}" \
CC="cc" CXX="CC" CPPFLAGS="-I/usr/local/include" \
LD="/usr/local/gnu/bin/ld" \
LDFLAGS="-L/usr/local/lib -R/usr/local/lib" \
export PATH CC CXX CPPFLAGS LD LDFLAGS

./configure --prefix=/usr/local --with-openssl=/usr/local/ssl

for i in `find . -name '*.cc'`; do mv $i $i.wrong; sed -e 's/__FUNCTION__/__FILE__/g' $i.wrong > $i; done


__FUNCTION__ and __FILE__ are C99 macros that always substitutes to the 
(surprise surprise) function and file (respectively) that they are used 
in. There's also __LINE__, although that doesn't seem to have bitten 
you. I have no idea what C++ standard they appear in.

The easiest way to go about this would probably be to add something 
along the lines of this to a header-file that's included from pretty 
much everywhere:
---%<---%<---
#ifndef __FUNCTION__
# define __FUNCTION__ "__FUNCTION__"
#endif
#ifndef __FILE__
# define __FILE__ "__FILE__"
#endif
---%<---%<---



It compiles, with some warnings and such, but then it dies saying this:

"nmap_dns.cc", line 849: Warning (Anachronism): Formal argument handler of type extern "C" 
void(*)(void*,void*,void*) in call to nsock_connect_udp(void*, void*, extern "C" void(*)(void*,void*,void*), void*, 
sockaddr*, unsigned, unsigned short) is being passed void(*)(void*,void*,void*).
"nmap_dns.cc", line 850: Warning (Anachronism): Formal argument handler of type extern "C" 
void(*)(void*,void*,void*) in call to nsock_read(void*, void*, extern "C" void(*)(void*,void*,void*), int, void*) is 
being passed void(*)(void*,void*,void*).
"nmap_dns.cc", line 1044: Warning: String literal converted to char* in formal argument fname in call to 
parse_etchosts(char*).
8 Warning(s) detected.
ld: fatal: file M: stat failed: No such file or directory
gmake: *** [makefile.dep] Error 1
error: Bad exit status from /var/local/tmp/rpm-tmp.5151 (%build)

How should I go about fixing this?


Seems like Sun Studio Pro doesn't like pure-C functions being passed as 
arguments to C++ functions (or something). I'm not vell-versed enough in 
Sun Studio Pro to give a more detailed analysis, but according to Google 
it appears this problem shows up for more projects than nmap. Any chance 
you can use the gnu tools to build this?

-- 
Andreas Ericsson                   andreas.ericsson () op5 se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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


Current thread: