Skip to content

Xcode 10 beta: CompileSwiftSources failed with a nonzero exit code #111

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

Closed
jonblatho opened this issue Jul 22, 2018 · 9 comments
Closed

Comments

@jonblatho
Copy link
Contributor

jonblatho commented Jul 22, 2018

The following build error occurs in Xcode 10 beta:

Command CompileSwiftSources failed with a nonzero exit code

Here is the full invocation:

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target: JSONWebToken)
    cd /Users/jonathanthornton/developer/CocoaPodsTest/Pods
    export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer
    export SDKROOT=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name JWT -Onone -enable-batch-mode -enforce-exclusivity=checked -DDEBUG -D COCOAPODS -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -target arm64-apple-ios8.0 -g -module-cache-path /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -embed-bitcode-marker -enable-testing -index-store-path /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Index/DataStore -swift-version 4.2 -I /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Products/Debug-iphoneos/JSONWebToken -I /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/ -F /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Products/Debug-iphoneos/JSONWebToken -c -j4 /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/Base64.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/Claims.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/ClaimSet.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/Decode.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/Encode.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/HMAC.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/HMACCommonCrypto.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/JOSEHeader.swift /Users/jonathanthornton/developer/CocoaPodsTest/Pods/JSONWebToken/Sources/JWT.swift -output-file-map /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/Objects-normal/arm64/JSONWebToken-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/Objects-normal/arm64/JWT.swiftmodule -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/JWT-generated-files.hmap -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/JWT-own-target-headers.hmap -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/JWT-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/JWT-project-headers.hmap -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Products/Debug-iphoneos/JSONWebToken/include -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/DerivedSources/arm64 -Xcc -I/Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG=1 -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -emit-objc-header -emit-objc-header-path /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/Objects-normal/arm64/JWT-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/jonathanthornton/Library/Developer/Xcode/DerivedData/CocoaPodsTest-dczzxrslnorvsidbgijoazqgkagr/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/JSONWebToken.build/unextended-module-overlay.yaml -working-directory /Users/jonathanthornton/developer/CocoaPodsTest/Pods

This occurs in the JSONWebToken project when using CocoaPods. No further information is provided.

The package does compile:

  • With a git clone and checkout to 2.2.0, then $ swift build (with a warning for accessing String.characters)

The package does not compile:

  • When compiled in Xcode 10 beta as a standalone package at 2.2.0
  • When compiled in Xcode 10 beta via CocoaPods at 2.2.0

Same error both times.

@jonblatho
Copy link
Contributor Author

As suggested in #102, this was solved by deleting the CommonCrypto directory.

@nagarajaghantasala
Copy link

@jonblatho ,

If we delete CommonCrypto, then how to use it. Can you please provide the solution.

@Ast3r10n
Copy link

@jonblatho There's no CommonCrypto directory under Pods/JSONWebToken. Which directory do you mean?

@EdwardCKF
Copy link

I have same issue

@jonblatho
Copy link
Contributor Author

jonblatho commented Sep 19, 2018

@nagarajaghantasala With Xcode 10/Swift 4.2, CommonCrypto is exposed natively as part of Swift (for Apple platforms only), rendering the included modulemap unnecessary and causing a name collision. Removing the modulemap solves the collision.

@Ast3r10n I can't reproduce that. I just pulled the JWT pod into a fresh project and the CommonCrypto directory is located under Pods/JSONWebToken:

screen shot 2018-09-19 at 2 40 17 pm

The Podfile used:

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

target 'JWT-test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for JWT-test
  pod 'JSONWebToken'

  target 'JWT-testTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'JWT-testUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

@EdwardSun123 Not sure which issue exactly you’re referring to, but hopefully some of the above information helps. Some PRs in this repo also offer more permanent solutions to the issue.

@Ast3r10n
Copy link

Ast3r10n commented Sep 20, 2018

I looked for the CommonCrypto directory but it just isn't there.
I have found a solution, though, as stated here.

EDIT: I was looking in the wrong place. The directory is there, but I still find it easier to just remove the redeclaration.

@GergesEid
Copy link

In my case I connect an actual iphone not simulator and run the app once on it, It solved the problem. But connect iphone firstly, then choose it from the menu of simulators, then press run button.
The problem will solve too.

@ergunkocak
Copy link

Running on real device showed me the exact error. Thanks @GergesEid

@GergesEid
Copy link

You may have another reason causing this error. Regards. You are welcome @ergunkocak

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

6 participants