Author Jason.Vas.Dias
Recipients Jason.Vas.Dias, georg.brandl, r.david.murray
Date 2011-04-30.12:53:51
SpamBayes Score 1.51042e-07
Marked as misclassified No
Message-id <1304168032.39.0.839624293418.issue11946@psf.upfronthosting.co.za>
In-reply-to
Content
So to get python multi-arch working as I expect I'd have to wrap the C header:

   /usr/include/python-2.7/pyconfig.h

with something like:

#ifdef __i386__
#include <python-2.7/32/pyconfig.h>
#else
#include <python-2.7/64/pyconfig.h>
#endif

and that's it ! After building i686-Python-2.7.1,  I can do
"my standard python post-install script" :

$ ABI=64; V=2.7
$ DESTDIR=`pwd`/inst make install
$ cd inst/usr
$ mv lib${ABI}/python${V}/* lib/python$V
$ rmdir lib${ABI}/python-${V}
$ mv lib/python-${V} lib$ABI
$ rmdir lib

And then:
$ cd inst/usr/include/python$V
$ for f in *; do cmp $f /usr/include/python2.7/$f; done
pyconfig.h /usr/include/python2.7/pyconfig.h differ: char 11124, line 393
$ $ diff -U0 pyconfig.h /usr/include/python2.7/pyconfig.h
--- pyconfig.h  2011-04-30 13:34:21.000000000 +0100
+++ /usr/include/python2.7/pyconfig.h   2011-04-30 12:34:23.000000000 +0100
@@ -393 +393 @@
-#define HAVE_LARGEFILE_SUPPORT 1
+/* #undef HAVE_LARGEFILE_SUPPORT */
@@ -989 +989 @@
-#define SIZEOF_LONG 4
+#define SIZEOF_LONG 8
@@ -992 +992 @@
-#define SIZEOF_LONG_DOUBLE 12
+#define SIZEOF_LONG_DOUBLE 16
@@ -1004 +1004 @@
-#define SIZEOF_PTHREAD_T 4
+#define SIZEOF_PTHREAD_T 8
@@ -1010 +1010 @@
-#define SIZEOF_SIZE_T 4
+#define SIZEOF_SIZE_T 8
@@ -1013 +1013 @@
-#define SIZEOF_TIME_T 4
+#define SIZEOF_TIME_T 8
@@ -1016 +1016 @@
-#define SIZEOF_UINTPTR_T 4
+#define SIZEOF_UINTPTR_T 8
@@ -1019 +1019 @@
-#define SIZEOF_VOID_P 4
+#define SIZEOF_VOID_P 8
@@ -1069 +1069 @@
-/* #undef VA_LIST_IS_ARRAY */
+#define VA_LIST_IS_ARRAY 1
@@ -1121 +1121 @@
-#define X87_DOUBLE_ROUNDING 1
+/* #undef X87_DOUBLE_ROUNDING */

so this is the ONLY file that needs to be wrapped to work in a 
multi-arch environment.

BTW, I know you can't use runtime expressions such as 
  'sizeof(char*)' 
in cpp macros, but you CAN get much the same effect by
using cpp 'builtin macros' :
e.g. you could write :

#if __LONG_MAX__ > 0xffffffffU 
#define SIZEOF_LONG 8 /*works until you want to support 128 / 256 bit */
#else
#define SIZEOF_LONG 4 /* guess you don't want to support 16 or 8 bit ?*/
#endif

and then pyconfig.h would not need to be wrapped .
History
Date User Action Args
2011-04-30 12:53:52Jason.Vas.Diassetrecipients: + Jason.Vas.Dias, georg.brandl, r.david.murray
2011-04-30 12:53:52Jason.Vas.Diassetmessageid: <1304168032.39.0.839624293418.issue11946@psf.upfronthosting.co.za>
2011-04-30 12:53:51Jason.Vas.Diaslinkissue11946 messages
2011-04-30 12:53:51Jason.Vas.Diascreate