@QuinnTheEskimo,
[quote]
There are lots of potential explanations for that. When you run an app from Terminal it inherits an environment that’s very different from the one it gets from Xcode. And that, in turn, in somewhat different from the one it gets when you double click it in the Finder.
As to which one applies, it’s hard to say without more debugging.
[/quote]
What do I need to do in terms of debugging?
Only one library should be loaded and its from the Bundle.
From the post-install script:
#Copy and relink wxWidgets base library
echo “Copy wxWidgets base library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_baseu-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu-3.2.dylib"
# Copy and relink network library
echo “Copy and relink wxWidgets network library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_baseu_net-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
install_name_tool -change '/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib' '@executable_path/../Frameworks/libwx_baseu-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_net-3.2.dylib"
# Copy and relink XML library
echo “Copy and relink wxWidgets XML library”
cp -f ~/wxWidgets/buildC11/lib/libwx_baseu_xml-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_baseu_xml-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_baseu_xml-3.2.dylib"
# Copy the core library
echo "Copy core library"
cp -f ~/wxWidgets/buildC11/lib/libwx_osx_cocoau_core-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
install_name_tool -id '@rpath/Frameworks/libwx_osx_cocoau_core-3.2.dylib' "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_osx_cocoau_core-3.2.dylib"
# Relink the main binary
echo "Relinking the application"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_net-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu_net-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_baseu_xml-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_baseu_xml-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_osx_cocoau_core-3.2.0.0.0.dylib" @executable_path/../Frameworks/libwx_osx_cocoau_core-3.2.dylib "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/MacOS/dbhandler"
This is what I am doing in terms of finalizing the build.
Do you see anything wrong with this?
Now, in the Xcode project I did add those libraries in the "Build Settings -> Other Linker Flag -> Debug" as follows:
-L/Users/igorkorot/wxWidgets/buildC11/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.2 -lwx_osx_cocoau_html-3.2 -lwx_osx_cocoau_qa-3.2 -lwx_osx_cocoau_adv-3.2 -lwx_osx_cocoau_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -L/Users/igorkorot/dbhandler/dbhandler/Build/Products/Debug
So the linking happens from the place the libraries are built, but then post-install script changes it and relink the code appropriately.
This is from my external GUI library.
If you can help me resolve the library loading double, it would be great.
Thank you.
P.S.: If its too hard - I can give you a link to the GitHub repo to look at the Xcode project.
Let me know.