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

To work with Xcode 7 and Swift 2 supported frameworks, before `carthage *` run `xcode-select` #536

Closed
NicholasTD07 opened this Issue Jun 9, 2015 · 26 comments

Comments

Projects
None yet
@NicholasTD07

NicholasTD07 commented Jun 9, 2015

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

By running this command, you set the default xcodebuild to the one in Xcode 7 beta.

Hope this helps people who get errors when updating to Swift 2 supported frameworks, for example github "Quick/Quick" "swift-2.0" as in Cartfile.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 9, 2015

Anywhere appropriate to put it to let people know this?

NicholasTD07 commented Jun 9, 2015

Anywhere appropriate to put it to let people know this?

@robrix

This comment has been minimized.

Show comment
Hide comment
@robrix

robrix Jun 9, 2015

Contributor

This is standard Xcode stuff. I don’t think it’s necessary for Carthage to document it, but others may disagree.

Contributor

robrix commented Jun 9, 2015

This is standard Xcode stuff. I don’t think it’s necessary for Carthage to document it, but others may disagree.

@mdiep

This comment has been minimized.

Show comment
Hide comment
@mdiep

mdiep Jun 9, 2015

Member

I think it'd be appropriate to explain switching Xcode versions. I'm generally in favor of explaining things for newbies.

Member

mdiep commented Jun 9, 2015

I think it'd be appropriate to explain switching Xcode versions. I'm generally in favor of explaining things for newbies.

@jspahrsummers

This comment has been minimized.

Show comment
Hide comment
@jspahrsummers

jspahrsummers Jun 9, 2015

Member

I'm personally 👎 on documenting it for Carthage. Perhaps this information should be part of a more general guide to xcodebuild, which would then also be applicable to Carthage users.

Member

jspahrsummers commented Jun 9, 2015

I'm personally 👎 on documenting it for Carthage. Perhaps this information should be part of a more general guide to xcodebuild, which would then also be applicable to Carthage users.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Jun 10, 2015

Contributor

I'm still having issues using Carthage on a newly created Swift project in Xcode 7. Following the instructions in the Carthage README leads to a linker error ld: framework not found ReactiveCocoa. I can upload an example project if it helps?

Contributor

rhysforyou commented Jun 10, 2015

I'm still having issues using Carthage on a newly created Swift project in Xcode 7. Following the instructions in the Carthage README leads to a linker error ld: framework not found ReactiveCocoa. I can upload an example project if it helps?

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 10, 2015

@jspahrsummers I think it in this way: for people who are new to Carthage and maybe don't know much about xcode-select or dont know it at all, when they try to update to a Swift-2 supported branch of a repo, they get these errors from xcodebuild. They might think it is an issue related to Carthage without realizing that if they set Xcode correctly for xcodebuild with xcode-select, carthage will just build it without any problem.

My own story: All dependencies in my project was up to Swift 2. And I was trying to carthage update with new Swift-2 branches. Then I got all those syntax errors. At first I didn't realize where the errors I got were from. Until I realized it is actually xcodebuild complaining about wrong syntax, which means there's something not right about xcodebuild, probably the version of it. That's when I thought, "Wait a minute, there's something called xcode-select, which might be of some help." and I selected Xcode-beta and then everything worked!

TL;DR For people know little or none about xcode-select, this might be very helpful when they update to Swift-2 branches and get all those syntax errors from xcodebuild.

NicholasTD07 commented Jun 10, 2015

@jspahrsummers I think it in this way: for people who are new to Carthage and maybe don't know much about xcode-select or dont know it at all, when they try to update to a Swift-2 supported branch of a repo, they get these errors from xcodebuild. They might think it is an issue related to Carthage without realizing that if they set Xcode correctly for xcodebuild with xcode-select, carthage will just build it without any problem.

My own story: All dependencies in my project was up to Swift 2. And I was trying to carthage update with new Swift-2 branches. Then I got all those syntax errors. At first I didn't realize where the errors I got were from. Until I realized it is actually xcodebuild complaining about wrong syntax, which means there's something not right about xcodebuild, probably the version of it. That's when I thought, "Wait a minute, there's something called xcode-select, which might be of some help." and I selected Xcode-beta and then everything worked!

TL;DR For people know little or none about xcode-select, this might be very helpful when they update to Swift-2 branches and get all those syntax errors from xcodebuild.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 10, 2015

