This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Compile of _socket fails on IRIX with 2.4
Type: Stage:
Components: Extension Modules Versions: Python 2.4
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: akosprime, amcnabb, georg.brandl, rwgk
Priority: normal Keywords:

Created on 2004-12-16 19:21 by akosprime, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (13)
msg23736 - (view) Author: A. Stocker (akosprime) Date: 2004-12-16 19:21
I'm attempting to install Python 2.4 on an SGI Origin
2400 running Irix 6.5.22.  I'm using gcc (3.3) to
compile, and I've tried using three different make
programs (make, smake, and gmake[3.80]) but get the
same error during compilation during the building of
_socket.  There was not a problem building 2.2.1 on
this machine before, we never built 2.3 so I do not
know if the same problem existed.  Here is the relevant
entry from the make:

building '_socket' extension
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -shared
-fno-strict-aliasing -I.
-I/usr/local/src/Python-2.4/./Include -I/us
r/local/include -I/usr/local/src/Python-2.4/Include
-I/usr/local/src/Python-2.4 -c
tmodule.c -o build/temp.irix64-6.5-2.4/socketmodule.o
In file included from
warning: "_SS_ALIGNSIZE" redefined
In file included from
/usr/include/sys/socket.h:246:1: warning: this is the
location of the previous definition
/usr/local/src/Python-2.4/Modules/socketmodule.c: In
function `makeipaddr':
warning: implicit declaration of function `getnameinfo'
error: `NI_NUMERICHOST' undeclared (first use in this
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
/usr/local/src/Python-2.4/Modules/socketmodule.c: In
function `socket_gethostbyname_ex':
warning: implicit declaration of function `gethostbyname_r'
warning: assignment makes pointer from integer without
a cast
/usr/local/src/Python-2.4/Modules/socketmodule.c: In
function `socket_gethostbyaddr':
warning: implicit declaration of function `gethostbyaddr_r'
warning: assignment makes pointer from integer without
a cast
building '_ssl' extension
msg23737 - (view) Author: A. Stocker (akosprime) Date: 2004-12-22 14:19
Logged In: YES 


I decided to force the issue a bit.  Looking through
socketmodule.c I noticed that there was an SGI specific
check that basically disabled loading the addrinfo.h file,
which is where NI_NUMERICHOST is defined.  So I put the
#define statement from the addrinfo.h file directly in the
socketmodule.c file and the compilation with _socket worked.
 However this seems to be a clunky way to deal with the
situation.  Plus I don't know if there's anything else like
this biting me in the butt (for instance '_locale' doesn't
compile either.)
msg23738 - (view) Author: Ralf W. Grosse-Kunstleve (rwgk) Date: 2004-12-30 15:28
Logged In: YES 

Martin v. Loewis asked me to take a look (because of my 
involvement in

I never use gcc under IRIX. Python 2.4 works just fine with 
the native IRIX compilers.

Suggestion to A. Stocker: try to modify the ifdef's in 
socketmodule.c to do the right thing for gcc 3.3. I can test 
your patch on our machines to make sure compilation with the 
native compilers is still OK.
msg23739 - (view) Author: Ralf W. Grosse-Kunstleve (rwgk) Date: 2004-12-30 16:38
Logged In: YES 

FWIW: socketmodule.c included in Python 2.3.4 also fails to 
compile with gcc. Platform: IRIX 6.5.21, gcc 3.3 from SGI's 
freeware distribution.
msg23740 - (view) Author: Ralf W. Grosse-Kunstleve (rwgk) Date: 2004-12-30 16:44
Logged In: YES 

Some additional observations:

socketmodule.c compiles with gcc 3.3 under IRIX 6.5.21 after 
applying this simple-minded patch (relative to Python 2.4):

--- socketmodule.c.orig 2004-11-07 06:24:25.000000000 -
+++ socketmodule.c      2004-12-30 08:06:01.896160200 -
@@ -280,6 +280,10 @@
 #  include "addrinfo.h"
+#if defined(__sgi) && defined(__GNUC__) && !defined
+#  define NI_NUMERICHOST 0x00000002
 int inet_pton(int af, const char *src, void *dst);
 const char *inet_ntop(int af, const void *src, char *dst, 
socklen_t size);

This test works OK:

./python Lib/test/

But this one doesn't:

./python Lib/test/
msg23741 - (view) Author: A. Stocker (akosprime) Date: 2005-01-11 15:48
Logged In: YES 

Okay, I tried compiling using the Irix Mips compilers.  To
do this I did a ./configure --without-gcc.  However when
attempting to make it errored out.  Here is the last section
of the make output:

        ar cr libpython2.4.a Modules/config.o 
Modules/getpath.o  Modules/main.o  Modules/gcmodule.o 
        ar cr libpython2.4.a Modules/threadmodule.o 
Modules/signalmodule.o  Modules/posixmodule.o 
Modules/errnomodule.o  Modules/_sre.o 
Modules/_codecsmodule.o  Modules/zipimport.o 
Modules/symtablemodule.o  Modules/xxsubtype.o
        : libpython2.4.a
         c++   -o python \
                        Modules/python.o \
                        libpython2.4.a -lsocket -lnsl -ldl 
-lpthread -lmpc   -lm  
ld32: WARNING 84 : /usr/lib32/ is not used for
resolving any symbol.
ld32: WARNING 84 : /usr/lib32/ is not used for
resolving any symbol.
ld32: WARNING 84 : /usr/lib32/ is not used for
resolving any symbol.
ld32: FATAL   9  : I/O error (-lmpc): No such file or directory
collect2: ld returned 32 exit status
*** Error code 1 (bu21)

The patch is relatively the same as the hack I tried
earlier, and noted in a follow-up.  But as pointed out
test_socketserver doesn't work ("Use of the `network'
resource not enabled") and _locale doesn't work ("***
WARNING: renaming "_locale" since importing it failed:
1774654:./python: rld: Fatal Error: unresolvable symbol in
build/lib.irix64-6.5-2.4/ libintl_dcgettext")

