|
OSX dylib redistribution issues |
thebignic
Member #14,419
July 2012
|
EDIT: This should probably be moved out of the Allegro Development section... Running into a roadblock when running my OSX app on another machine: Dyld Error Message: Library not loaded: @loader_path/liballegro_audio.5.2.dylib Referenced from: /path-to-executable.app/Contents/Frameworks/liballegro_acodec.5.2.5.dylib Reason: image not found
EDIT: I don't currently have an Apple Developer License so I can't re-codesign the freetype library after altering it and I'm a bit reticent to go through the hoops to get a dev license again (and pay the 99 bucks?!) just to try it. I don't mind having to rebuild the allegro libs but seems like getting the dependencies listed correctly is going to be a major headache... Has anyone successfully deployed an Allegro app for OSX lately? How are you bundling dylibs? is install_name_tool going to work for me if I get a dev license to codesign the changes after I fix the paths in all libs? (freetype, etc)
EDIT:
For anyone else new to OSX, hold on to your butts - .dylibs are a nightmare.
You will need an Apple Developer License with a Code Signing Identity setup.
1) move your dylibs somewhere into your Documents folder (so you can read/write to them without too much hassle) 2) examine them with otool to find their install name and dependencies: (install name is listed first, dependencies after) otool -L liballegro_color.5.2.5.dylib 3) remove code signing on each dylib: codesign --remove-signature liballegro_color.5.2.5.dylib 4) update dependencies inside the dylib to point to their new location in Frameworks: install_name_tool -change /Users/bignic/allegro/build/lib/RelWithDebInfo/liballegro.5.2.dylib @executable_path/../Frameworks/liballegro.5.2.5.dylib liballegro_color.5.2.5.dylib 5) change the install path for the dylib itself: install_name_tool -id @executable_path/../Frameworks/liballegro_color.5.2.5.dylib liballegro_color.5.2.5.dylib 6) re-codesign the library: codesign -s "[YOUR APPLE DEVELOPER CODE SIGNING IDENTITY" -v liballegro_color.5.2.5.dylib 7) optional: verify the codesign worked: codesign --verbose=4 --verify liballegro_color.5.2.5.dylib 8) create a run script in XCode to update your EXECUTABLE to point to the new location of the dylib also: install_name_tool -change /usr/local/opt/allegro/lib/liballegro_color.5.2.dylib @executable_path/../Frameworks/liballegro_color.5.2.5.dylib "$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH" 9) make sure the .dylib is copied to Contents/Frameworks directory within your .app package.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
That indeed looks like a nightmare. I'm glad I don't develop on OSX. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
SiegeLord
Member #7,827
October 2006
|
There's a tutorial about how to deal with dylibs (and bundles): https://github.com/liballeg/allegro_wiki/wiki/Creating-macOS-bundles#bundling-the-dylibs It doesn't cover codesigning (what is that for?). "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|