I am having trouble embedding a framework into my app; I get the following error on the console:

dyld: Library not loaded: /Frameworks/libxml.framework/Versions/2.7.3/ libxml Referenced from: /Users/G/Code/FMLab/build/Debug/FMLab.app/Contents/ MacOS/FMLab
  Reason: image not found


I built a framework named libxml using the libxml2 source and a tweaked Xcode project. The framework builds successfully.

I then added the framework to the FMLab application target, and to a Copy Files build phase set to the Frameworks setting. This covers the instructions in the Apple documentation, as far as I can tell (skipping the parts about building dependencies).

I also added the Framework header path to the project build settings.

The application target builds successfully (including linking).

If I inspect the product, the Framework has been correctly copied. Running otool -L on the app binary yields:

G ~/Code/FMLab/build/Debug/FMLab.app/Contents/MacOS > otool -L FMLab
FMLab:
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /Frameworks/libxml.framework/Versions/2.7.3/libxml (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/ CoreFoundation (compatibility version 150.0.0, current version 476.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.0.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ ApplicationServices (compatibility version 1.0.0, current version 34.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.12.0)

It looks like the binary is looking for an absolute path instead of the relative path to the embedded framework, but I don't know enough about this to be sure.

When I run otool -L on the framework binary itself, I see the same absolute path:

G ~/Code/FastMap/FMLab/build/Debug/FMLab.app/Contents/Frameworks/ libxml.framework > otool -L libxml
libxml:
/Frameworks/libxml.framework/Versions/2.7.3/libxml (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)

What is especially disconcerting is that I had this all working a month ago, then left the code alone. Now I have returned and it is failing. It's possible I changed something, but the only thing I am sure that changed is that I upgraded versions of Xcode (actually, I upgraded to several iPhone 3 betas, then downgraded back to the 2.x release).

Both the framework and the app are built for x86_64.

Can anybody suggest a solution, or at least a next step for debugging this problem? It seems like Xcode is linking to the wrong place, but I'm surprised that I don't get a linker error if that is the case., because there is nothing at the path displayed by otool.

Thank you,

George King
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to