添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello boss.
i was trying getting cocoapods step by step fellowing your tutorial youtube video and it keeps showing errors which are
ERROR: Could not find a valid gem ‘cocoapds’ (>= 0) in any repository
ERROR: Possible alternatives: cocoapods, xcocoapods, cocoa, cocoa-xml, cocoadex

I don’t really know how to soluve that

hey but when I typed the code “sudo gem install cocoapods” it is showing the error
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
so plz tell me if I am wronger problem in my Mac

To @fuerte.francis

when I am trying to install the cocoapods I am typing sudo gem install cocoapods in bash in terminal it is showing the error

ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

please help me to how to solve this issue

@Siddharth

There is a stackoverflow thread that deals with an error related to ffi.

The thread suggests that you should perform the following installation in terminal:

sudo gem install ffi
              

The page does exist but obviously you can’t see it which means that you are not a CWC+ member given that the thread is within the CWC+ Students area.

This is the content of the thread:

You are not the first to have issues with cocoapods on an M1 chipped Mac with Big Sur. You and others are getting an error that points towards a missing ffi.c bundle as indicated by the first line in the error messages you posted above that says:

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle

From what I have read the solution seems to be by firstly opening Terminal with Rosetta 2.

Here’s the workaround:

  • Locate the Terminal application within the Utilities folder (Finder > Go menu > Utilities)
  • Select Terminal.app and right-click on it, then choose “Duplicate”
  • Rename the duplicated Terminal app to something obvious and distinct, like ‘Rosetta Terminal’
  • Now select the freshly renamed ‘Rosetta Terminal’ app and right-click and choose “Get Info” (or hit Command+i)
  • Check the box for “Open using Rosetta”, then close the Get Info window
  • Now run sudo gem install cocoapods
    Reply with how things go.
  • Also, this article may be of assistance:

    Medium – 18 Jan 21

    Getting Started on M1 for iOS

    So, I hope my first story-guide will help all iOS developers continue to work on MacBooks running on Apple M1 chip.

    Reading time: 3 min read My MacBook Pro is with i9 however I followed the steps and I couldn’t see the option open using rosetta…
    however below is the error message I am getting

    [Restored 1 Mar 2021 at 15:28:59]
    Last login: Mon Mar 1 15:19:17 on ttys000
    bnmanikandan@Bns-MacBook-Pro ~ % sudo gem install cocoapods
    Password:
    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.14.2/ext/ffi_c
    

    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210301-13544-9vkdzc.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.

    Provided configuration options:
    –with-opt-dir
    –without-opt-dir
    –with-opt-include
    –without-opt-include=${opt-dir}/include
    –with-opt-lib
    –without-opt-lib=${opt-dir}/lib
    –with-make-prog
    –without-make-prog
    –srcdir=.
    –curdir
    –ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    –with-ffi_c-dir
    –without-ffi_c-dir
    –with-ffi_c-include
    –without-ffi_c-include=${ffi_c-dir}/include
    –with-ffi_c-lib
    –without-ffi_c-lib=${ffi_c-dir}/lib
    –enable-system-libffi
    –disable-system-libffi
    –with-libffi-config
    –without-libffi-config
    –with-pkg-config
    –without-pkg-config
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in block in try_compile’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in try_compile’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in block in have_header' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in block in checking_for’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in open’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in open’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in checking_for’
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in have_header' from extconf.rb:10:in system_libffi_usable?’
    from extconf.rb:42:in `’

    To see why this extension failed to compile, please check the mkmf.log which can be found here:

    /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.14.2/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2 for inspection.
    Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.14.2/gem_make.out

    If I run flutter doctor below is the error message:
    bnmanikandan@Bns-MacBook-Pro ~ % flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel master, 1.27.0-9.0.pre.122, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-GB)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    [!] Xcode - develop for iOS and macOS
    ✗ CocoaPods not installed.
    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 CocoaPods Guides - Getting Started for instructions.
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 4.1)
    [✓] Connected device (2 available)

    ! Doctor found issues in 1 category.