"LoadError -dlopen..." while pod install in Mac M1
Asked Answered
P

3

5

I have Mac M1 and am getting following error while using pod install to build flutter project in iOS. I have already installed home brew, uninstall/install cocoapods using sudo arch -x86_64 gem install cocoapods, but still error occurs. What can I do for solving this probrem..?

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
...

The result of flutter doctor -v has no issues.

    [✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale ja-JP)
    • Flutter version 2.10.2 at /Users/sae/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (12 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/sae/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] Connected device (2 available)
    • iPhone 13 (mobile) • C2EDE2E3-E820-42C2-B0EC-AFC07C401397 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

If you need further information, please write a comment.

Prune answered 3/3, 2022 at 11:55 Comment(0)
I
15
  1. sudo arch -arm64e gem install cocoapods
  2. sudo arch -arm64e gem install ffi
Interfluent answered 27/3, 2022 at 1:37 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Galliwasp
D
0

M1 macs are using ARM proccesors so the

sudo arch -x86_64 gem install cocoapods

isn't meant for such machines but x86 architectures. Τry using sudo arch -arm64e gem install cocoapods

Digger answered 3/3, 2022 at 12:51 Comment(1)
Thank you for your comment. I uninstalled cocoapods and used sudo arch arm64e gem install cocoapods, but still error exists....Prune
P
0

I have no idea why it solved the problem, but pod is updated regularly by using terminal in Mac instead of that in Android studio. I used terminal of mac, moved the working directory to the ios folder of my project, and did 'pod update'. It worked for me.

I read the comment of this:Cannot run the Flutter project with Firebase in MacBook M1

Prune answered 4/3, 2022 at 1:20 Comment(2)
if you were trying to install cocoa pods to another folder than ios an error is expected ,because the cocoa pods file exist only in the ios folderDigger
In terminal of Android, I move the working directory also, but still have the error.( I'm sorry, my English of the post may be confusing)Prune

© 2022 - 2024 — McMap. All rights reserved.