Bug 229 - Compilation on Solaris 10 using Sun Studio
Compilation on Solaris 10 using Sun Studio
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.1.1
Sun other
: P2 normal
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-12 22:39 CET by Måns Nilsson
Modified: 2009-01-15 12:04 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Måns Nilsson 2009-01-12 22:39:30 CET
building on Solaris using Suns vastly better compiler requires a number of things.. 

1. CFLAGS=-xc99 

The configure script tries to figure out how to tell the compiler that C99 is needed, but fails, because cc is not gcc. The option to cc is "-xc99". Reference: 
http://docs.sun.com/app/docs/doc/819-5265/bjapp?a=view

2. LDFLAGS='-lsocket -lnsl'. For building network apps on Solaris, this is almost always needed. Here, too. 

3. I'm at the moment struggling with util/netevent.c, which refuses my attempts: 

# gmake ./libtool --tag=CC --mode=compile /opt/SUNWspro/bin/cc -I. -I.  -I/usr/local/ssl/include -I/opt/local/include -DHAVE_CONFIG_H -xc99 -g -O2 -xO4 -xtarget=generic -D_REENTRANT  -c util/netevent.c -o build/util/netevent.lo
 /opt/SUNWspro/bin/cc -I. -I. -I/usr/local/ssl/include -I/opt/local/include -DHAVE_CONFIG_H -xc99 -g -O2 -xO4 -xtarget=generic -D_REENTRANT -c util/netevent.c  -KPIC -DPIC -o build/util/.libs/netevent.o
"util/netevent.c", line 327: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
"util/netevent.c", line 331: undefined struct/union member: msg_control
"util/netevent.c", line 331: warning: improper pointer/integer combination: op "="
"util/netevent.c", line 333: undefined struct/union member: msg_controllen
"util/netevent.c", line 335: undefined struct/union member: msg_flags
"util/netevent.c", line 338: warning: implicit function declaration: CMSG_FIRSTHDR
"util/netevent.c", line 338: warning: improper pointer/integer combination: op "="
"util/netevent.c", line 343: warning: implicit function declaration: CMSG_DATA
"util/netevent.c", line 344: warning: improper pointer/integer combination: arg #1
"util/netevent.c", line 357: warning: improper pointer/integer combination: arg #1
"util/netevent.c", line 363: warning: improper pointer/integer combination: arg #1
"util/netevent.c", line 366: improper member use: msg_controllen
"util/netevent.c", line 422: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
"util/netevent.c", line 426: undefined struct/union member: msg_control
"util/netevent.c", line 426: warning: improper pointer/integer combination: op "="
"util/netevent.c", line 428: undefined struct/union member: msg_controllen
"util/netevent.c", line 430: undefined struct/union member: msg_flags
"util/netevent.c", line 443: warning: improper pointer/integer combination: op "="
"util/netevent.c", line 444: warning: implicit function declaration: CMSG_NXTHDR
"util/netevent.c", line 444: warning: improper pointer/integer combination: op "="
"util/netevent.c", line 449: warning: improper pointer/integer combination: arg #2
"util/netevent.c", line 456: warning: improper pointer/integer combination: arg #2
"util/netevent.c", line 838: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
"util/netevent.c", line 840: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
cc: acomp failed for util/netevent.c
gmake: *** [build/util/netevent.lo] Error 1

Some googling on those errors provides something to test from libassuan, so: 
 #including <sys/socket.h> and -Defining "_XPG4_2" (via compiler flags, just testing) gets  a bit further, but: 

# /opt/SUNWspro/bin/cc -I. -I. -I/usr/local/ssl/include -I/opt/local/include -DHAVE_CONFIG_H -xc99 -g -O2 -xO4 -xtarget=generic -D_REENTRANT -D_XPG4_2 -c util/netevent.c  -KPIC -DPIC -o build/util/.libs/netevent.o
"/opt/local/include/ldns/net.h", line 38: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 50: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 61: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 74: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 106: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 114: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 125: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 136: warning: dubious tag declaration: struct sockaddr_storage
"/opt/local/include/ldns/net.h", line 157: warning: dubious tag declaration: struct sockaddr_storage
"./util/netevent.h", line 101: incomplete struct/union/enum sockaddr_storage: addr
cc: acomp failed for util/netevent.c
Comment 1 Derek McUmber 2009-01-13 17:27:50 CET
I have confirmed the same error occurs on Windows under Cygwin and gcc:

$ make
./libtool --tag=CC --mode=compile gcc -I. -I. -Ildns-src/include  -I/usr/include
 -DHAVE_CONFIG_H -g -O2  -c services/listen_dnsport.c -o build/services/listen_d
nsport.lo
 gcc -I. -I. -Ildns-src/include -I/usr/include -DHAVE_CONFIG_H -g -O2 -c service
s/listen_dnsport.c  -DDLL_EXPORT -DPIC -o build/services/.libs/listen_dnsport.o
In file included from ./config.h:563,
                 from ./services/listen_dnsport.h:45,
                 from services/listen_dnsport.c:42:
./compat/fake-rfc2553.h:54: error: redefinition of `struct sockaddr_storage'
In file included from ./services/listen_dnsport.h:46,
                 from services/listen_dnsport.c:42:
./util/netevent.h:114: error: field `v4info' has incomplete type
make: *** [build/services/listen_dnsport.lo] Error 1
Comment 2 Wouter Wijngaards 2009-01-13 17:55:51 CET
On Solaris we currently support gcc.  Maybe sun-cc can be supported, it needs looking into.   For windows, mingw/msys works for me, I have not tried cygwin.

Best regards,   Wouter
Comment 3 Wouter Wijngaards 2009-01-14 15:01:10 CET
Need to change our feature tests to
-xc99 -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE
for solaris (I can reproduce your problem Måns).

the -xc99 helps, thanks.
Comment 4 Wouter Wijngaards 2009-01-15 12:04:46 CET
Fixed in svn trunk r1440. Compiles fine on Solaris with sun studio for me.

cygwin I cannot reproduce but may disappear as well.  I have no cygwin available for testing. Please contact again if problems remain.

Best regards, Wouter