This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix building with SWIG's -c++ option set in setup.py
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: tarek Nosy List: andybuckley, d0b, eric.araujo, fremen, steve.dower, tarek
Priority: normal Keywords: easy, patch

Created on 2006-04-30 10:24 by d0b, last changed 2022-04-11 14:56 by admin. This issue is now closed.

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 (6)
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.
msg386241 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:04
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43299
2021-02-03 18:04:30steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386241

resolution: out of date
stage: test needed -> resolved
2020-11-11 00:37:09iritkatrielsetversions: + Python 3.8, Python 3.9, Python 3.10, - 3rd party, Python 2.7, Python 3.2, Python 3.3, Python 3.4
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