kylef / JSONWebToken.swift

Swift implementation of JSON Web Token (JWT).
http://jwt.io
BSD 2-Clause "Simplified" License
763 stars 226 forks source link

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

Closed jonblatho closed 6 years ago

jonblatho commented 6 years ago

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:

The package does not compile:

Same error both times.

jonblatho commented 6 years ago

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

nagarajaghantasala commented 5 years ago

@jonblatho ,

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

Ast3r10n commented 5 years ago

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

EdwardCKF commented 5 years ago

I have same issue

jonblatho commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

GergesEid commented 5 years ago

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