Building a Cedar target with xcodebuild throws errors #1794

Closed
ghost opened this Issue Feb 5, 2014 · 6 comments

Comments

Projects
None yet
3 participants
@ghost

ghost commented Feb 5, 2014

Hello to everyone reading this message, and first of all I want to thank all the CocoaPods contributors for the hard work they put into this project.

Now straight to the subject, here's my problem: I have an app that has a separate target (called Specs) for Unit Testing, using Cedar. I'va managed to setup both of my targets to play well with CocoaPods, and at this point everything runs well and I have 0 failures in my tests. 😎

Thing is, Cedar test targets come with a ready-to-go Rakefile that could be used for CI, and I really want to use it. I've set up a project from scratch, added Cedar to it and rake went perfectly fine. But then I've run pod install. Run again, fail. I ran this:

xcodebuild -target Specs -configuration Debug -sdk iphonesimulator build ARCHS=i386

And got:

ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Which should be ok since I'm not building from the generated workspace, right? But then, I try to run this:

xcodebuild -workspace MyProject.xcworkspace -scheme Specs -configuration Debug -sdk iphonesimulator build ARCHS=i386

And get:

Executing /Users/nemesis/Desktop/MyProject/build/Debug-iphonesimulator/Specs.app/Specs -RegisterForSystemEvents
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
  Referenced from: /Users/nemesis/Desktop/MyProject/build/Debug-iphonesimulator/Specs.app/Specs
  Reason: image not found

And then I set UIKit as optional for my specs, but then again:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

Is there anyone that got this going? I am desperately waiting for it to work, and if I could get some help that would be really nice. Thanks in advance.

@ghost

ghost commented Feb 7, 2014

Update:
I noticed that it fails to build the Specs target as long as I'm importing files from the app target that do import any of the Pods. But the Pods are themselves available in the Specs target (importing them separately in any of the specs does not throw any errors). So say I have a class A which in it's implementation imports a Pod and in my spec for that A class, I import A.h, and it'll throw the error "undefined symbol PodX" linker error. I've also tried to add the app target as a build dependency for the specs target, but to no avail. Is there anyone who knows what might be the problem? Please tell me if I can provide any additional information about the settings or anything related.

Contributor

nemesis commented Feb 7, 2014

Issue is still relevant, I got rid of my corporate account from which the issue was created.

jeffh commented Feb 14, 2014

Hey @nemesis,

Out of curiosity, have you tried running the compiled binary from your initial post with ios-sim? Does that change the execution error?

Contributor

nemesis commented Feb 14, 2014

@jeffh Hi and thanks for looking at this! Answering your question - no, it seems that I can't. I get a timeout:

Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7ffd905086a0 {NSLocalizedDescription=Simulator session timed out.}

And if I try to launch the executable inside the .app from the command line, I get the same error saying:

UIKit library not loaded, image not found...

But, if I launch the generated .app with ios-sim, it launches! Do you know what might be the problem?

Contributor

nemesis commented Feb 14, 2014

Further investigation on this: It seems that the problem might be in the Rakefile itself, but I am not competely sure (since if I don't have any specs that link to files in my main target that link to pods -> run succeeds.)
I tried replacing the Run Specs rake task with launching the same .app with ios-sim launch .app and it throws the ImageIO error that I've described initially, in the first comment.

Also my final guess is that the problem is in the env_vars I pass along. I'll try and look at the env when I launch the Specs.app with ios-sim, and the ones I pass within the Rakefile and maybe it'll bring up something.

Contributor

nemesis commented Feb 14, 2014

Problem was in incorrect env. var. CFFIXED_USER_HOME that was being set to a temp dir in /var/tmp, while it should be the path to the simulator.
Issue may be closed.

CocoaPodsBot was assigned by ghost Mar 29, 2014

@confidencejuice closed with reason "not a cocoapods issue ( useful gotcha info!)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment