[ python-Bugs-832159 ] C++ extensions using SWIG and MinGW

SourceForge.net noreply at sourceforge.net
Wed Feb 11 18:18:04 EST 2004


Bugs item #832159, was opened at 2003-10-28 23:27
Message generated for change (Comment added) made by woodsplitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=832159&group_id=5470

Category: Distutils
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Allen Chan (alydar)
Assigned to: Nobody/Anonymous (nobody)
Summary: C++ extensions using SWIG and MinGW

Initial Comment:
Using the following three files:

-- begin files -----
/* hello.cpp */
#include <stdio.h>
void hello()
{
    printf("hello world\n");
}
------------------
/* hello.i */
%module hello
extern void hello();
------------------
# setup.py
import distutils
from distutils.core import setup, Extension

setup(name = "Hello World",
        version = "1.0",
        ext_modules = [Extension("_hello",
            ["hello.i","hello.cpp"])])
-- end files -------


executing the command:
 "python setup.py build_ext -cmingw32 --swig-cpp -f"
creates the following output:

-- begin output --
running build_ext
building '_hello' extension
swigging hello.i to hello_wrap.cpp
...
[ snipped ]
...
cc -mno-cygwin -shared -s build\temp.win32-2.3
\Release\hello_wrap.o build\temp.w
in32-2.3\Release\hello.o build\temp.win32-2.3
\Release\_hello.def -LC:\p\Python23
\libs -LC:\p\Python23\PCBuild -lpython23 -o 
build\lib.win32-2.3\_hello.pyd
error: command 'cc' failed: No such file or directory
-- end output --

It appears that unixccompiler.py defaults compiler_cxx 
to use "cc" and then uses it for the linking, and 
cygwinccompiler.py does not override the compiler_cxx 
entry.  If the self.set_executable() call in the __init__*( 
function of the Mingw32Compiler class also sets 
compiler_cxx to use "g++", then the extension build will 
work.



----------------------------------------------------------------------

Comment By: David Rushby (woodsplitter)
Date: 2004-02-11 18:18

Message:
Logged In: YES 
user_id=414645

I also encountered this bug while trying to build a C++
extension with no SWIG involved.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=832159&group_id=5470



More information about the Python-bugs-list mailing list