Skip to content

Support for Xcode's workspaces #17

Closed
jk opened this Issue Apr 13, 2012 · 21 comments

3 participants

@jk
jk commented Apr 13, 2012

When running calabash-ios setup the setup opens Xcode's *.xcodeproj project file. Since more and more devs using CocoaPods these days, they're also using *.xcworkspace. So when the setup program instructs to verify that the -cal target is building, it will fail since the linker is unable to link the static pods library. You'll see a -lPods error message.

So I purpose to look for a *.xcworkspace file and if it exists open it by the end of the setup procedure.

@krukow
calabash member
krukow commented Apr 13, 2012

Ok that Sound reasonable. Did setup work ok otherwise in
Your .xcworkspace project?

@jk
jk commented Apr 13, 2012

I tried it with two projects, one fairly big universal project and one vanilla project. I got the latter working but have problems with the big project, since it doesn't find components of GMGridView, the simulator crashes with a SIGABRT, while the original target compiles and runs fine.

I think I should diff the two project files…

@krukow
calabash member
krukow commented Apr 14, 2012

Ok, this is useful Info. I realize that you probably don't have much time for this stuff but If you could create a minimal and non confidential project that exhibits the problem that would be very useful for debugging.

Also, I hope this doesn't mean you're stuck. You should be able to use the "Manual setup with Xcode" instructions o. Github.
Could you confirm this works?

@jmoody
calabash member
jmoody commented Apr 15, 2012

I have also had problems with calabash-ios setup and Xcode workspaces. I have seen cases where the setup script generates a corrupted Xcode .xcodeproj file. I have also seen it succeed.

After seeing a corrupted Xcode .xcodeproj today after running setup on new project, I decide to try to reproduce and put my results up on github. I found I could not reproduce. I put the repository up on github anyway.

The branch of interest is: test-calabash-ios-setup-on-xcode-workspace

I understand that my "corrupted .xcodeproj" file problem is different that that of jk (the OP) but it falls under the rubric of "Support for Xcode's workspaces". Let me know if I should move this comment to another issue or to the forum.

@krukow
calabash member
krukow commented Apr 15, 2012

Ok, but you say that the github project you created does not reproduce it?

@jmoody
calabash member
jmoody commented Apr 15, 2012

That is correct. I cannot reproduce. Sorry I could not be more helpful. I have seen the corrupted xcodeproject again, I will update the repo.

@krukow
calabash member
krukow commented Apr 16, 2012

No, please, you're very helpful. This is important to be to fix. Unfortunately automatic setup is harder than I initially thought, but I'd like to get it right so keep'em coming...

@jk
jk commented Apr 16, 2012

@krukow I just did the manual procedure and ran into the same issue as I ran into when using the automated setup and use the workspace afterwards. But perhaps the findings while manually configuring my project will help you find what's wrong.

  • Other linker flags before calabash: »-ObjC«
  • 1. attempt: other linker flags: »-ObjC -force_load "$(SRCROOT)/../calabash.framework/calabas" -lstdc++« resulted in:
ld: duplicate symbol _OBJC_METACLASS_$_LPMapRoute in ../calabash.framework/calabash(LPMapRoute.o) and /Users/$user/dev/myProj/../calabash.framework/calabash(LPMapRoute.o) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • 2. attempt: I removed -force_load and the path → it compiled fine but the calabash output doesn't show up.
  • 3. attempt: Readded -force_load but removed -ObjC → it compiled, but crashed upon start because it dosn't find GMGridView.
2012-04-16 12:34:27.125 myProj-cal[17736:16403] Creating the server: <LPHTTPServer: 0xa0039f0>
2012-04-16 12:34:27.128 myProj-cal[17736:16403] Started LPHTTP server on port 37265
2012-04-16 12:34:27.404 myProj-cal[17736:16403] Unknown class GMGridView in Interface Builder file.
2012-04-16 12:34:27.414 myProj-cal[17736:16403] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0xcb77870> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key actionDelegate.'
*** First throw call stack:
(0x211f022 0x2508cd6 0x211eee1 0x710022 0x681f6b 0x681edb 0x9fec88 0x69cd50 0xbe271a 0x2120dea 0x208a7f1 0xbe126e 0xa871fc 0xa87779 0xa8799b 0xa86fec 0xaadf1d 0xa981cb 0xaaedf1 0xaaee0d 0xaaee0d 0xaaeea9 0x9ed6f5 0x9ed73c 0xbe154e 0xbe2eb7 0x9bfce1 0x9bfff8 0x9bf17f 0x9ce183 0x9cec38 0x9c2634 0x3f31ef5 0x20f3195 0x2057ff2 0x20568da 0x2055d84 0x2055c9b 0x9bec65 0x9c0626 0x487ac 0x4874d)
terminate called throwing an exception

So I suspect -ObjC as the culprit. Is there a reason that you created a framework instead of a static library we can link to?

Next step for me is to setup a project with GMGridView dependency to see if the problem is also in that project. I'll choose the GMGridView example project for this purpose.

@krukow
calabash member
krukow commented Apr 16, 2012

Could you try with -ObjC -lstdc++ or did you already try this?

@krukow
calabash member
krukow commented Apr 16, 2012

By the way, AFAIK the samme issue would happen with a static lib. Framework is just a wrapped out static lib

@jk
jk commented Apr 16, 2012

Could you try with -ObjC -lstdc++ or did you already try this?

I already did but I double checked on that. It's the same result as on my first attempt. It compiles flawlessly but without calabash showing up in the console output. Any other ideas?

@krukow
calabash member
krukow commented Apr 16, 2012

Yes,
What is the other lib you are using?

Instead of -ObjC you could -force_load both Calabash and the other lib.

@krukow
calabash member
krukow commented Apr 16, 2012

or you can do -all_load -ObjC in your test target only

@jk
jk commented Apr 16, 2012

Honestly I don't know where the static lib of GMGridView will be generated. I added GMGridView's source code as a whole project to my xcworkspace and added dependent libGridView.a which is generated after the first build to frameworks. I'm sure I can -force_load GMGridView, but since there're a couple of other external libs (I think more than 5 to 7…) I would prefer to not omit -ObjC.

@krukow
calabash member
krukow commented Apr 16, 2012

Ok try -all_load -ObjC in your test target then?

@jk
jk commented Apr 16, 2012

try -all_load -ObjC in your test target

That's it. Do you know why this works instead of -ObjC -force_load … -lstdc++?

@krukow
calabash member
krukow commented Apr 16, 2012

Yes. Checkout this SO question

http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do

Though I though't -lstdc++ was needed too.

@krukow krukow closed this Apr 16, 2012
@krukow
calabash member
krukow commented Apr 16, 2012

I do recommend you only change the setting in your test/-cal target, not your production target.

@jk
jk commented Apr 16, 2012

Hehe, I found the same SO question this morning :)

Yeah I'll definitely change only the -cal target.

You closed the issue, does that mean, that you already changed the automatic configuration to work with workspaces?

@krukow krukow reopened this Apr 16, 2012
@krukow
calabash member
krukow commented Apr 16, 2012

Oh no, I forgot the original issue. Opened again :)

@krukow
calabash member
krukow commented Apr 20, 2012

In 0.9.48 automatic opening of project file is entirely disabled - it was confusing anyway.

@krukow krukow closed this Apr 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.