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

"Martin v. Löwis" martin at
Sat Dec 4 00:37:43 CET 2004

Michael Ströder wrote:
> 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[INET_ADDRSTRLEN + 1];

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.


More information about the Python-list mailing list