@rpowelll I was getting that too. I found out that I was running Xcode 7 beta, but my simulator was from Xcode 6.3.2, so there was some problem with the paths. And probably that's the reason why ld couldn't find that framework. Killed that Simulator, and ran Xcode -> Open Developer Tool -> Simulator from Xcode 7 beta. That fixed the problem ld: not found.

Hope this helps.

NicholasTD07 commented Jun 10, 2015

@rpowelll I was getting that too. I found out that I was running Xcode 7 beta, but my simulator was from Xcode 6.3.2, so there was some problem with the paths. And probably that's the reason why ld couldn't find that framework. Killed that Simulator, and ran Xcode -> Open Developer Tool -> Simulator from Xcode 7 beta. That fixed the problem ld: not found.

Hope this helps.

@mathiasnagler

This comment has been minimized.

Show comment
Hide comment
@mathiasnagler

mathiasnagler Jun 11, 2015

I am also having the issue ld: framework not found .... I am running Xcode 7 beta and the iOS 9 Simulator that comes with it. The problem is independent of the framework that I am trying to integrate using carthage. I tried several frameworks that already support Swift 2.0 like Alamofire and ReactiveCocoa.
Running the Simulator via Xcode -> Open Developer Tools -> Simulatordid not fix the issue for me, unfortunately.

mathiasnagler commented Jun 11, 2015

I am also having the issue ld: framework not found .... I am running Xcode 7 beta and the iOS 9 Simulator that comes with it. The problem is independent of the framework that I am trying to integrate using carthage. I tried several frameworks that already support Swift 2.0 like Alamofire and ReactiveCocoa.
Running the Simulator via Xcode -> Open Developer Tools -> Simulatordid not fix the issue for me, unfortunately.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 11, 2015

Try ls path/to/framework to see whether that folder exist or not. If not, mkdir -p path/to/framework/folder. This saved me twice with ls errors in Xcode 7. 


Sent from Mailbox

On Thu, Jun 11, 2015 at 11:26 PM, Mathias Nagler notifications@github.com
wrote:

I am also having the issue ld: framework not found .... I am running Xcode 7 beta and the iOS 9 Simulator that comes with it. The problem is independent of the framework that I am trying to integrate using carthage. I tried several frameworks that already support Swift 2.0 like Alamofire and ReactiveCocoa.

Running the Simulator via Xcode -> Open Developer Tools -> Simulatordid not fix the issue for me, unfortunately.

Reply to this email directly or view it on GitHub:
#536 (comment)

NicholasTD07 commented Jun 11, 2015

Try ls path/to/framework to see whether that folder exist or not. If not, mkdir -p path/to/framework/folder. This saved me twice with ls errors in Xcode 7. 


Sent from Mailbox

On Thu, Jun 11, 2015 at 11:26 PM, Mathias Nagler notifications@github.com
wrote:

I am also having the issue ld: framework not found .... I am running Xcode 7 beta and the iOS 9 Simulator that comes with it. The problem is independent of the framework that I am trying to integrate using carthage. I tried several frameworks that already support Swift 2.0 like Alamofire and ReactiveCocoa.

Running the Simulator via Xcode -> Open Developer Tools -> Simulatordid not fix the issue for me, unfortunately.

Reply to this email directly or view it on GitHub:
#536 (comment)

@memmons-ntst

This comment has been minimized.

Show comment
Hide comment
@memmons-ntst

memmons-ntst Jun 11, 2015

Note that you can also set the version of xcodebuild and other command line tools from Xcode.
Xcode Locations

memmons-ntst commented Jun 11, 2015

Note that you can also set the version of xcodebuild and other command line tools from Xcode.
Xcode Locations

@mathiasnagler

This comment has been minimized.

Show comment
Hide comment
@mathiasnagler

mathiasnagler Jun 11, 2015

@NicholasTD07 Honestly I don't understand which path you mean with path/to/framework. Do you mean the path that is shown in Xcode's File Inspector when I select it? If yes, then the path exists and the framework is located there.

mathiasnagler commented Jun 11, 2015

@NicholasTD07 Honestly I don't understand which path you mean with path/to/framework. Do you mean the path that is shown in Xcode's File Inspector when I select it? If yes, then the path exists and the framework is located there.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 11, 2015

@mathiasnagler When I got the ld error I see it mentioned the framework in either this path:

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Developer/Library/Frameworks
or
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks

