Closed9

pod install で no suitable image found. Did find: (LoadError)

kiokakioka

環境

要素 バージョン
OS macOS Big Sur バージョン11.6
ハード MacBook Pro (13-inch, M1, 2020)
IDE Android Studio Arctic Fox 2020.3.1 Patch 3
Flutter 2.8.1
CocoaPod 1.11.2
FIrebase CLI 10.0.1
Flutterfire 0.1.1+2
kiokakioka

手順

  1. Android Studio で New Flutter Project
  2. pubspec.yaml へ firebase_core cloud_firestore を dependencies へ追加
  3. Podfile の platform :ios, '10.0' へ変更
  4. Device に iPhone 13(mobile) を指定して、Run をクリック
kiokakioka
Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '8.9.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '8.9.0' defined in 'firebase_core'

    Resolving dependencies of `Podfile`

Error output from CocoaPods:
↳
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 9): no suitable image found.  Did find: (LoadError)
    	/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture
    	/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        (中略)
    	from /usr/local/bin/pod:23:in `<main>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.6/ffi_c (LoadError)
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    	from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:3:in `<top (required)>'
         (中略)
    	from /usr/local/bin/pod:23:in `<main>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 9): no suitable image found.  Did find: (LoadError)
    	/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture
    	/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        (中略)
    	from /usr/local/bin/pod:23:in `<main>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.6/ffi_c (LoadError)
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    	from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:3:in `<top (required)>'
        (中略)
    	from /usr/local/bin/pod:23:in `<main>'

Error running pod install
Error launching application on iPhone 13.
kiokakioka

試行

  1. ターミナルの「 Rosettaを使用して開く」にチェックを入れる
  2. arch で i386 と表示されることを確認
  3. Android Studio は arch が arm64 のままなので、再起動
  4. Android Studio では、arch はarm64 ..
  5. ひとまずターミナルで、pod install
  6. エラーは、変わらず、
  7. /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 9): no suitable image found. Did find: (LoadError)
  8. pod 実行時もエラーになってしまったので、 sudo gem uninstall cocoapods
  9. 再インストール sudo gem install cocoapods
 % sudo gem install cocoapods
Fetching cocoapods-1.11.2.gem
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20211229-43079-laiqqe.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
  1. あれ、
kiokakioka

試行2

cocoapods がアンインストールできていないので、再削除

sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-deintegrate
sudo gem uninstall cocoapods-downloader 
sudo gem uninstall cocoapods-plugins    
sudo gem uninstall cocoapods-search 
sudo gem uninstall cocoapods-trunk 
sudo gem uninstall cocoapods-try  

sudo gem install cocoapods

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20211229-46234-1jaypg1.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

こちらと同じ事象。。

https://qiita.com/teriyaki398_/items/3a44291a2e9772f1ebb8
手順を参考に実施する。

kiokakioka

試行3

renv をインストール

https://github.com/rbenv/rbenv

brew install rbenv
rbenv init

に従って eval "$(rbenv init - zsh)" を .zshrc に追加

rbenv install 3.1.0
rbenv global 3.1.0
% rbenv version
3.1.0 (set by /Users/kioka/.rbenv/version)
kiokakioka

Android Studio でrun

Launching lib/main.dart on iPhone 13 in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
  For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

CocoaPods not installed or not in valid state.
Error launching application on iPhone 13.

cocoapods のインストール

sudo gem install cocoapods

Android Studio で run

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           202.1s
Debug service listening on ws://127.0.0.1:61765/tUlNHK9gR6g=/ws
Syncing files to device iPhone 13...

やっと出た。。

kiokakioka

結論

ruby gem の現時点での最新をインストールすることで解消。あとでまとめ直す予定。

このスクラップは2021/12/30にクローズされました