“加载错误-dlopen...”在 Mac M1 中安装 pod 时

发布于 2025-01-11 06:38:31 字数 2021 浏览 0 评论 0原文

我有 Mac M1,在使用 pod install 在 iOS 中构建 flutter 项目时遇到以下错误。 我已经安装了 homebrew,使用 sudo arch -x86_64 gem install cocoapods 卸载/安装 cocoapods,但仍然出现错误。 我能做些什么来解决这个问题..?

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'
...

flutter doctor -v 的结果没有问题。

    [✓] 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:
      
              

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

花心好男孩 2025-01-18 06:38:31
  1. sudo arch -arm64e gem 安装 cocoapods
  2. sudo arch -arm64e gem 安装 ffi
  1. sudo arch -arm64e gem install cocoapods
  2. sudo arch -arm64e gem install ffi
神爱温柔 2025-01-18 06:38:31

M1 Mac 使用 ARM 处理器,因此

sudo arch -x86_64 gem install cocoapods

不适用于此类机器,而是适用于 x86 架构。
尝试使用 sudo arch -arm64e gem install cocoapods

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

不甘平庸 2025-01-18 06:38:31

我不知道为什么它解决了这个问题,但是 pod 是通过使用 Mac 中的终端而不是 Android studio 中的终端定期更新的。
我使用mac的终端,将工作目录移动到我的项目的ios文件夹中,并进行“pod update”。
这对我有用。

我阅读了以下评论:无法运行 Flutter 项目在 MacBook M1 中使用 Firebase

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文