On Nov 3, 2007, at 5:25 PM, Jason Sallis wrote: I've created a new project in Xcode 3 and am attempting to link the SenTestingKit framework into it. The project will be Leopard only. I'm linking against /Developer/Library/Framesorks/SenTestintKit.framework. Everything compiles fine but when I try to run the project, it fails and I get the following error:
dyld: Library not loaded: @rpath/SenTestingKit.framework/Versions/A/SenTestingKit Referenced from: /Users/jason/projects/TestProject/build/Release/TestProject.app/Contents/MacOS/TestProject Reason: image not found
Does anyone know what I need to do to get this to run properly? I've sent this to both the XCode Users list and the Cocoa Dev list since the topic is a grey area. Sorry for the cross post.
The topic's not really a gray area; it's only really appropriate for xcode-users, since OCUnit (SenTestingKit.framework) is supplied as part of Xcode. Please send follow-ups there. Thanks.
What are you trying to create that you're linking against SenTestingKit.framework from an application? In general, you should only be linking SenTestingKit.framework from your test bundle. SenTestingKit.framework is supplied as part of Xcode, and only people with Xcode installed will be able to use it.
The practical answer is that in order for Xcode to be able to move around on disk — a new Xcode feature we call coexistence — all of the frameworks that ship as part of Xcode 3.0 are linked using runpath search paths. This is a new dyld feature in Leopard whereby an application can embed a list of paths to search at load time for dynamic libraries, and dynamic libraries can have their embedded install name start with "@rpath" to indicate that these paths should searched.
If you just want to run your application on your own system, you can add "$(DEVELOPER_LIBRARY_DIR)/Frameworks" to the "Runpath Search Paths" build setting for your application target. This will ensure that your application will look for dynamic libraries with an install name starting with "@rpath" in your current Xcode installation's Frameworks directory, which is where SenTestingKit.framework is located.
However, this is not suitable for distribution! The reason is that you may have Xcode 3.0 installed in /Developer but I might have it installed in /Volumes/External/Tools/Xcode3.0; since "${DEVELOPER_LIBRARY_DIR)" is expanded on your system at link time, that's what will be embedded for your application.
There's no generic way to solve this. If you're really set on shipping an application that links against SenTestingKit.framework, the only thing you can really do is weak-link the framework and then load it manually when your application launches, either by using Launch Services to find Xcode and searching for the framework from there, or by asking the user to tell you where the framework or their Xcode 3 folder is.
I hope this makes sense.
-- Chris
|