Python2.4: building '_socket' extension fails with `INET_ADDRSTRLEN'undeclared

  • Thread starter =?ISO-8859-1?Q?Michael_Str=F6der?=
  • Start date
?

=?ISO-8859-1?Q?Michael_Str=F6der?=

HI!

I'm trying to build Python2.4 on a rather old Debian machine. I only
have a shell account there. That's why I'm very limited in my actions.

Building _socket fails (see below) although I tried to use

configure --disable-ipv6

Any clue?

Ciao, Michael.

------------------------------ snip ------------------------------
building '_socket' extension
gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I.
-I/tmp/Python-2.4/./Include -I/user/W3311/local/include
-I/usr/local/include -I/tmp/Python-2.4/Include -I/tmp/Python-2.4 -c
/tmp/Python-2.4/Modules/socketmodule.c -o build/t
emp.linux-i686-2.4/socketmodule.o
/tmp/Python-2.4/Modules/socketmodule.c: In function `socket_inet_ntop':
/tmp/Python-2.4/Modules/socketmodule.c:3350: `INET_ADDRSTRLEN'
undeclared (first use this function)
/tmp/Python-2.4/Modules/socketmodule.c:3350: (Each undeclared identifier
is reported only once
/tmp/Python-2.4/Modules/socketmodule.c:3350: for each function it
appears in.)
/tmp/Python-2.4/Modules/socketmodule.c:3350: size of array `ip' has
non-integer type
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Michael said:
I'm trying to build Python2.4 on a rather old Debian machine. I only
have a shell account there. That's why I'm very limited in my actions.

Building _socket fails (see below) although I tried to use

configure --disable-ipv6

Any clue?

Hard to say, since you don't indicate what clues you are lacking.

In general, when the C compiler gives an error message, it is best
to try to understand the error message. The message reads

socketmodule.c:3350: `INET_ADDRSTRLEN' undeclared (first use this function)

This apparently refers to the line

char ip[INET_ADDRSTRLEN + 1];

which is part of the block

#ifdef ENABLE_IPV6
char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
#else
char ip[INET_ADDRSTRLEN + 1];
#endif

So it appears that on your system, INET_ADDRSTRLEN is not defined,
even if it is supposed to be defined on all systems, regardless
of whether they support IPv6.

Looking at a more recent system in /usr/include, I get

/usr/include$ grep -r ADDRSTRLEN .
../netinet/in.h:#define INET_ADDRSTRLEN 16

This is a clue, I think.

Regards,
Martin
 
?

=?ISO-8859-1?Q?Michael_Str=F6der?=

Martin said:
Hard to say, since you don't indicate what clues you are lacking.

My wanted clue: How to build it without modifying the Python 2.4 sources?
In general, when the C compiler gives an error message, it is best
to try to understand the error message. The message reads

socketmodule.c:3350: `INET_ADDRSTRLEN' undeclared (first use this function)

Thanks for your answer. I do understand the message. I searched some
archives and found similar bug reports in the SF issue tracker which
were for Python 2.3 on Irix and seemed to be fixed.
Looking at a more recent system in /usr/include, I get

/usr/include$ grep -r ADDRSTRLEN .
./netinet/in.h:#define INET_ADDRSTRLEN 16

Note that building Python2.2 worked on the very same machine. I've added

#define INET_ADDRSTRLEN 16

to socketmodule.h and it worked. But I think there might be something
wrong with the autoconf stuff.

I filed bug [ 1078245 ]:
http://sourceforge.net/tracker/index.php?func=detail&aid=1078245&group_id=5470&atid=105470

Ciao, Michael.
 
D

Dieter Maurer

Martin v. Löwis said:
...
So it appears that on your system, INET_ADDRSTRLEN is not defined,
even if it is supposed to be defined on all systems, regardless
of whether they support IPv6.

I have met this problem in older Solaris versions: the Solaris
headers did not define the macro.

I fixed my problem by providing the lacking definition
in the relevant Python header file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top