After I ran mkdir -p the/path, the error was gone.

NicholasTD07 commented Jun 11, 2015

@mathiasnagler When I got the ld error I see it mentioned the framework in either this path:

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Developer/Library/Frameworks
or
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks

After I ran mkdir -p the/path, the error was gone.

@martinlexa-merck

This comment has been minimized.

Show comment
Hide comment
@martinlexa-merck

martinlexa-merck Jun 12, 2015

Guys, just confirmed with Apple engineer on WWDC and it seems like XCode 7 Beta bug. Filled in Radar: 21359335

The issue is that linker is missing -F/path/to/framework for those manually added frameworks.

Workaround:

  • Build Settings -> Framework Search Paths -> And add path to your build framework.

martinlexa-merck commented Jun 12, 2015

Guys, just confirmed with Apple engineer on WWDC and it seems like XCode 7 Beta bug. Filled in Radar: 21359335

The issue is that linker is missing -F/path/to/framework for those manually added frameworks.

Workaround:

  • Build Settings -> Framework Search Paths -> And add path to your build framework.
@bradpurchase

This comment has been minimized.

Show comment
Hide comment
@bradpurchase

bradpurchase Jun 15, 2015

@martinlexa-merck this worked for me - thanks

bradpurchase commented Jun 15, 2015

@martinlexa-merck this worked for me - thanks

@pcantrell

This comment has been minimized.

Show comment
Hide comment
@pcantrell

pcantrell Jun 15, 2015

Contributor

This may be “standard Xcode stuff,” but it’s not immediately apparent how Carthage locates other command line tools, and that xcode-select is the way to change that. @NicholasTD07’s original post just saved me an hour.

It would be appropriate to briefly mention xcode-select in Carthage’s own docs, even if the details are left as an exercise to the reader. Helpful pointers to docs for related tools are always nice.

Contributor

pcantrell commented Jun 15, 2015

This may be “standard Xcode stuff,” but it’s not immediately apparent how Carthage locates other command line tools, and that xcode-select is the way to change that. @NicholasTD07’s original post just saved me an hour.

It would be appropriate to briefly mention xcode-select in Carthage’s own docs, even if the details are left as an exercise to the reader. Helpful pointers to docs for related tools are always nice.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 16, 2015

@pcantrell I am glad my post helped someone! :)

NicholasTD07 commented Jun 16, 2015

@pcantrell I am glad my post helped someone! :)

@jspahrsummers

This comment has been minimized.

Show comment
Hide comment
@jspahrsummers

jspahrsummers Jun 16, 2015

Member

@NicholasTD07 @pcantrell Fair enough! A pull request to add that sort of tip to the README (or some other documentation here) would be .

Member

jspahrsummers commented Jun 16, 2015

@NicholasTD07 @pcantrell Fair enough! A pull request to add that sort of tip to the README (or some other documentation here) would be .

pcantrell added a commit to pcantrell/Carthage that referenced this issue Jun 16, 2015

Mentioned xcode-select
In support of #536, per @jspahrsummers’s request
@lbrndnr

This comment has been minimized.

Show comment
Hide comment
@lbrndnr

lbrndnr Jun 17, 2015

@NicholasTD07 How did you manage to link the Quick framework using Xcode 7? It fails for me.

lbrndnr commented Jun 17, 2015

@NicholasTD07 How did you manage to link the Quick framework using Xcode 7? It fails for me.

@pcantrell

This comment has been minimized.

Show comment
Hide comment
@pcantrell

pcantrell Jun 17, 2015

Contributor

@larcus94 After some fiddling, I did one thing not in the directions:

  • Build settings → Framework search paths → $(PROJECT_DIR)/Carthage/Build/iOS/

I get “No such module 'Quick'” compiler errors in my tests without that.

I also did these two things that are in the directions:

  • Add .frameworks from Carthage/Build/iOS to Link Binary with Libraries build phase.
  • Create a new “Copy files” with Destination = Frameworks, and add .frameworks to that phase as well. (Docs say this is only necessary if you’re writing a framework yourself.)
Contributor

pcantrell commented Jun 17, 2015

@larcus94 After some fiddling, I did one thing not in the directions:

  • Build settings → Framework search paths → $(PROJECT_DIR)/Carthage/Build/iOS/

I get “No such module 'Quick'” compiler errors in my tests without that.

