[Python-bugs-list] [ python-Bugs-475951 ] HP-UX: Problem building socket

noreply@sourceforge.net noreply@sourceforge.net
Tue, 06 Nov 2001 04:42:47 -0800


Bugs item #475951, was opened at 2001-10-29 02:15
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=475951&group_id=5470

Category: Build
Group: Platform-specific
Status: Closed
Resolution: Wont Fix
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: HP-UX: Problem building socket

Initial Comment:
On HP-UX 11, I get errors compiling Python 2.1.1 from
source.
It crashes when parsing sys/socket.h
Here's the offending code:
   extern sbsize_t sendfile __((int, int, off_t,
bsize_t, 
                               const struct iovec *,
int));
   extern sbsize_t sendpath __((int, char *, off_t,
bsize_t, 
                               const struct iovec *,
int));

When I switch from gcc to cc (native c compiler) the
socket
library compiles, but many other libs don't.
(sidenote: when using cc, cc is noteably faster than
gcc)


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-11-06 04:42

Message:
Logged In: NO 

gcc --version is now 3.0.1 

The problem however is still there:
building '_socket' extension
gcc -g -O2 -Wall -Wstrict-prototypes -fpic -I.
-I/utmnt/ut/si/dv0216/Python-2.1.1/./Include
-I/usr/local/include -IInclude/ -c
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c -o
build/temp.hp-ux-B.11.11-9000/785-2.1/socketmodule.o
In file included from /usr/include/netdb.h:72,
                 from
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:145:
/usr/include/sys/socket.h:439: parse error before "sendfile"
/usr/include/sys/socket.h:439: parse error before "bsize_t"
/usr/include/sys/socket.h:441: parse error before "sendpath"
/usr/include/sys/socket.h:441: parse error before "bsize_t"
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c: In
function `PySocketSock_accept':
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:795:
warning: passing arg 3 of `accept' from incompatible pointer
type
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c: In
function `PySocketSock_getsockopt':
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:978:
warning: passing arg 5 of `getsockopt' from incompatible
pointer type
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:992:
warning: passing arg 5 of `getsockopt' from incompatible
pointer type
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c: In
function `PySocketSock_getsockname':
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:1188:
warning: passing arg 3 of `getsockname' from incompatible
pointer type
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c: In
function `PySocketSock_getpeername':
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:1218:
warning: passing arg 3 of `getpeername' from incompatible
pointer type
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c: In
function `PySocketSock_recvfrom':
/utmnt/ut/si/dv0216/Python-2.1.1/Modules/socketmodule.c:1376:
warning: passing arg 6 of `recvfrom' from incompatible
pointer type
WARNING: building of extension "_socket" failed: command
'gcc' failed with exit status 1

Here are the offending lines from socket.h
   extern sbsize_t sendfile __((int, int, off_t, bsize_t, 
                               const struct iovec *, int));
   extern sbsize_t sendpath __((int, char *, off_t, bsize_t, 
                               const struct iovec *, int));

However, my medium c skills tell me that the lines are ok.
I cannot offer an explanation why gcc fails here.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-11-01 08:57

Message:
Logged In: YES 
user_id=21627

gcc 2.95 does not support HP-UX 11; this appears to be an
instance of that problem. The __va__list problem is not at
all Python-specific; it occurs in many packages (just search
Google for "HP-UX __va__list"). With such problems, there is
no point into looking further into the problem; just drop
the compiler. If you want to port Python to HP-UX and gcc
2.95, you are on your own.

Notice that gcc 3.0.1 *does* support HP-UX 11; I recommend
to upgrade.


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-11-01 07:41

Message:
Logged In: NO 

gcc version is 2.95.3
HP-UX hp18 B.11.11 U 9000/785 2011589119
both Python 2.1.1 and 2.2b1 do not compile ootb here.

Error messages during compile are 

building '_socket' extension
gcc -g -O3 -Wall -Wstrict-prototypes -fPIC -I.
-I/utmnt/ut/si/dv0216/Python-2.2b1/./Include
-I/usr/local/include -IInclude/ -c
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/socketmodule.c -o
build/temp.hp-ux-B.11.11-9000/785-2.2/socketmodule.o
In file included from
/utmnt/ut/si/dv0216/Python-2.2b1/Include/Python.h:42,
                 from
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/socketmodule.c:77:
/opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/stdio.h:30:
warning: `__va__list' redefined
/usr/include/sys/stdsyms.h:422: warning: this is the
location of the previous definition
In file included from
/utmnt/ut/si/dv0216/Python-2.2b1/Include/Python.h:47,
                 from
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/socketmodule.c:77:
/opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/string.h:26:
warning: `__va__list' redefined
/opt/gcc/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.95.3/include/stdio.h:30:
warning: this is the location of the previous definition
In file included from /usr/include/netdb.h:72,
                 from
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/socketmodule.c:152:
/usr/include/sys/socket.h:439: parse error before `sendfile'
/usr/include/sys/socket.h:439: parse error before `bsize_t'
/usr/include/sys/socket.h:440: warning: data definition has
no type or storage class
/usr/include/sys/socket.h:441: parse error before `sendpath'
/usr/include/sys/socket.h:441: parse error before `bsize_t'
/usr/include/sys/socket.h:442: warning: data definition has
no type or storage class
/usr/include/sys/socket.h:456: parse error before
`__sendfile64'
/usr/include/sys/socket.h:456: parse error before `bsize_t'
/usr/include/sys/socket.h:456: warning: data definition has
no type or storage class
/usr/include/sys/socket.h:457: parse error before
`__sendpath64'
/usr/include/sys/socket.h:457: parse error before `bsize_t'
/usr/include/sys/socket.h:457: warning: data definition has
no type or storage class
/usr/include/sys/socket.h:459: parse error before `sendfile'
/usr/include/sys/socket.h:459: warning: function declaration
isn't a prototype
/usr/include/sys/socket.h: In function `sendfile':
/usr/include/sys/socket.h:459: parse error before `bsize_t'
/usr/include/sys/socket.h: At top level:
/usr/include/sys/socket.h:460: parse error before `sendpath'
/usr/include/sys/socket.h:460: warning: function declaration
isn't a prototype
/usr/include/sys/socket.h: In function `sendpath':
/usr/include/sys/socket.h:460: parse error before `bsize_t'
In file included from
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/socketmodule.c:238:
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c: At
top level:
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:203:
warning: function declaration isn't a prototype
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:212:
warning: function declaration isn't a prototype
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c: In
function `freeaddrinfo':
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:219:
warning: implicit declaration of function `free'
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c: In
function `str_isnumber':
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:231:
warning: subscript has type `char'
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c: In
function `getaddrinfo':
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:345:
warning: implicit declaration of function `atoi'
/utmnt/ut/si/dv0216/Python-2.2b1/Modules/getaddrinfo.c:396:
warning: implicit declaration of function `malloc'
WARNING: building of extension "_socket" failed: command
'gcc' failed with exit status 1

