I’ve been struggling a bit to create a framework file to use in an air native extension on OSX. The issue was that I was using 3rd party dylib libraries (intel building blocks), which aren’t normally installed on somebody’s computer. The framework compiled and everything, but for some reason the application crashed when using the native extension.
When air loaded the native extension, it could no longer find the necessary dylib files. Solution was:
- add a copy files phase to your build phases, which should copy your dylib file to the Resources directory of your framework
- after compilation, open up a terminal window and navigate to your build folder. Use the otool -L command to get a listing of the linked libraries:
otool -L HelloThreadsAndUSB.framework/HelloThreadsAndUSB |
Output is something like this:
HelloThreadsAndUSB: /Library/Frameworks/HelloThreadsAndUSB.framework/Versions/A/HelloThreadsAndUSB (compatibility version 1.0.0, current version 1.0.0) @rpath/Adobe AIR.framework/Versions/1.0/Adobe AIR (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0) libtbb.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) |
In my case, the libtbb.dylib file could not be found when the application launched. You need to change the lookup path with the install_name_tool command:
install_name_tool -change libtbb.dylib @loader_path/Resources/libtbb.dylib HelloThreadsAndUSB.framework/HelloThreadsAndUSB |
When you type in the otool command again, you should see the adjusted path:
HelloThreadsAndUSB: /Library/Frameworks/HelloThreadsAndUSB.framework/Versions/A/HelloThreadsAndUSB (compatibility version 1.0.0, current version 1.0.0) @rpath/Adobe AIR.framework/Versions/1.0/Adobe AIR (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0) @loader_path/Resources/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) |
Now you should be able to use this framework in your air native extension :-)
(Note: I tried the other options @executable_path and @rpath, but those didn’t do the trick)

I haven’t had much luck with this. No matter what I set the paths to, the AIR app always seems to be looking for link satisfaction in the Current Working Directory of wherever I ran the app from.
You have your 3rd party libraries in a structure like this, no?
YourApp.app/Contents/Resources/META-INF/AIR/extensions/YourANE/META-INF/ANE/MacOS-x86/YourANE.framework/YourANE (a dylib)
YourApp.app/Contents/Resources/META-INF/AIR/extensions/YourANE/META-INF/ANE/MacOS-x86/YourANE.framework/Resources/3rdparty.dylib
I have my framework library set to have its external name as @loader_path/Resources/3rdparty.dylib, but it doesn’t seem to affect anything. I can tell by running the application from inside and outside the Resources folder that it is still looking only in the Current Working Directory for the 3rdparty.dylib.
I tried setting dylib names on my executable itself. Did you have any problems like this or did it just work? Maybe I’m not compiling my ANE framework library properly. GCC is producing a simple dylib (YourANE.dylib) which I am renaming and putting in YourANE.famework/YourANE
Maybe I am missing something in the linker. Ugh.
Your home is valueble to perform. Τhanks!…
I think the admin of this web site is in fact working hard for his web page, as here every material
is quality based stuff.
Yesterday, while I was at work, my sister stole my iphone and tested to see if it can survive a
forty foot drop, just so she can be a youtube sensation.
My iPad is now broken and she has 83 views. I know this is entirely off topic but
I had to share it with someone!
Everything is very open with a clear description of the challenges.
It was really informative. Your site is very
useful. Many thanks for sharing!
Thanks for another great post. The place else may just anybody get that kind of info in such a perfect means of writing?
I have a presentation subsequent week, and I’m on the search for such information.
I’m gone to convey my little brother, that he should also go to see this webpage on regular basis to obtain updated from most recent gossip.