Compile against libraries installed with MacPorts

MacPorts installs packages in a non unix-standard location. This can cause problems when trying to compile other software against these packages because they aren’t found by the configure script.

I experienced that problem when trying to compile SDL_image, which depends on libraries such as libpng. I had to configure with the following flags :

./configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib"

which indicates in which folders the libraries installed with MacPorts were installed.

4 thoughts on “Compile against libraries installed with MacPorts

  1. Brian Morris

    Thanks for your help here. I am trying to compile a upstreamed patched package from git source against macports and having had trouble building against Macports for dependencies — your suggestion eliminates some of it.

    However I am still not getting access to the python pyGTK library. If I were good with python maybe this would be clear or maybe not. it is for the header files to build against. Any clear ideas what I should add ?

    I am building gimp2.7 (w/ proposed gimp-painter patches) on 10.6

  2. Brian Morris

    Update – Although setting the python variables shown below, but in the shell, i can run the pygtk demos just fine, the following does not work:

    ./configure “CPPFLAGS=-I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/share/pygtk/2.0/defs” “LDFLAGS=-L/opt/local/lib” “PYTHONHOME=/opt/local/Library/Frameworks/Python.framework/Versions/2.6” “PYTHONPATH=/opt/local/lib/python2.6”

    but produces

    checking for a Python interpreter with version >= 2.5.0… python
    checking for python… /opt/local/bin/python
    checking for python version… 2.6
    checking for python platform… darwin
    checking for python script directory… ${prefix}/lib/python2.6/site-packages
    checking for python extension module directory… ${exec_prefix}/lib/python2.6/site-packages
    checking for headers required to compile python extensions… found
    checking for PYGTK… no
    configure: error:
    *** Could not find PyGTK 2.10.4 or newer.
    *** Please install it, or skip building the python scripting extension by
    *** passing –disable-python to configure (but then you will not be able
    *** to use scripts for GIMP that are written in Python).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.