I’m trying to create an application bundle for a game that uses some libraries I installed using macports. I would like to put the dependencies inside the bundle but am at loss on how to do that.
I’ve compiled the game and tried to use install_name_tool to change the path used so that the executable searches inside the bundle, I get no error but the path doesn’t change. E.g.:
install_name_tool -change libSDL-1.2.0.dylib @executable_path/../Frameworks/libSDL-1.2.0.dylib meandmyshadow
The executable was built using a CMake generated Makefile.
Would XCode be a better option? Is there anything I’m missing from the steps I’m taking?
To answer your specific question about how to use
install_name_tool: if you look at the library linkage of meandmyshadow usingotool -L meandmyshadowit’ll probably look something like this:When you use
install_name_toolto change a reference in the program, you need to use the complete reference. You specified that you wanted to change the referencelibSDL-1.2.0.dylibbut you need to specify the absolute path, e.g./opt/local/lib/libSDL-1.2.0.dylib:As for the bigger question about how to include libraries into an application bundle, you can do it manually as you’re doing above with
install_name_tool, or consider trying dylibbundler which does it for you automatically. You can install it using MacPorts:sudo port install dylibbundler.