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

Robin robince at gmail.com
Fri Dec 18 16:51:58 CET 2009


I have a problem with using python-config --ldflags on a Mac.

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

But if I build a C file with python embedded, the above linker flags
result it in it embedding the system python. Obviously the -lpython2.5
is picking up the system one in preference to the one on the -L path.

So far the only way I've got it to build against the one I want is with
LDFLAGS=-F/ -framework Python
(as well as -undefined dynamic_lookup -bundle, but I don't think
that's relevant to the problem)

However, I am looking for a way to determine this for users to
install. Shouldn't python-config return the right thing?

Is there something simple to add to LDFLAGS to allow -lpython2.5 to
choose the right one so I can continue to use python-config (ie only
search the path specified with -L) - this would allow the
python-config output to work correctly for both the system python or
user installed python.

Or is there another way to determine (in an external build tool like
make) the correct linker flags for the python in a users path (ie -F/
-framework Python).

Any advice appreciated,



More information about the Pythonmac-SIG mailing list