Saturday, October 15, 2011

Deploy Application on Mac with dylib as private framework

Qt's tool macdeployqt is excellent for automatic deploy qt applications on Mac. But the limitation is that macdeployqt can works only for your custom frameworks. If you have dylib to be deployed, you'll get some trouble. Here is my script to deploy my library DuckCore with DuckCapture:

macdeployqt release/

declare DUCKLIB=libDuckCore.1.dylib
declare DUCKAPP=release/
mkdir -p $DUCKAPP/Contents/Frameworks
cp release/$DUCKLIB $DUCKAPP/Contents/Frameworks/$DUCKLIB
install_name_tool -id @executable_path/../Frameworks/$DUCKLIB $DUCKAPP/Contents/Frameworks/$DUCKLIB
install_name_tool -change $DUCKLIB @executable_path/../Frameworks/$DUCKLIB $DUCKAPP/Contents/MacOS/DuckCapture

The main approach is to use the tool "install_name_tool" for dylib, and you'd better to pay more attention to path. It's easy to make mistakes on path in this script.

In addition for releasing, there is another issue for debugging applications with xcode. You can open a console, and run commands below:

open xcode

You'll get some clues when dylib is missing.

No comments:

Post a Comment