无法在苹果 m1 芯片中的颤振项目上执行 pod 安装

Posted

技术标签:

【中文标题】无法在苹果 m1 芯片中的颤振项目上执行 pod 安装【英文标题】:Can't perform pod install on flutter project in apple m1 chip 【发布时间】:2021-11-08 06:19:33 【问题描述】:

我最近做了一个 Flutter 项目,并将该项目移到了我的带有 m1 芯片的新 mac mini 上。我已经成功安装了颤振、cocoapods、ffi 等,但是当我在项目的 ios 文件夹上运行 pod install 时,它会显示此错误,

46: from /usr/local/bin/pod:23:in `<main>'
    45: from /usr/local/bin/pod:23:in `load'
    44: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
    43: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
    42: from /Users/ananthan/.gem/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    41: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command/install.rb:52:in `run'
    40: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:161:in `install!'
    39: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    38: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface.rb:64:in `section'
    37: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    36: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:416:in `analyze'
    35: from /Library/Ruby/Gems/2.6.0/gems/earlgrey-1.16.0/lib/earlgrey/extensions/analyzer_extensions.rb:23:in `analyze'
    34: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    33: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    32: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface.rb:64:in `section'
    31: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:1077:in `block in resolve_dependencies'
    30: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
    29: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
    28: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
    27: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/sources_manager.rb:22:in `find_or_create_source_with_url'
    26: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:393:in `source_with_url'
    25: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:60:in `all'
    24: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:26:in `aggregate'
    23: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:331:in `aggregate_with_repos'
    22: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:331:in `map'
    21: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:331:in `block in aggregate_with_repos'
    20: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:322:in `source_from_path'
    19: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:315:in `block in source_from_path'
    18: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/manager.rb:315:in `new'
    17: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:30:in `initialize'
    16: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source.rb:31:in `initialize'
    15: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:53:in `refresh_metadata'
    14: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
    13: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
    12: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
    11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
    10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     8: from /Users/ananthan/.gem/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Users/ananthan/.gem/ruby/2.6.0/gems/ethon-0.14.0/lib/ethon.rb:3:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Users/ananthan/.gem/ruby/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:3:in `<top (required)>'
     1: from /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': cannot load such file -- 2.6/ffi_c (LoadError)

谁能帮我解决这个问题。没有 pod install 项目将无法运行

【问题讨论】:

同样的问题 我尝试了所有方法,但找不到解决方案。 【参考方案1】:

请按此步骤操作。

    sudo arch -x86_64 gem install ffi

    arch -x86_64 pod 安装

【讨论】:

我已经完成了,但仍然存在错误 我相信这个解决方案可以安装除 x86 二进制文件之外的所有内容。这样做后调试和构建项目是否有效?

以上是关于无法在苹果 m1 芯片中的颤振项目上执行 pod 安装的主要内容,如果未能解决你的问题,请参考以下文章

Linux系统适配苹果M1 芯片的项目有新进展

梳理M1芯片Mac mini 执行 pod install 失败Ruby直接崩

开发者曝苹果M1芯片有漏洞 不改设计就无法消除

处理 Podfile 的安装后挂钩时出错。无法在 iOS 模拟器上运行颤振项目得到 pod 错误

开发者曝苹果M1芯片有漏洞 不改设计就无法消除

MacOS(M1芯片 arm架构)下如何安装tensorflow