Python 2.3 distutils with Mingw C++

Discussion in 'Python' started by Andrew Gregory, Jul 30, 2003.

  1. In Python 2.2, I compiled some C++ code on Windows (MinGW compiler) to
    create an extension using distutils and the following setup.py file:

    from distutils.core import setup, Extension
    setup (name = "_pysimple",
    version = "1.0",
    maintainer = "AG",
    maintainer_email = "",
    description = "Sample Python C++ DLL",
    ext_modules = [Extension('_pysimple',

    extra_compile_args=['-O2','-march=i586','-malign-double'],
    extra_link_args=['-mthread'],
    library_dirs=['C:\\mingw\\lib'],
    libraries=['supc++'], # if using iostreams etc.
    use stdc++
    sources=['pysimple_wrap.cxx'])])

    Provided that certain C++ features such as templates were not used,
    this would build ok using the gcc compiler (not g++), as supc++ is
    linked to.
    Command used is: python setup.py build --compiler=mingw32

    In Python 2.3, distutils recognises the .cxx extension as C++ and
    tries to compile with
    cc -mno-cygwin -shared etc.
    resulting in "cc not found" error message. It should compile with
    c:\mingw\bin\gcc -mno-cygwin -shared etc.
    or *much* better
    c:\mingw\bin\g++ -mno-cygwin -shared etc.

    The quick fix is to copy the old distutils subdirectory from Python22
    into Python23.

    Andrew.
     
    Andrew Gregory, Jul 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam Smith
    Replies:
    0
    Views:
    1,199
    Sam Smith
    Oct 18, 2004
  2. timw.google
    Replies:
    1
    Views:
    547
    Serge Orlov
    May 11, 2006
  3. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,327
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
  4. xeno fears
    Replies:
    1
    Views:
    508
    Martin v. Löwis
    Oct 4, 2009
  5. Andrej Mitrovic

    Python distutils build problems with MinGW

    Andrej Mitrovic, Feb 1, 2010, in forum: Python
    Replies:
    6
    Views:
    3,531
    Andrej Mitrovic
    Feb 1, 2010
Loading...

Share This Page