classification
Title: Fix building with SWIG's -c++ option set in setup.py
Type: behavior Stage: test needed
Components: Distutils, Distutils2 Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7, 3rd party
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: andybuckley, d0b, eric.araujo, fremen, tarek
Priority: normal Keywords: easy, patch

Created on 2006-04-30 10:24 by d0b, last changed 2014-02-03 18:41 by BreamoreBoy.

Files
File name Uploaded Description Edit
build_ext-swig-c++.patch d0b, 2006-04-30 10:24 Fix building with SWIG's -c++ option set in setup.py review
Messages (5)
msg50147 - (view) Author: dOb (d0b) Date: 2006-04-30 10:24
When the '--swig-opts -c++' command line option is
used, the target extension is changed from .c to .cpp
but when the '-c++' option is passed to an Extension
with the swig_opts keyword argument, the target
extension is not changed. This causes the compiler to
treat the C++ source as C and fail.

With the patch distutils uses the Extension's swig_opts
argument in addition to the command line options to
determine if the target extension should be .c or .cpp.

Here are examples of what arguments get used with the
executables in different situations:

Without -c++
swig.exe -python -Iinclude -o
interface/interface_wrap.c interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tcinterface/interface_wrap.c
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (as command line option)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.cpp interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tpinterface/interface_wrap.cpp
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (in swig_opts in setup.py)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.c interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tcinterface/interface_wrap.c
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj

With -c++ (in swig_opts in setup.py with patch applied)
swig.exe -python -Iinclude -c++ -o
interface/interface_wrap.cpp interface/interface.i
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -Iinclude
-IC:\Python24\include -IC:\Python24\PC
/Tpinterface/interface_wrap.cpp
/Fobuild\temp.win32-2.4\Release\interface/interface_wrap.obj
msg50148 - (view) Author: Mark Howson (fremen) Date: 2007-03-23 13:45
Problem still exists as of 23/03/07 in Python 2.5, patch appears to be correct solution.
msg77887 - (view) Author: Andy Buckley (andybuckley) Date: 2008-12-15 22:32
This works in my current version of distutils (Python 2.5.2, from Ubuntu
Intrepid). Maybe it was fixed and no-one noticed that this bug was
relevant ;)
msg114655 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-22 09:43
Is this still a problem?
msg121407 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-18 01:41
We need to add a test for this behavior, to make sure it is fixed and to prevent regressions.
History
Date User Action Args
2014-02-03 18:41:45BreamoreBoysetnosy: - BreamoreBoy
2013-01-27 01:32:40ezio.melottisetkeywords: + easy
stage: needs patch -> test needed
versions: + Python 3.3, Python 3.4, - Python 3.1
2010-11-18 01:41:53eric.araujosetversions: + 3rd party
nosy: + eric.araujo

messages: + msg121407

components: + Distutils2
2010-08-22 09:43:32BreamoreBoysetassignee: tarek
type: behavior
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.4
nosy: + BreamoreBoy, tarek

messages: + msg114655
stage: needs patch
2008-12-15 22:32:55andybuckleysetnosy: + andybuckley
messages: + msg77887
2006-04-30 10:24:03d0bcreate