I'm not sure what else to try in order to get this working.
msg23742 - (view) Author: Ralf W. Grosse-Kunstleve (rwgk) Date: 2005-01-11 17:32
Logged In: YES 

You are missing a system library:


I've never done anything special to install this library but it is 
available on all three IRIX systems that I have access to.

The library is not used to resolve any symbols. I guess you 
could just remove the -lmpc from the link line.
msg23743 - (view) Author: A. Stocker (akosprime) Date: 2005-01-11 17:43
Logged In: YES 


Strange, I DO have that library:

ls -l /usr/lib/libmpc*
-r--r--r--    1 root     sys         1220 Mar 13  2001

It makes no sense to me that the SGI MIPS compilers can't
find a library that's in a default location.  Very peculiar.
 I guess I'm just going to have to give up on getting Python
2.4 working completely under Irix.  We need both network and
_locale to work in order for the various scripts we have in
place to work correctly and I can't get it to compile with gcc.

msg23744 - (view) Author: Ralf W. Grosse-Kunstleve (rwgk) Date: 2005-01-11 17:56
Logged In: YES 

Before giving up I'd try to reset PATH before running configure 
in the Python directory. I had all kinds of trouble with the 
freeware tools on path. Here is what I use:

/usr/bin /usr/bsd /bin /usr/sbin /sbin /etc /usr/etc /usr/bin/X11

Python 2.4 really works under IRIX, incl. the socket module. I 
have it going on three different machines. On one machine 
the timestamp for libmpc.a is from 1998!
msg23745 - (view) Author: Andrew McNabb (amcnabb) Date: 2006-09-19 21:26
Logged In: YES 

I'm having this same problem with Python 2.5.  I checked,
and "/usr/lib/libmpc.a" is present.  I've only tried with
gcc, and I'm getting the exact same errors as above.
msg23746 - (view) Author: Andrew McNabb (amcnabb) Date: 2006-09-19 21:42
Logged In: YES 

When I use the native IRIX cc to compile socketmodule.c in
Python 2.5, I get:

cc -OPT:Olimit=0 -DNDEBUG -O -I.
-I/auto/fsc/awm27/bzr/Python-2.5/./Include -I/fsc/awm27/i
nclude -I./Include -I. -I/usr/local/include
-I/auto/fsc/awm27/bzr/Python-2.5/Include -I/au
to/fsc/awm27/bzr/Python-2.5 -c
/auto/fsc/awm27/bzr/Python-2.5/Modules/socketmodule.c -o bu
cc-1047 cc: WARNING File = /usr/include/sys/param.h, Line = 372
  Macro "MAX" (declared at line 77 of
"/auto/fsc/awm27/bzr/Python-2.5/Modules/socketmodule.c") has an
          incompatible redefinition.

  #define MAX(a,b) (((a)>(b))?(a):(b))

When I commented out the macro definition in socketmodule.c,
I was able to get it to compile (with the IRIX compiler).

It seems to me that --without-gcc should be the default for
IRIX until the gcc problem gets fixed because ./configure is
currently automatically choosing gcc as the compiler when
both are available.  And I'm really not sure why the "#undef
MAX" didn't happen.

Anyway, I hope this is helpful for someone.
msg23747 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-12 08:44
Logged In: YES 

Is anyone going to do something about this, without a
specific report? Anyway, lowering priority.
msg23748 - (view) Author: Andrew McNabb (amcnabb) Date: 2006-10-12 15:37
Logged In: YES 

There IS a specific report.  It won't compile with gcc. 
Either  it needs to be acknowledged that gcc doesn't work
and only allow the IRIX compiler, or else it needs to be
fixed.  There's tons of detail in the many reports in this
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41333
2010-04-03 07:07:38georg.brandlsetstatus: pending -> closed
2009-02-16 17:52:02ajaksu2setstatus: open -> pending
2007-08-23 20:00:48georg.brandlsettitle: Compile of _socket fails on 2.4 -> Compile of _socket fails on IRIX with 2.4
2004-12-16 19:21:51akosprimecreate