472,976 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 software developers and data experts.

Compiling python extension on amd64 for 32 bit

After switching my development environment to 64 bit I've got a problem with
a python extension for a 32 bit application. Compiling the app under Linux
results in the following error:

g++ -m32 -Wall -g -O2 -I. -Idb -DPYTHON=25 -o mappy.o -c mappy.cpp
In file included from /usr/include/python2.5/Python.h:57,
from mappy.cpp:29:
/usr/include/python2.5/pyport.h:732:2: error: #error "LONG_BIT definition
appears wrong for platform (bad gcc/glibc config?)."

My gcc is:

Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man
--libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.1.2
--enable-ssp --disable-libssp
--disable-libgcj --with-slibdir=/lib64
--with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --program-suffix=-4.1
--enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)

So I've checked this magic LONG_BIT define:

#:/tmp cat t.c
#include <stdio.h>
#include <bits/xopen_lim.h>

int main()
{
printf("%d\n",sizeof(long));
printf("%d\n",LONG_BIT);
return 0;
}
#:/tmp gcc t.c
#:/tmp ./a.out
8
64
#:/tmp gcc -m32 t.c
#:/tmp ./a.out
4
32

Ok, thats fine. So why is python complaining? Or even more interesting, what
do I have to do to compile the code?

Mathias
May 25 '07 #1
3 2987
Mathias Waack wrote:
After switching my development environment to 64 bit I've got a problem with
a python extension for a 32 bit application.
{...}
Ok, thats fine. So why is python complaining? Or even more interesting, what
do I have to do to compile the code?
Is the Python your toolchain is referencing 32 or 64 bit? Based on what
I can see in pyport.h, I'd guess that you're finding a 64 bit Python (ie
SIZEOF_LONG == 8).

--
-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: an*****@bullseye.apana.org.au (pref) | Snail: PO Box 370
an*****@pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
May 25 '07 #2
Andrew MacIntyre wrote:
Mathias Waack wrote:
>After switching my development environment to 64 bit I've got a
problem with a python extension for a 32 bit application.

{...}
>Ok, thats fine. So why is python complaining? Or even more
interesting, what do I have to do to compile the code?

Is the Python your toolchain is referencing 32 or 64 bit? Based on
what I can see in pyport.h, I'd guess that you're finding a 64 bit
Python (ie SIZEOF_LONG == 8).
There is no such thing as "the Python". A biarch environment offers
both the 32 bit and the 64 bit versions of each library. And unique
headers, because its assumed that the headers are independent of the
architecture. Because of the -m32 Flag the pyport.h is used within a
32 bit env.

Mathias
May 26 '07 #3
Mathias Waack wrote:
Andrew MacIntyre wrote:
>Mathias Waack wrote:
>>After switching my development environment to 64 bit I've got a
problem with a python extension for a 32 bit application.
{...}
>>Ok, thats fine. So why is python complaining? Or even more
interesting, what do I have to do to compile the code?
Is the Python your toolchain is referencing 32 or 64 bit? Based on
what I can see in pyport.h, I'd guess that you're finding a 64 bit
Python (ie SIZEOF_LONG == 8).

There is no such thing as "the Python". A biarch environment offers
both the 32 bit and the 64 bit versions of each library. And unique
headers, because its assumed that the headers are independent of the
architecture. Because of the -m32 Flag the pyport.h is used within a
32 bit env.
Every Python installation has an architecture dependent header
(pyconfig.h), unless a vendor specifically creates a replacement which
neutralises this; that header contains the definition (SIZEOF_LONG) that
triggers your problem.

--
-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: an*****@bullseye.apana.org.au (pref) | Snail: PO Box 370
an*****@pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
May 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are...
6
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with...
0
by: Martijn de Munnik | last post by:
Hi, I'm trying to build/install pysqlite on a Solaris 10 platform. I've got Sun Studio 11 on a AMD 64 platform and got this error. I'm a python newbie and just want to install trac. I've got...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29) Bugs : 965 open ( -9) / 6555 closed (+35) / 7520 total (+26) RFE : 272 open...
11
by: ZMY | last post by:
Dear all, I am a real newbie for both python and QNX, but I am still trying to compile Numeric-24.2 under QNX4.25 with python 2.2. I got following error message: $ sudo python setup.py...
9
by: python | last post by:
Background: I'm going to be processing some raw transaction logs that are 30G in size. As part of this processing I may need to create some very large dictionary structures. I will be running my...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.