Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error using carthage #21

Closed
edwardaux opened this issue Apr 16, 2015 · 16 comments
Closed

Compilation error using carthage #21

edwardaux opened this issue Apr 16, 2015 · 16 comments

Comments

@edwardaux
Copy link

Hi... just tried to add Box to a brand new project using Carthage (my cartfile contains github "robrix/Box" ~> 1.2.0) and get the following error when I run carthage update:

clang: error: invalid architecture 'aarch64' for deployment target '-mios-simulator-version-min=8.0'

If I manually open and build Carthage/Checkouts/Box/Box.xcodeproj in Xcode (6.3, if it matters) it compiles OK. The one difference that I can see between the two compilation commands are that carthage is using Release-iphoneos, whereas Xcode uses Debug-iphonesimulator.

The full transcript of the carthage build is https://gist.github.com/edwardaux/8a2319844ba00582c0b7

Any thoughts? Thanks.

@robrix
Copy link
Owner

robrix commented Apr 18, 2015

I’m afraid I don’t have any ideas here. I can‘t reproduce the issue 😕

Are any of your other dependencies using Box?

@edwardaux
Copy link
Author

Interesting. I originally discovered it because my project was was using Carthage to embed Argo, which has its own Cartfile that pulls in Box as a sub-dependency. However, after a bit of testing, I discovered that I could reproduce the error just by using Box.

For me, reproducing is literally as simple as the following:

  • Create new Swift Project (doesn't matter if iOS or OS X)
  • Create a Cartfile that contains github "robrix/Box" ~> 1.2.0
  • Run carthage update

Could I trouble you to share your Carthage build log from the above steps? That might help me figure out what is different on my machine.

In case anyone is playing along at home, for reference, I'm using Xcode 6.3 (6D570) and Carthage (0.6.3).

@robrix
Copy link
Owner

robrix commented Apr 18, 2015

You bet:

rob@Resonance ~/D/Foo /master> carthage update
*** Fetching Box
*** Checking out Box at "1.2.0"
*** xcodebuild output can be found in /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/carthage-xcodebuild.my0DyZ.log
*** Building scheme "Box-iOS" in Box.xcodeproj
*** Building scheme "Box-Mac" in Box.xcodeproj

@edwardaux
Copy link
Author

Thanks Rob. Turns out that your Foo project doesn't build on my machine either, so it must be something screwy in my environment.

I think the gist you created with the log must be a private one... as I get a 404 when I access it. Once I get that, hopefully that will give me a clue as to what is wrong with my setup. Thanks.

@robrix
Copy link
Owner

robrix commented Apr 19, 2015

There’s no such thing as private gists only public & secret (unlisted) ones, but I’ve gone ahead and made it public.

@robrix
Copy link
Owner

robrix commented Apr 19, 2015

Since this doesn’t repro for me I’m going to go ahead and close this issue out.

@robrix robrix closed this as completed Apr 19, 2015
@robrix
Copy link
Owner

robrix commented Apr 19, 2015

@edwardaux I’ve just uploaded a binary for 1.2.1, so carthage may be able to avoid building Box altogether now.

@edwardaux
Copy link
Author

Thanks @robrix.

FYI, I was doing some more googling and found some other reports of a similar problem in ReactiveCocoa. Their "fix" was to uninstall Xcode 6.3 and re-install it - which I tried, but no luck.

I downloaded the source to Carthage and started poking around to see what arguments they use when they invoke xcodebuild. The way I read it, the Carthage script basically boils down to the following (which doesn't work on my, and also one other colleague's, machine):

xcodebuild -project Box.xcodeproj -configuration Release -sdk iphonesimulator -scheme Box-iOS

By contrast, building by specifying the target works ok:

xcodebuild -project Box.xcodeproj -configuration Release -sdk iphonesimulator -target Box-iOS

The one thing that jumped to mind in the failing log is that even though the sdk is reporting as iphonesimulator8.3, the first few lines of the log have somehow morphed into using iphoneos.

Build settings from command line:
    SDKROOT = iphonesimulator8.3

=== BUILD TARGET Box-iOS OF PROJECT Box WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Users/edwardsc/Library/Developer/Xcode/DerivedData/Box-bvdyjxluqbdcwqeoagemfoykznjg/
Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64
write-file /Users/edwardsc/Library/Developer/Xcode/DerivedData/Box-bvdyjxluqbdcwqeoagemfoykznjg/
Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box.LinkFileList
...

Weirdly enough, I see the exact same conditions when I tried the same for Prelude.

No action required on your part... just thought I'd update this issue in case others have a similar problem. Will report more when I get to the bottom of it.

@robrix
Copy link
Owner

robrix commented Apr 20, 2015

Interesting findings. What happens if you specify both target and scheme? This may be worth opening an issue against carthage.

@jakecraige
Copy link

I'm seeing the same results as @edwardaux on my machine. Thanks for digging into what's causing this.

@robrix
Copy link
Owner

robrix commented Apr 20, 2015

Has the binary for 1.2.1 helped anything here?

@jakecraige
Copy link

I forgot to mention, I'm seeing the same thing with https://github.com/LlamaKit/LlamaKit, I haven't used this lib specifically.

I did just add it to my project to try though, and it installed successfully. It didn't build though, I'm guessing that's because you have the .framework in the release?

If I force master with github "robrix/Box" "master", I get a build error

@robrix
Copy link
Owner

robrix commented Apr 20, 2015

@jakecraige That’s right, binary release == downloadable .framework for 1.2.1. So that much is working at least!

@edwardaux
Copy link
Author

As it turns out, @robrix, I don't believe that it is specifically related to Box (oh, and to answer your earlier question, scheme and target are mutually exclusive).

When using -target, it compiles correctly regardless of the -sdk value.

When using -scheme, it compiles correctly for the device if I pass -sdk iphoneos or nothing at all. If I pass -sdk iphonesimulator the compile log says SDKROOT = iphonesimulator8.3, the -isysroot flag gets set to the simulator SDK path, but for some reason it is using an arm architecture - which causes the compilation error.

Stepping back a little, I created a brand new iOS framework project (and also a static library project) and they both have exactly the same problem. A brand new app, however, does not exhibit the problem.

Based on this, I think the problem can correctly framed as:

Using Xcode 6.3, when compiling iOS static libraries or frameworks, incorrect xcodebuild flags are getting set if both -scheme XXX and -sdk iphonesimulator are passed.

The weird thing is that everything compiles OK in Xcode.

At this stage, it is looking more and more like an xcodebuild bug. Apologies Rob for clogging up your Box issue tracker. By copy, @jspahrsummers, while I don't believe it is strictly related to Carthage, I'm curious if you'd seen anything like this in your travels?

@jspahrsummers
Copy link
Collaborator

@edwardaux Sounds related to Carthage/Carthage#347 or Carthage/Carthage#417.

@edwardaux
Copy link
Author

Ooh, yes. Carthage/Carthage#417 is on the money. If I pass in -destination 'platform=iOS Simulator,name=iPhone 4s,OS=latest' then it builds just fine.

I'll do a bit more digging on the -destination flag and see if I can't create a Carthage pull request. I'll also raise a radar against xcodebuild.

jspahrsummers added a commit to jspahrsummers/Box that referenced this issue May 5, 2015
I think this is a real workaround for issues like antitypical/Result#21
and antitypical/Result#25.

I don’t think this will work around issues like robrix#21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants