[Python-bugs-list] [ python-Bugs-454030 ] distutils cannot link C++ code with GCC
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 06 Dec 2001 13:47:01 -0800
Bugs item #454030, was opened at 2001-08-21 16:42
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=454030&group_id=5470
Category: None
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Barry Alan Scott (barry-scott)
>Assigned to: Nobody/Anonymous (nobody)
Summary: distutils cannot link C++ code with GCC
Initial Comment:
It is mandatory to link C++ code against -lstdc++ -lm
when creating an extension.
distutils does not do this in 2.1.1
Here is a setup.py for Python CXX that works around
the problem, but it would be better for distutils to
understand enough about C++ to do the right thing.
THen the code for other compilers could be added. But
GCC is important enough to do first.
You can get the CXX sources from
http://sourceforge.net/projects/cxx/
from distutils.core import setup, Extension
if os.name == 'posix':
CXX_libraries = ['stdc++','m']
else:
CXX_libraries = []
setup(name="pycxx_demo", version="1.0",
ext_modules=
[Extension(
"example",
sources = [
"Demo/example.cxx",
"Demo/python.cxx",
"Demo/range.cxx",
"Demo/rangetest.cxx",
"Src/cxx_extensions.cxx",
"Src/cxxextensions.c",
"Src/cxxsupport.cxx",
"Src/IndirectPythonInterface.cxx" ],
include_dirs = [ ".", "Demo" ],
libraries = CXX_libraries
)
]
)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=454030&group_id=5470