Linking problems when using the static library

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

Linking problems when using the static library

Postby estoy » 30 Jan 2011, 16:51

Hi,

I'm trying to use the static library but I run in to some problems: It seems that the library routines cannot find the standard libraries. So for instance I get
Undefined symbols:
".objc_class_name_NSString", referenced from:
literal-pointer@__OBJC@__cls_refs@NSString in libOCMock.a(NSInvocation+OCMAdditions.o)
literal-pointer@__OBJC@__cls_refs@NSString in libOCMock.a(OCPartialMockObject.o)
literal-pointer@__OBJC@__cls_refs@NSString in libOCMock.a(OCProtocolMockObject.o)
literal-pointer@__OBJC@__cls_refs@NSString in libOCMock.a(OCClassMockObject.o)
literal-pointer@__OBJC@__cls_refs@NSString in libOCMock.a(OCMockObject.o)
".objc_class_name_NSMutableArray", referenced from:
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libOCMock.a(OCObserverMockObject.o)
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libOCMock.a(OCMockRecorder.o)
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libOCMock.a(OCMockObject.o)

I've added all the flags listed in the tutorial.

I tried building the test target in the example project and that went well so I tried to compare the settings for that target and my own but I could not find any difference.

I'm building for the iPhone simulator 4.2 in debug mode.

I guess that this due to some trivial error on my part but I just cannot get past it so I would really appreciate all the help I can get.

/Erik
estoy
 
Posts: 1
Joined: 30 Jan 2011, 16:37

Re: Linking problems when using the static library

Postby mdd » 31 Jan 2011, 19:32

I'm having the same problem.
For me this happens in the sample project, too, but only when building for the simulator. Device builds build and run fine.

Any ideas?
mdd
 

Re: Linking problems when using the static library

Postby James » 19 Feb 2011, 01:02

Just to confirm have the same linking problem.
James
 

Re: Linking problems when using the static library

Postby raid5 » 23 Feb 2011, 21:33

+1 for me.

For my own project, it builds fine for Device but not Simulator. As for the example project, I got it to build for both device and simulator by building the iPhoneExampleTests and iPhoneExampleTesting targets first.
raid5
 
Posts: 2
Joined: 23 Feb 2011, 21:30

Re: Linking problems when using the static library

Postby erik » 23 Feb 2011, 21:56

The current binary release of OCMock, that is version 1.70, might not work well with recent version of Xcode because Apple introduced changes to the build process and new SDKs since its release.

I've looked into this and made some changes that should make OCMock work with Xcode 3.2.5, which I think is the latest version of Xcode 3, as well as Xcode 4 GM, specifically build 4A278b.

Could you grab the latest version from the Subversion repository and see whether this works for you? Once I have confirmation I will make a new release. If it doesn't work for, you can include the version of Xcode you use? Thanks!

Update: I confirmed that the iPhoneExample builds and passes the tests on an iPad with iOS 4.2.1 (8C148). This works for me in both, Xcode 3.2.5 and Xcode 4 GM.
erik
 
Posts: 90
Joined: 10 Oct 2009, 15:22
Location: Hamburg, Germany

Re: Linking problems when using the static library

Postby raid5 » 23 Feb 2011, 22:26

@erik I'd love to try out these changes. What target do I need to build? I haven't had the need to build OCMock yet.

Edit: I've confirmed that the latest code in the svn repo works with my project now! I built the OCMockLib target and copied over the Headers directory and libOCMock.a.

Thanks!
raid5
 
Posts: 2
Joined: 23 Feb 2011, 21:30

Re: Linking problems when using the static library

Postby mdd » 21 Mar 2011, 01:39

sorry for the late response...

works as expected. thanks for looking into this!
mdd
 


Return to OCMock



cron