[Pythonmac-SIG] python-config ldflags problem on mac

Ronald Oussoren ronaldoussoren at mac.com
Fri Dec 18 17:18:32 CET 2009

On Friday, December 18, 2009, at 04:51PM, "Robin" <robince at gmail.com> wrote:
>I have a problem with using python-config --ldflags on a Mac.

Could you please file a bug on bugs.python.org to ensure that I don't forget to apply a fix for this?

>Using my python.org install:
>robin-mbp:github robince$ which python-config
>robin-mbp:github robince$ python-config --ldflags
>-ldl -lpython2.5

The easiest workaround is to open a terminal window and execute the following commands:

   cd /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config
   ln -s libpython2.5.a libpython2.5.dylib

This will ensure that the OSX linker knows that libpython is a shared library and links to this library. By default the OSX linker searches for a .dylib on the entire linker path and only then looks for .a files.

BTW. python-config doesn't link using '-framework Python' on purpose: it is impossible to select the framework version that way (e.g. link to python 2.5 when you have 2.5, 2.6 and 3.1 installed)


More information about the Pythonmac-SIG mailing list