SenTesttingKit.framework runtime failure
-
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.
Thanks,
Jason -
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 -
Thanks for the reply, Chris. It all makes perfect sense and solves
the problem of running my application locally through Xcode.
To clarify a little, I never said I wanted to ship an application that
links against SenTestingKit. I'm building a tool for myself to aid in
unit testing my projects, and that's the reason I want to link against
the framework in the first place. I have Xcode installed so there's
no worries about not having it installed and I know where it's located
on my machine, so using $(DEVELOPER_LIBRARY_DIR) works fine for now.
However, if I did want to make the tool available to somebody else,
and I made having Xcode installed a prerequisite, what would be the
preferable way of building it? You gave a few solutions (Launch
Services & user-specified path), and both of those would definitely
work. Am I permitted to distribute a copy of SenTestingKit.framework
inside of my app bundle? Is there any standard way of accomplishing
this that I should be following?
Thanks,
Jason
On 3-Nov-07, at 6:56 PM, Chris Hanson wrote:
> 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
>


