Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

公開日:2019-04-08
最終更新:2019-07-09

環境

macOS : Majove 10.14.3
XCode : 10.2
Swift : 4
Deployment Target : 10.2

起こったこと

XCode でプロジェクトをビルドしたら、import RxSwiftの行に下記の Error が表示された。

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler  

やったこと

  1. Carthage の bootstrap
carthage bootstrap --platform iOS --cache-builds  
*** Checking out Nimble at "v7.3.4"  
*** Checking out RxSwift at "4.4.1"  
*** Checking out ZIPFoundation at "0.9.8"  
*** Checking out Zip at "1.1.0"  
*** Checking out SwiftyJSON at "4.2.0"  
*** Checking out Alamofire at "4.8.1"  
*** Checking out Quick at "v1.3.4"  
*** xcodebuild output can be found in /var/folders/c7/kq7n86y50018f3ml4j4gn52r0000gn/T/carthage-xcodebuild.na5OFr.log  
*** Invalid cache found for Alamofire, rebuilding with all downstream dependencies  
*** Invalid cache found for Nimble, rebuilding with all downstream dependencies  
*** Invalid cache found for Quick, rebuilding with all downstream dependencies  
*** Invalid cache found for RxSwift, rebuilding with all downstream dependencies  
*** Invalid cache found for SwiftyJSON, rebuilding with all downstream dependencies  
*** Invalid cache found for Zip, rebuilding with all downstream dependencies  
*** Invalid cache found for ZIPFoundation, rebuilding with all downstream dependencies  
*** Downloading RxSwift.framework binary at "Atomic.1"  
***  Skipped installing RxSwift.framework binary due to the error:  
    "Incompatible Swift version - framework was built with 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1) and the local version is 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)."  
   Falling back to building from the source  
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace  
Could not find any available simulators for iOS  

Invalid か..

  1. Carthage の brew upgrade
    これでいける..?

    brew upgrade carthage  
    Updating Homebrew...  
    ==> Auto-updated Homebrew!  
    Updated 1 tap (homebrew/core).  
    ==> New Formulae  
    ==> Updated Formulae  
    ==> Renamed Formulae  
    ==> Deleted Formulae  
    ==> Upgrading 1 outdated package:  
    carthage 0.31.2 -> 0.33.0  
    ==> Upgrading carthage  
    ==> Downloading https://homebrew.bintray.com/bottles/carthage-0.33.0.high_sierra  
    ==> Downloading from https://akamai.bintray.com/7f/7f88034cfbd51439cd45467745ea3  
    ######################################################################## 100.0%  
    ==> Pouring carthage-0.33.0.high_sierra.bottle.tar.gz  
    ==> Caveats  
    Bash completion has been installed to:  
    /usr/local/etc/bash_completion.d  
    zsh completions have been installed to:  
    /usr/local/share/zsh/site-functions  
    ==> Summary  
    /usr/local/Cellar/carthage/0.33.0: 8 files, 21.3MB  
    ==> `brew cleanup` has not been run in 30 days, running now...  
    Removing: /usr/local/Cellar/carthage/0.31.1... (69 files, 25.2MB)  
    Removing: /usr/local/Cellar/carthage/0.31.2... (69 files, 25.2MB)  
    Removing: /Users/user/Library/Caches/Homebrew/carthage--0.31.1.high_sierra.bottle.tar.gz... (8.2MB)  
    Removing: /Users/user/Library/Caches/Homebrew/carthage--0.31.2.mojave.bottle.tar.gz... (8.2MB)  
    Removing: /Users/user/Library/Logs/Homebrew/carthage... (64B)  

    (長いので一部割愛)

  2. Carthage の bootstrap
    もう一度。

    carthage bootstrap --platform iOS --cache-builds  
    *** Checking out Nimble at "v8.0.1"  
    *** Checking out Alamofire at "4.8.2"  
    *** Checking out SwiftyJSON at "4.3.0"  
    *** Checking out ZIPFoundation at "0.9.8"  
    *** Checking out Quick at "v2.0.0"  
    *** Checking out Zip at "1.1.0"  
    *** Checking out RxSwift at "4.5.0"  
    A shell task (/usr/bin/env git clone --quiet https://github.com/Quick/Nimble.git /Users/user/Desktop/project/projectname/Carthage/Checkouts/Quick/Externals/Nimble) failed with exit code 128:  
    error: RPC failed; curl 18 transfer closed with outstanding read data remaining  
    fatal: the remote end hung up unexpectedly  
    fatal: early EOF  
    fatal: index-pack failed  

    failed..

  3. Carthage の bootstrap
    ダメ押しでもう一度。

    carthage bootstrap --platform iOS --cache-builds  
    *** Checking out Quick at "v2.0.0"  
    *** Checking out Zip at "1.1.0"  
    *** Checking out SwiftyJSON at "4.3.0"  
    *** Checking out ZIPFoundation at "0.9.8"  
    *** Checking out Nimble at "v8.0.1"  
    *** Checking out RxSwift at "4.5.0"  
    *** Checking out Alamofire at "4.8.2"  
    *** xcodebuild output can be found in /var/folders/c7/kq7n86y50018f3ml4j4gn52r0000gn/T/carthage-xcodebuild.vZjxtJ.log  
    *** Invalid cache found for Alamofire, rebuilding with all downstream dependencies  
    *** Invalid cache found for Nimble, rebuilding with all downstream dependencies  
    *** Invalid cache found for Quick, rebuilding with all downstream dependencies  
    *** Invalid cache found for RxSwift, rebuilding with all downstream dependencies  
    *** Invalid cache found for SwiftyJSON, rebuilding with all downstream dependencies  
    *** Invalid cache found for Zip, rebuilding with all downstream dependencies  
    *** Invalid cache found for ZIPFoundation, rebuilding with all downstream dependencies  
    *** Downloading RxSwift.framework binary at "[4,5]"  
    *** Building scheme "Alamofire iOS" in Alamofire.xcworkspace  
    *** Building scheme "Nimble-iOS" in Nimble.xcodeproj  
    *** Building scheme "Quick-iOS" in Quick.xcworkspace  
    *** Building scheme "SwiftyJSON iOS" in SwiftyJSON.xcworkspace  
    *** Building scheme "Zip" in Zip.xcodeproj  
    *** Building scheme "ZIPFoundation" in ZIPFoundation.xcodeproj  

    Invalid だけど Building されている..?

  4. プロジェクトのビルド
    一応終了しておいたプロジェクトを起動して、クリーンしてからビルド。
    そしたらすんなりビルドできて Error もなくなった..なぜ..

ひとこと

Error は解消したけれど、理解が足りないのでまた調べる。

参考リンク

記事が少しでもいいなと思ったらクラップを送ってみよう!
0
+1
できることがふえるといいなぁ

よく一緒に読まれている記事

0件のコメント

ブログ開設 or ログイン してコメントを送ってみよう
目次をみる

技術ブログをはじめよう

Qrunch(クランチ)は、ITエンジニアリングに携わる全ての人のための技術ブログプラットフォームです。

技術ブログを開設する

Qrunchでアウトプットをはじめよう

Qrunch(クランチ)は、ITエンジニアリングに携わる全ての人のための技術ブログプラットフォームです。

Markdownで書ける

ログ機能でアウトプットを加速

デザインのカスタマイズが可能

技術ブログ開設

ここから先はアカウント(ブログ)開設が必要です

英数字4文字以上
.qrunch.io
英数字6文字以上
ログインする