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

Carthage fails to build Swift 2.3 targets in Xcode 8 beta 4 #1415

Closed
emaloney opened this issue Aug 2, 2016 · 7 comments
Closed

Carthage fails to build Swift 2.3 targets in Xcode 8 beta 4 #1415

emaloney opened this issue Aug 2, 2016 · 7 comments
Labels

Comments

@emaloney
Copy link

emaloney commented Aug 2, 2016

I am having trouble building Swift 2.3 targets in Carthage 0.17.2 using Xcode 8 beta 4.

The issue seems to be that the SWIFT_VERSION needs to be passed on the command line to /usr/bin/xcrun xcodebuild even though SWIFT_VERSION is explicitly specified in the Xcode project itself.

I've got a fork of SwiftyJSON in which I've created a swift2.3 branch where the targets were updated in Xcode to use Swift 2.3.

I reference this in a Cartfile as:

github "gilt/SwiftyJSON" "swift2.3"

When attempting to do carthage update, I get the following error:

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

This occurs despite the project already being updated; the SWIFT_VERSION is already set to 2.3. The error happens with the following command:

/usr/bin/xcrun xcodebuild -workspace /Users/emaloney/Documents/Code/CleanroomProject/BlueSteel/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcworkspace -scheme "SwiftyJSON OSX" -configuration Release ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build

Adding SWIFT_VERSION=2.3 to the command works:

/usr/bin/xcrun xcodebuild -workspace /Users/emaloney/Documents/Code/CleanroomProject/BlueSteel/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcworkspace -scheme "SwiftyJSON OSX" -configuration Release ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= SWIFT_VERSION=2.3 CARTHAGE=YES clean build

I suspect the SWIFT_VERSION needs to be copied over to the command line in the same way that the BITCODE_GENERATION_MODE setting is.

  • carthage version: 0.17.2
  • xcodebuild -version: Xcode 8.0
    Build version 8S188o
  • Are you using --no-build? NO
  • Are you using --no-use-binaries? NO
  • Are you using --use-submodules? NO
@emaloney emaloney changed the title Carthage to build Swift 2.3 targets in Xcode 8 beta 4 Carthage fails to build Swift 2.3 targets in Xcode 8 beta 4 Aug 2, 2016
@ikesyo ikesyo added the question label Aug 2, 2016
@ikesyo
Copy link
Member

ikesyo commented Aug 2, 2016

This is not a Carthage issue. It seems that SWIFT_VERSION build setting is not set for SwiftyJSON OSX and SwiftJSON watchOS, but set only for SwiftJSON iOS and SwiftJSON tvOS. Closing.

@ikesyo ikesyo closed this as completed Aug 2, 2016
@nikolaeu
Copy link

@ikesyo The same issue with XCode 8 beta 6. SWIFT_VERSION applied for all targets, however, still got Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift.

@sebbean
Copy link

sebbean commented Sep 15, 2016

I'm having this issue brand new xcode 8 (app store) build and a brand new xcode project with one dep: https://github.com/marmelroy/PhoneNumberKit/tree/swift3.0

worked perfectly fine with xcode 8 GM (pre app store)

@sebbean
Copy link

sebbean commented Sep 15, 2016

Verified it's the swift3.0 branch of the dependency. Verified that the dependency project itself builds in xcode with no problems.

➜  test git:(master) ✗ carthage update
*** Fetching PhoneNumberKit
*** Checking out PhoneNumberKit at "24e7c67c33f3330dd09cf08d5d669928b93f39b4"
*** xcodebuild output can be found in /var/folders/c8/d_x02g0520v2n40xvy7m0_hr0000gn/T/carthage-xcodebuild.WfHQEz.log
*** Building scheme "PhoneNumberKit-watchOS" in PhoneNumberKit.xcodeproj
** CLEAN FAILED **


The following build commands failed:
        Check dependencies
(1 failure)
** BUILD FAILED **


The following build commands failed:
        Check dependencies
(1 failure)
A shell task (/usr/bin/xcrun xcodebuild -project /Users/seb/dev/TradeLove/test/test/Carthage/Checkouts/PhoneNumberKit/PhoneNumberKit.xcodeproj -scheme PhoneNumberKit-watchOS -configuration Release -sdk watchos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** CLEAN FAILED **


The following build commands failed:
        Check dependencies
(1 failure)
** BUILD FAILED **


The following build commands failed:
        Check dependencies
(1 failure)

@sebbean
Copy link

sebbean commented Sep 15, 2016

Nevermind - doesn't build for watchOS in xcode itself. Same error.

trying carthage build --platform ios

@gangzimo
Copy link

Same error happened as above.

Logs show as below:
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

In Build Settings, each target should make sure it chooses "YES" or "NO" instead of unspecified for "Use Legacy Swift Language Version".

@ikesyo
Copy link
Member

ikesyo commented Sep 20, 2016

@gangzimo I'm not sure without the specific library information you are trying to build. But Carthage does not touch the build setting, so the error should be the project setting issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants