Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ajm113

macrumors newbie
Original poster
Jan 16, 2011
13
0
Okay, so I'm ready to deploy my beta limited feature edition of my app and I'm having slight problems bundling up non standard Mac frameworks.

Here is what my project looks like:
screenshot20110318at105e.png


As you can tell the framework "FreeImage.framework" is highlighted red, I temporally removed the framework from the Frameworks folder in the system for testing and I have the frameworks in a copy file already and I created a shell script target, but idk if it's even running or not before I build the Unix Executable.

screenshot20110318at110.png


Encase if you cant read the code to well:
Code:
function relocateLibraryInCurrentApp() {
  install_name_tool -change $1$2 @executable_path/../Frameworks/$2 $CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH
}

relocateLibraryInCurrentApp /usr/local/lib/ libwx_macud_gl-2.8.dylib #note the space
relocateLibraryInCurrentApp /Library/Frameworks/ FreeImage.framework/Versions/A/Foobar #note the space

exit 0

Anyways, what am I missing? I tried using the otool -L "My Unix Executable" and it keeps showing up the default framework paths instead of the paths located in the bundle and I tried using the install_name_tool -change ... directory through the Terminal and it has NO effect on the executable and it shows no error. :(

Can someone point out what I'm missing? Cause if I just run the app bundle without the framework in it's default location in the System it just crashes saying it can't find the framework. This is my first Mac deployment, so I'm not exactly sure what I'm missing cause I'm coming from a .dll background and I have my frameworks in the "Frameworks" folder in the app bundle.

Code:
MyApp.app/Contents/Frameworks
        |
         -> FreeImage.framework
         -> libwx_macud_gl-2.8.dylib

Thanks, Ajm.
 
Last edited:

Detrius

macrumors 68000
Sep 10, 2008
1,623
19
Apex, NC
You're on the right track. You need to change the install name of the framework itself. Set this when you build the framework (it's a build setting in the GUI). Then, when the app is linked to the framework, it'll already be looking in the right place.
 

ajm113

macrumors newbie
Original poster
Jan 16, 2011
13
0
When you mean "build" the framework, you are referring to actually rebuilding the source code of the framework it's self? Cause I'm not sure how to do that exactly with FreeImage since I pretty much just downloaded the .framework that only includes the header files.

Sorry I know I seem really lost but, I'm new to Mac development still coming from a rich Windows development background. :(

Cause it sounds to me: "Recompile an API into a library of something you don't have original source code to."
 
Last edited:

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Perhaps you can put something like this in your script and then inspect that the files exists and the modification date is the when you last built.

Code:
touch /tmp/scripttest

One other thing, dylibs normally go into Contents/MacOS directory next to the executable not the Frameworks directory; them not being frameworks but simple shared libraries (these are the equivalent of DLLs).

These are fixed up using the install_path_tool to have paths like:

Code:
@loader_path/libwx_macud_gl-2.8.dylib
 

ajm113

macrumors newbie
Original poster
Jan 16, 2011
13
0
Hey thanks for your replys!!

Thank you very much it seemed that touch tool really helped me! :)

Awesome my app is ready for deployment, I just need to make a free limited features version of it and it's all set for Windows and Mac!

Thanks again!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.