[New-bugs-announce] [issue10201] Fix building of socket module under Solaris

Antoine Pitrou report at bugs.python.org
Tue Oct 26 18:22:49 CEST 2010


New submission from Antoine Pitrou <pitrou at free.fr>:

Sun/Oracle uses the following patch to fix building of the socket module, since on Solaris "netpacket/packet.h" is incompatible with its Linux counterpart. Otherwise, it fails with the following messages:

/home/antoine/py3k/gcc/Modules/socketmodule.c: In function ‘makesockaddr’:
/home/antoine/py3k/gcc/Modules/socketmodule.c:1150: error: ‘struct ifreq’ has no member named ‘ifr_ifindex’
/home/antoine/py3k/gcc/Modules/socketmodule.c:1151: error: ‘SIOCGIFNAME’ undeclared (first use in this function)
/home/antoine/py3k/gcc/Modules/socketmodule.c:1151: error: (Each undeclared identifier is reported only once
/home/antoine/py3k/gcc/Modules/socketmodule.c:1151: error: for each function it appears in.)
/home/antoine/py3k/gcc/Modules/socketmodule.c: In function ‘getsockaddrarg’:
/home/antoine/py3k/gcc/Modules/socketmodule.c:1484: error: ‘SIOCGIFINDEX’ undeclared (first use in this function)
/home/antoine/py3k/gcc/Modules/socketmodule.c:1502: error: ‘struct ifreq’ has no member named ‘ifr_ifindex’
/home/antoine/py3k/gcc/Modules/socketmodule.c: In function ‘PyInit__socket’:
/home/antoine/py3k/gcc/Modules/socketmodule.c:4580: error: ‘PACKET_LOOPBACK’ undeclared (first use in this function)
/home/antoine/py3k/gcc/Modules/socketmodule.c:4581: error: ‘PACKET_FASTROUTE’ undeclared (first use in this function)



$ cat ~/spec-files/patches/Python26-17-netpacket-packet-h.diff 
--- Python-2.6.2/Modules/socketmodule.c.packet	2009-04-01 07:20:48.000000000 +1300
+++ Python-2.6.2/Modules/socketmodule.c	2009-12-01 21:25:04.133257645 +1300
@@ -81,6 +81,14 @@
 
 */
 
+#ifdef HAVE_NETPACKET_PACKET_H
+#ifdef sun
+#define USE_NETPACKET_PACKET_H 0
+#else
+#define USE_NETPACKET_PACKET_H 1
+#endif
+#endif
+
 #ifdef __APPLE__
   /*
    * inet_aton is not available on OSX 10.3, yet we want to use a binary
@@ -1092,7 +1100,7 @@
 		}
 #endif
 
-#ifdef HAVE_NETPACKET_PACKET_H
+#if USE_NETPACKET_PACKET_H
 	case AF_PACKET:
 	{
 		struct sockaddr_ll *a = (struct sockaddr_ll *)addr;
@@ -1382,7 +1390,7 @@
 	}
 #endif
 
-#ifdef HAVE_NETPACKET_PACKET_H
+#if USE_NETPACKET_PACKET_H
 	case AF_PACKET:
 	{
 		struct sockaddr_ll* addr;
@@ -1559,7 +1567,7 @@
 	}
 #endif
 
-#ifdef HAVE_NETPACKET_PACKET_H
+#if USE_NETPACKET_PACKET_H
 	case AF_PACKET:
 	{
 		*len_ret = sizeof (struct sockaddr_ll);
@@ -4575,7 +4583,7 @@
 	PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF");
 #endif
 
-#ifdef HAVE_NETPACKET_PACKET_H
+#if USE_NETPACKET_PACKET_H
 	PyModule_AddIntConstant(m, "AF_PACKET", AF_PACKET);
 	PyModule_AddIntConstant(m, "PF_PACKET", PF_PACKET);
 	PyModule_AddIntConstant(m, "PACKET_HOST", PACKET_HOST);

----------
components: Build
messages: 119615
nosy: jcea, loewis, movement, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Fix building of socket module under Solaris
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10201>
_______________________________________


More information about the New-bugs-announce mailing list