Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distutils cannot link C++ code with GCC #35025

Closed
barry-scott mannequin opened this issue Aug 21, 2001 · 6 comments
Closed

distutils cannot link C++ code with GCC #35025

barry-scott mannequin opened this issue Aug 21, 2001 · 6 comments
Labels
stdlib Python modules in the Lib dir

Comments

@barry-scott
Copy link
Mannequin

barry-scott mannequin commented Aug 21, 2001

BPO 454030
Nosy @mwhudson, @gvanrossum, @barry-scott

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2002-11-05.17:04:39.000>
created_at = <Date 2001-08-21.23:42:24.000>
labels = ['library']
title = 'distutils cannot link C++ code with GCC'
updated_at = <Date 2002-11-05.17:04:39.000>
user = 'https://github.com/barry-scott'

bugs.python.org fields:

activity = <Date 2002-11-05.17:04:39.000>
actor = 'niemeyer'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Distutils']
creation = <Date 2001-08-21.23:42:24.000>
creator = 'barry-scott'
dependencies = []
files = []
hgrepos = []
issue_num = 454030
keywords = []
message_count = 6.0
messages = ['6124', '6125', '6126', '6127', '6128', '6129']
nosy_count = 5.0
nosy_names = ['mwh', 'gvanrossum', 'nnorwitz', 'barry-scott', 'niemeyer']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue454030'
versions = []

@barry-scott
Copy link
Mannequin Author

barry-scott mannequin commented Aug 21, 2001

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
			)
		]
	)

@barry-scott barry-scott mannequin closed this as completed Aug 21, 2001
@barry-scott barry-scott mannequin added the stdlib Python modules in the Lib dir label Aug 21, 2001
@barry-scott barry-scott mannequin closed this as completed Aug 21, 2001
@barry-scott barry-scott mannequin added the stdlib Python modules in the Lib dir label Aug 21, 2001
@gvanrossum
Copy link
Member

Logged In: YES
user_id=6380

Nobody at PL understands distutils well enough to do this,
so lowering the priority -- there's no way this will hold up
the release.

@mwhudson
Copy link

Logged In: YES
user_id=6656

Is this the same problem as

[ bpo-413582 ] g++ must be called for c++ extensions

? Not a rhetorical question, I would like to know!

@barry-scott
Copy link
Mannequin Author

barry-scott mannequin commented Jan 27, 2002

Logged In: YES
user_id=28665

Yes using G++ is another way to solve this.

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Nov 2, 2002

Logged In: YES
user_id=33168

Barry, is this still a problem w/2.2.2?

@niemeyer
Copy link
Mannequin

niemeyer mannequin commented Nov 5, 2002

Logged In: YES
user_id=7887

Fixed in bug bpo-413582.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants