Question

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?

Was it helpful?

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.

OTHER TIPS

Try using py2app to create a stand-alone app.

I had to just do this for jsoncpp. What I did was I went to linker settings under the project > Build Phases > Link Binary With Libraries then used the add other to go to my library's path and add the library from the folder which would be under opt/local/lib in the default setup for macport linker settings

getting the header files was a bit more complicated. In this case I had ended up going to usr/Include finding the file/folder with the headers, copying it into my project and in the cpp file I added the include line with quotation marks ("")

e.g., moved /usr/Include/json directory into the RestTemplate Project folder using copy. then added to main.cpp

#include "json/json.h"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top