I also did these two things that are in the directions:

  • Add .frameworks from Carthage/Build/iOS to Link Binary with Libraries build phase.
  • Create a new “Copy files” with Destination = Frameworks, and add .frameworks to that phase as well. (Docs say this is only necessary if you’re writing a framework yourself.)
@lbrndnr

This comment has been minimized.

Show comment
Hide comment
@lbrndnr

lbrndnr Jun 17, 2015

@pcantrell Very interesting. I filed a radar like an hour ago because I couldn't figure out what the problem was and it worked fine with Xcode 6. The only difference is then that Xcode 7 does not add the search path automatically.

lbrndnr commented Jun 17, 2015

@pcantrell Very interesting. I filed a radar like an hour ago because I couldn't figure out what the problem was and it worked fine with Xcode 6. The only difference is then that Xcode 7 does not add the search path automatically.

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Jun 18, 2015

@larcus94 Hi, I didn't have much problem of "framework not found". The problem I run into constantly is mainly "dyld_fatal_error dyld: symbol not found" when I try to run my App on my iPhone. When it is running on simulator, everything is fine. But when it comes to an actual device, I get ""dyld_fatal_error dyld: symbol not found"

For those people who are also getting "dyld: symbol not found", try these:

  • Clean and re-build
  • Delete "Derived Data" in Window -> Projects
  • Run carthage build from command line

P.S.
I will close this issue after the post below get approved because what I suggested at the first place is in the document now.

For further discussion on build errors in Xcode 7, please move to this post in Apple Developer Forum, https://forums.developer.apple.com/message/12436 (approved)

NicholasTD07 commented Jun 18, 2015

@larcus94 Hi, I didn't have much problem of "framework not found". The problem I run into constantly is mainly "dyld_fatal_error dyld: symbol not found" when I try to run my App on my iPhone. When it is running on simulator, everything is fine. But when it comes to an actual device, I get ""dyld_fatal_error dyld: symbol not found"

For those people who are also getting "dyld: symbol not found", try these:

  • Clean and re-build
  • Delete "Derived Data" in Window -> Projects
  • Run carthage build from command line

P.S.
I will close this issue after the post below get approved because what I suggested at the first place is in the document now.

For further discussion on build errors in Xcode 7, please move to this post in Apple Developer Forum, https://forums.developer.apple.com/message/12436 (approved)

@paulbruneau

This comment has been minimized.

Show comment
Hide comment
@paulbruneau

paulbruneau Aug 6, 2015

Without google-stumbling on this issue, I never would have been able to get running. Thank you @NicholasTD07

paulbruneau commented Aug 6, 2015

Without google-stumbling on this issue, I never would have been able to get running. Thank you @NicholasTD07

@NicholasTD07

This comment has been minimized.

Show comment
Hide comment
@NicholasTD07

NicholasTD07 Aug 7, 2015

@paulbruneau It's my pleasure. Cheers 🍻 XD

NicholasTD07 commented Aug 7, 2015

@paulbruneau It's my pleasure. Cheers 🍻 XD

@chrisco314

This comment has been minimized.

Show comment
Hide comment
@chrisco314

chrisco314 Sep 3, 2015

@jspahrsummers: Given that not codebases are using the same compiler version, is there way to specify this on a per project basis?

chrisco314 commented Sep 3, 2015

@jspahrsummers: Given that not codebases are using the same compiler version, is there way to specify this on a per project basis?

@RustyKnight

This comment has been minimized.

Show comment
Hide comment
@RustyKnight

RustyKnight Aug 17, 2016

Yup, this is my "go to place" to find this command (for each beta release of Xcode 8) as I don't use the command for anything else

RustyKnight commented Aug 17, 2016

Yup, this is my "go to place" to find this command (for each beta release of Xcode 8) as I don't use the command for anything else

@benstahl

This comment has been minimized.

Show comment
Hide comment
@benstahl

benstahl Aug 23, 2016

Thank you for posting this. That was my problem, I was messing around with Xcode8-beta but still trying to do development in Xcode 7, and getting Carthage compile errors.

If you need to go back and forth a bit, there is a simple CLI tool called xcode-toggle that makes it really easy.

benstahl commented Aug 23, 2016

Thank you for posting this. That was my problem, I was messing around with Xcode8-beta but still trying to do development in Xcode 7, and getting Carthage compile errors.

If you need to go back and forth a bit, there is a simple CLI tool called xcode-toggle that makes it really easy.

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