I submitted a bug via the 'Report a Bug' page at:
http://www.opensolaris.org/bug/report.jspa

The bug had the title "A 4 line C program including both unistd.h and sysent.h 
will not compile" but whilst the page reported "Thank you for your bug report" 
or something similar, there was no bug ID given. I can't seem to find it 
anywhere. (I thin the C should have been C++ actually, but I did use C).

FWIW, basically there seems to be a problem with how sethostname is declared in 
some header files. According to the sethostname man page, it is declared in 
unistd.h. That is true on  Solaris Express Developer Edition 9/07 snv_70b X86, 
but it is not true on Solaris 10 update 4 on SPARC. Someone else has reported 
this as bug ID 6438052, but it was supposidly fixed in July, but it is still an 
issue in Solaris 10 update 4.  

Secondly, on Solaris Express Developer Edition 9/07 snv_70b X86 where 
sethostname is defined in the correct header file, it creates a problem if you 
include both unistd.h and sysent.h and try to compile with Sun's C++ compiler, 
as there are multiple conficting definitions. See example program

bash-3.00$ cat test.cc

#include <unistd.h>
#include <sysent.h>
int main() {
}
bash-3.00$ /opt/SUNWspro/bin/CC test.cc
"/opt/SUNWspro/prod/include/CC/sysent.h", line 29: Error: Only one of a set of 
overloaded functions can be extern "C".
1 Error(s) detected.
bash-3.00$ cat /etc/release
                Solaris Express Developer Edition 9/07 snv_70b X86
           Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                            Assembled 30 August 2007
bash-3.00$ /opt/SUNWspro/bin/CC -V
CC: Sun C++ 5.9 SunOS_i386 Build47_dlight 2007/05/22


The same code will build on Solaris 10 update 4 ( Solaris 10 8/07 
s10s_u4wos_12b SPARC) with Sun Studio 12 installed.
--
This message posted from opensolaris.org

Reply via email to