macososx-snow-leopardmacportscairolibrsvg

Linking Macports libraries to XCode application


I'm trying to distribute my app's dependencies with the app.

I've got the macports packages librsvg, boost, and cairo installed 64-bit-only on my Snow Leopard system. When I create an .app bundle of my program, it does not work on machines without macports and the relevant libraries installed because they are not included with the app, which searches for the libraries in /opt.

I have tried the --static flag for static linking, but that caused libcrt0 errors.

What's the best method for linking MacPorts libraries and their dependencies to an OSX application suitable for lone distribution?


Solution

  • You'll want to copy the libraries into your application bundle, using a Copy Files Build Phase. dylibs should be put in the Frameworks directory in the app bundle. You'll also have to add the libraries to your Xcode project.