Bugs item #837046, was opened at 2003-11-06 08:09 Message generated for change (Comment added) made by dlr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: James Bostock (jbostock) Assigned to: Nobody/Anonymous (nobody) Summary: pyport.h redeclares gethostname() if SOLARIS is defined Initial Comment: The file pyport.h contains the lines: #ifdef SOLARIS /* Unchecked */ extern int gethostname(char *, int); #endif However, Solaris already defines gethostname() in /usr/include/unistd.h [I only have access to Solaris 2.6 and 2.8 so I can't vouch for other versions]. This in iteself is not a problem. However, under Python2.3, pyconfig.h defines _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED which cause (indirectly) the following prototype to be selected from unitstd.h: extern int gethostname(char *, size_t); Since size_t is an unsigned char, a compiler error message is generated (both by the native compiler and gcc) saying that the function has been redefined. This means that no python program can be compiled if SOLARIS is #defined. I imagine that the above code from pyport.h is only applicable to an earlier version of Solaris than 2.6, and so should either be removed or qualified somehow. ---------------------------------------------------------------------- Comment By: Daniel L. Rall (dlr) Date: 2005-12-19 21:19 Message: Logged In: YES user_id=6606 I can verify this issue on Solaris 10 (SunOS 5.10). Not only does this code seem unnecessary, but there is no configury nor make magic which _can_ ever set the SOLARIS preprocessor define. If I run 'make' as follows, I can trigger a hard compilation error: [Python-2.4.2]$ make CFLAGS='$(BASECFLAGS) $(OPT) -DSOLARIS=true' ... In file included from ./Include/Python.h:55, from Objects/complexobject.c:8: ./Include/pyport.h:382: error: conflicting types for 'gethostname' /usr/include/unistd.h:319: error: previous declaration of 'gethostname' was here./Include/pyport.h:382: error: conflicting types for 'gethostname' /usr/include/unistd.h:319: error: previous declaration of 'gethostname' was here*** Error code 1 make: Fatal error: Command failed for target `Objects/complexobject.o' I recommend removing this snippet from pyport.h: --- Include/pyport.h (revision 41772) +++ Include/pyport.h (working copy) @@ -372,11 +372,6 @@ in platform-specific #ifdefs. **************************************************************************/ -#ifdef SOLARIS -/* Unchecked */ -extern int gethostname(char *, int); -#endif - #ifdef __BEOS__ /* Unchecked */ /* It's in the libs, but not the headers... - [cjh] */ ---------------------------------------------------------------------- Comment By: James Bostock (jbostock) Date: 2003-11-26 18:43 Message: Logged In: YES user_id=902503 "Since size_t is an unsigned char" should read "Since size_t is an unsigned int". ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com