I now thought that since the errors happen in a system
header that compiles with
cc and not gcc, why not copy <sys/socket.h> to "socket.h"
and delete the two offending lines. 
However, as you see, <sys/socket.h> is still included (why
?).

Another option is using cc just for this library, but I'm
not sure, that the object files are compatible. Using cc
alone creates a lot of non-working modules, although it is
in (extended) ANSI mode.

I also tried the HP Porting centre (http://hpux.asknet.de)
but the Python 2.1 package there -just like mine- does crash
on importing socket (too with 2.2b1)

hp18: Python-2.2b1 % ./python
Python 2.2b1 (#4, Nov  1 2001, 16:36:54) [C] on hp-uxB
Type "help", "copyright", "credits" or "license" for more
information.
>>> import socket
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/utmnt/ut/si/dv0216/Python-2.2b1/Lib/socket.py",
line 41, in ?
    from _socket import *
ImportError: No module named _socket
>>> 


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-10-30 00:56

Message:
Logged In: YES 
user_id=21627

It would be helpful if you would provide all details in a 
report also. When you say "it crashes", did you really 
mean "it crashes" (i.e. with a core dump, machine reboot, 
or the like)?
If the compiler merely rejected the code, it would be good 
to see what the error message was.

Please also report version numbers: HP-UX version, gcc 
version, etc. Are you sure you are using a gcc built for 
your OS version? If the gcc doesn't get prototypes right, 
this often comes from having fixincluded header files of a 
different OS version.


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-29 04:59

Message:
Logged In: YES 
user_id=6380

Please try again with Python 2.2b1 (http://python.org/2.2/).
We've done a lot of work and we've got at least one report
that it now works out of the box on HP-UX 11.  I'd like to
hear if that solves your problems (and if 2.2b1 builds with
either compiler).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=475951&group_id=5470