Opened 19 years ago

Closed 19 years ago

#6117 closed defect (duplicate)

BUG: Extension building problems with Python distutils

Reported by: artur_spruce@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.0
Keywords: Cc:
Port:

Description

There are the following problems with building a Python extension using distutils:

  1. By default, distutils from the darwinports install of Python doesn't look for headers and libraries in

the darwinports installation directory. (I don't know if that is correct or not.)

  1. With "include_dirs = opt/local/include?" and "library_dirs = opt/local/lib?" in the extension

definition, the linker attempts to reference the standard Python installation libraries:

$ python setup.py build running build running build_ext building 'times' extension creating build/temp.darwin-7.9.0-Power_Macintosh-2.4 gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -fno- common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/opt/local/ Library/Frameworks/Python.framework/Versions/2.4/include/python2.4 -I/opt/local/include/ python2.4 -c times.cpp -o build/temp.darwin-7.9.0-Power_Macintosh-2.4/times.o c++ -bundle -undefined dynamic_lookup build/temp.darwin-7.9.0-Power_Macintosh-2.4/times.o -L/ opt/local/lib -lboost_python -o build/lib.darwin-7.9.0-Power_Macintosh-2.4/times.so ld: build/temp.darwin-7.9.0-Power_Macintosh-2.4/times.o illegal reference to symbol: _PyFloat_FromDouble defined in indirectly referenced dynamic library /System/Library/Frameworks/ Python.framework/Versions/2.3/Python error: command 'c++' failed with exit status 1

Attachments (2)

spammodule.c (500 bytes) - added by artur_spruce@… 19 years ago.
Test extension module - C source
setup.py (465 bytes) - added by artur_spruce@… 19 years ago.
Test extension module - build script

Download all attachments as: .zip

Change History (4)

Changed 19 years ago by artur_spruce@…

Attachment: spammodule.c added

Test extension module - C source

Changed 19 years ago by artur_spruce@…

Attachment: setup.py added

Test extension module - build script

comment:1 Changed 19 years ago by artur_spruce@…

This seems to be a problem somehow related to bug #6116. Apparently, the libboost_python.dylib library is built incorrectly.

I built a simple extension module based on the "Extending and Embedding..." manual for Python. Please see the attached sources. It builds and works correctly. If you uncomment the "libraries" and "library_dirs" parameters, you get a linking error like the one above.

comment:2 Changed 19 years ago by mww@…

Resolution: duplicate
Status: newclosed
Summary: Extension building problems with Python distutilsBUG: Extension building problems with Python distutils

* This bug has been marked as a duplicate of 6116 *

Note: See TracTickets for help on using tickets.