473,412 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Python extension on Windows

hi all,
i'm new to python and i'm trying to build a python extension on win98,
written in c++, with cygwin.
but i keep having the same error message, and i didnt't find much
resources on the web about it:
g++ -I/cygdrive/c/python22/include -c demomodule.cpp -o demomodule.o


In file included from /cygdrive/c/python22/include/Python.h:62,
from demomodule.cpp:1:
/cygdrive/c/python22/include/pyport.h:480:2: #error "LONG_BIT definition
appears wrong for platform (bad gcc/glibc config?)."

i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
does anybody has advices about that?
i would rather use cygwin/g++ but i don't know if it's possible or how
to fix this error message.
thanks in advance,
David.

Jul 18 '05 #1
3 4494
David Isal wrote:
hi all,
i'm new to python and i'm trying to build a python extension on win98,
written in c++, with cygwin.^
So we're talking native win32 here, right? You *can* use the Cygwin
toolset to compile native win32 executables and DLLs, but I prefer to
use MINGW for this.
but i keep having the same error message, and i didnt't find much
resources on the web about it:
>g++ -I/cygdrive/c/python22/include -c demomodule.cpp -o demomodule.o
In file included from /cygdrive/c/python22/include/Python.h:62,
from demomodule.cpp:1:
/cygdrive/c/python22/include/pyport.h:480:2: #error "LONG_BIT definition
appears wrong for platform (bad gcc/glibc config?)."


Yep. Use MINGW, the native GCC for win32. That's what I use and where I
could help you with.

If you want to continue using Cygwin to build extension modules, be sure
to have the win32api Cygwin package installed.
i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
That's wrong. See
http://www.python.org/doc/current/in...compilers.html
does anybody has advices about that?


Yes, read the above page :-)

I also recommend to use distutils to compile Python extensions instead
of trying to find out the correct compiler and linker options yourself.
It's the easiest way to compile Python extensions, no matter what the
platform.

See http://aspn.activestate.com/ASPN/Coo...n/Recipe/66509 for a
recipe.

Build it using mingw or Cygwin with this command:

c:/python22/python setup.py build --compiler=mingw32

I'd recommend you try a minimal C extension first before using C++. IIRC
I needed to use something like libraries=["stdc++"] for making a C++
extension with distutils.

-- Gerhard

Jul 18 '05 #2
David Isal <da********@wanadoo.fr> wrote in message news:<be**********@news-reader4.wanadoo.fr>...
i read that it is mandatory to use Micro$oft visual c++ to build any
extensions on windows beacuse it's the same compiler used to build
python for windows.
does anybody has advices about that?
i would rather use cygwin/g++ but i don't know if it's possible or how
to fix this error message.


I don't know what's causing your particular problem (since I got free
MSVC++ from a Microsoft promotional gimmick), but if you download the
python 2.2.3 source and compile that with Cygwin, that should
eliminate any possible incompatibilities between compilers.

The source tarball is at
<http://python.org/ftp/python/2.2.3/Python-2.2.3.tgz>.
Jul 18 '05 #3
thank you guys for your advices ;-)
Jul 18 '05 #4

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

Similar topics

14
by: BOOGIEMAN | last post by:
Well that's it, how do I make Windows Application with Python ??? Is there simple way that works 100% ? How can I rework visual design done in VS 2003 to use it for my python program ?
3
by: Matthias Baas | last post by:
Hi, are there any guidelines about what to do if a Windows extension for Python 2.4 requires the C++ runtime (msvcp71.dll)? If I want to distribute a binary installer of an extension that...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
48
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003 toolkit compiler, and I read a post from Scott...
6
by: JW | last post by:
I have a lousy little Python extension, generated with the generous help of Pyrex. In Linux, things are simple. I compile the extension, link it against some C stuff, and *poof*! everything...
32
by: siggi | last post by:
@Ben Sizer Hi Ben, in January I received your message re Pygame and Python 2.5: As a Python (and programming ) newbie allow me a - certainly naive - question:
15
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.