CocoaPods / CocoaPods

The Cocoa Dependency Manager.

Home Page:https://cocoapods.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CocoaPods compatibility with Apple DTK (Apple Silicon)

MatrixSenpai opened this issue · comments

Currently, libffi +Ruby v2.6.0 seems to have some issues with Apple's DTK. Multiple development tools, including Homebrew (ref Homebrew/brew#7857) seem to have issues working. Some have workarounds, but the core seems to be hidden somewhere in libffi (ref libffi/libffi#571)

I will make sure to keep this issue up to date with fixes from libffi and anything else i can find.

I received my DTK yesterday, and will try to create a fork of libffi and get it to build. As mentioned in the linked ffi issue, support for arm64 already exists, and may just need to be fixed to apply to DTK/macOS devices. Assuming I can get it to work, I will also create a fork for CP with the working version of libffi and try to get it to build.

I believe this issue is also related to #9896 & #9890
edit: add related issue

Yes this was also filed as #9890 and was closed as this is an issue with the ffi gem that should be fixed.

Thanks for the work and effort here.

Cool. Would you mind leaving this one open and/or pinning while I work on a fix? I'll tie it to a PR, and that way people who come looking for answers know a fix is in the works

@MatrixSenpai yes keeping this open.

Please note that these are workarounds. And while they do help the community get up and running, this isn't an actual fix, but a temporary bandaid.
Realistically, we won't have a fix until libffi is up to date

Hey @MatrixSenpai. Yes, these are totally workarounds.
However, I wanted to post it here so other people who received their DTKs and are excited as much as me, will be able at least to get their apps running.

I hope the fix for the libffi will be there soon. 🤞

p.s
I have updated the previous comment with a more clear workaround tag.

commented

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

I haven't checked on CP recently, been writing on my own machine recently instead of the DTK. Anyone else have any updates? I'd assume a new libffi has been put out...

Hi, I have tried the workaround of running terminal with Rosetta with an actual Mac that runs on M1, and the error is the same. Posting it here in case someone else is also having this issue.

Trying to run pod install (directly) on a Flutter project. The error is as follows:

Command

/usr/local/bin/pod install

Report

  • What did you do?
    Run pod install on a Flutter project

  • What did you expect to happen?
    Pods should be installed

  • What happened instead?
    Error below

Stack

   CocoaPods : 1.10.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.0 (20A2411)
       Xcode : 12.2 (12B45b)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : 

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.calendar
        'PERMISSION_EVENTS=0',

        ## dart: PermissionGroup.reminders
        'PERMISSION_REMINDERS=0',

        ## dart: PermissionGroup.contacts
        'PERMISSION_CONTACTS=0',

        ## dart: PermissionGroup.camera
        # 'PERMISSION_CAMERA=0',

        ## dart: PermissionGroup.microphone
        'PERMISSION_MICROPHONE=0',

        ## dart: PermissionGroup.speech
        'PERMISSION_SPEECH_RECOGNIZER=0',

        ## dart: PermissionGroup.photos
        # 'PERMISSION_PHOTOS=0',

        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
        # 'PERMISSION_LOCATION=0',

        ## dart: PermissionGroup.notification
        # 'PERMISSION_NOTIFICATIONS=0',

        ## dart: PermissionGroup.mediaLibrary
        'PERMISSION_MEDIA_LIBRARY=0',

        ## dart: PermissionGroup.sensors
        'PERMISSION_SENSORS=0'
      ]
    end
  end
end

Error

LoadError - dlsym(0x7fbbeb6837d0, Init_ffi_c): symbol not found - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/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'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

For anyone else struggling with this issue, I just found a way to solve it. In addition to running terminal in Rosetta (see above), I installed a gem that seems to be related to the symbol not found in the error:

sudo gem install ffi

After doing this, cocoapods runs as expected.

@jacobokoenig incredible timing.

commented

I am having the same problem right now, even after I tried sudo gem install ffi. After running pod install after the fact I am getting an error where it says "No Podfile found in the project directory" when there clearly is one. Also, I am using flutter so I believe it may need a different approach to my problem.

Also, I am coming from a windows workspace and am very new to Mac in general, and I'm still a beginner developer so I apologize if this seems a little informal in terms of issue reporting. I've just been thrust into the world of mac so I've been working out issues all day.

I was able to get generic pod commands to work (i.e., pod env, pod setup, etc), but anytime I try to run an install or update command I get the following error:

mattc@Matts-DTK-Mac:Dollar Game > pod install --verbose                                                                                                                                                                                                         Preparing

Analyzing dependencies

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

Finding Podfile changes
  A GoogleMobileAdsMediationFacebook
  A GoogleMobileAdsMediationUnity
  - Firebase
  - Google-Mobile-Ads-SDK

Resolving dependencies of `Podfile`
[!] Couldn't determine repo type for URL: `https://github.com/CocoaPods/Specs.git`: Invalid ABI specified

/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:83:in `rescue in cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:72:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'                                                                                                                                                                                                                                          /1.2s

@whitehat007 my guess is that's an issue with ethon interacting with libcurl via ffi

I am having the same problem right now, even after I tried sudo gem install ffi. After running pod install after the fact I am getting an error where it says "No Podfile found in the project directory" when there clearly is one. Also, I am using flutter so I believe it may need a different approach to my problem.

Also, I am coming from a windows workspace and am very new to Mac in general, and I'm still a beginner developer so I apologize if this seems a little informal in terms of issue reporting. I've just been thrust into the world of mac so I've been working out issues all day.

I assume you forgot to create the empty pod first. In order to do that you have drag your project folder to terminal and run pod init

I found it may due to the abi difference between arm64 and arm64e.
According to this Apple Developer Forums thread, the compiler shipped with Xcode can build both arm64 and arm64e executables, but only allow 'official certificated' arm64e binaries to be run at this time. gem is a ruby script preinstalled in the system. The /usr/bin/ruby is a universal binary with x86_64 arch and arm64e arch, means that the sudo gem install ffi cannot build an arm64 binary but an arm64e binary instead, which will be rejected by os by default.
So another solution other than forcing Terminal runs using Rosetta is trying to add -arm64e_preview_abi to the kernel boot args and it may works.
I'll have a try now.


Confirmed. It works. I cannot upload images due to network restrictions.
Steps:

  1. Shutdown the Mac, hold Power button up to 10 secs and boot into recoveryOS.
  2. Launch the Terminal in menu, type csrutil disable to close the SIP, and reboot.
  3. Boot into normal desktop, open Terminal, type sudo nvram boot-args="-arm64e_preview_abi" and reboot.
    Now CocoaPods should work natively without Rosetta.

I think we should make a petition to make Apple to ship Ruby, Python and other script language interpreters which have native plug-in support with arm64 abi instead of arm64e abi before arm64e is ready for everyone.

For anyone else struggling with this issue, I just found a way to solve it. In addition to running terminal in Rosetta (see above), I installed a gem that seems to be related to the symbol not found in the error:

sudo gem install ffi

After doing this, cocoapods runs as expected.

Where you able to run it from your flutter project?

For everyone with an M1 (Silicon) device who want run their projects on a simulator:
Set arm64 as excluding architecture for Any iOS Simulator SDK.

Screenshot 2020-11-29 at 16 35 53

Is it currently possible to develop on React Native using CocoaPods with an M1 chip?

Hey
I used gem update on my 1 macbook and now I get this error when I try to use pod install:

Traceback (most recent call last):
19: from /usr/local/bin/pod:23:in <main>' 18: from /usr/local/bin/pod:23:in load'
17: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:36:in <top (required)>' 16: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require'
15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 14: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods.rb:9:in <top (required)>'
13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require'
11: from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/core_ext/array/conversions.rb:3:in <top (required)>' 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 /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/xml_mini.rb:3: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 /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/time.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 /Library/Ruby/Gems/2.6.0/gems/date-3.0.1/lib/date.rb:4: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': dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.0.1/lib/date_core.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/date-3.0.1/lib/date_core.bundle - /Library/Ruby/Gems/2.6.0/gems/date-3.0.1/lib/date_core.bundle (LoadError)

I was getting all of these same errors, and tried all the suggested workarounds but continued to get errors running pod install. I finally was able to get cocoapods running without any hacks, rosetta or sudo!

My only concern is with all the random crap I've been trying to get it to work, I did something magical that I'm unaware of to get it to finally work, but I think these steps will do the trick!

  1. Install homebrew (as arm64) into /opt/homebrew
git clone https://github.com/Homebrew/brew.git /opt/homebrew
  1. Use homebrew to install ruby (2.7.0)
/opt/homebrew/bin/brew install ruby
  1. Using homebrew's ruby, install cocoapods
/opt/homebrew/opt/ruby/bin/gem install cocoapods
  1. Run hombrew's ruby's pod command
/opt/homebrew/lib/ruby/gems/2.7.0/bin/pod install

Success (for me)!

I spoke too soon. pod install works, but pod update crashes hard:

% pod update
Update all pods
Updating local specs repositories
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:38: [BUG] Illegal instruction at 0x00000001028fc0a0
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0036 p:---- s:0222 e:000221 CFUNC  :enter
c:0035 p:0039 s:0218 e:000217 METHOD /opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:38
c:0034 p:0042 s:0202 e:000201 TOP    /opt/homebrew/lib/ruby/gems/2.7.0/gems/ethon-0.12.0/lib/ethon.rb:15 [FINISH]
c:0033 p:---- s:0199 e:000198 CFUNC  :require
c:0032 p:0111 s:0194 e:000193 METHOD /opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72
c:0031 p:0011 s:0178 e:000177 TOP    /opt/homebrew/lib/ruby/gems/2.7.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2 [FINISH]
c:0030 p:---- s:0175 e:000174 CFUNC  :require
c:0029 p:0111 s:0170 e:000169 METHOD /opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72
c:0028 p:0005 s:0154 e:000153 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:440
c:0027 p:0041 s:0146 e:000145 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:372
c:0026 p:0303 s:0135 e:000134 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:365
c:0025 p:0005 s:0125 e:000124 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:338
c:0024 p:0005 s:0120 e:000119 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:78
c:0023 p:0006 s:0116 e:000114 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:60
c:0022 p:0008 s:0110 e:000109 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:257
c:0021 p:0008 s:0105 e:000104 BLOCK  /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:135
c:0020 p:0068 s:0101 e:000100 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64
c:0019 p:0032 s:0094 e:000093 BLOCK  /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:134 [FINISH]
c:0018 p:---- s:0090 e:000089 CFUNC  :each
c:0017 p:0024 s:0086 e:000085 BLOCK  /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133 [FINISH]
c:0016 p:---- s:0082 e:000081 CFUNC  :open
c:0015 p:0081 s:0076 e:000075 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131
c:0014 p:0018 s:0068 e:000067 BLOCK  /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:145 [FINISH]
c:0013 p:---- s:0064 e:000063 CFUNC  :each
c:0012 p:0006 s:0060 e:000059 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143
c:0011 p:0005 s:0056 e:000055 BLOCK  /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:235
c:0010 p:0068 s:0053 e:000052 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64
c:0009 p:0031 s:0046 e:000045 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:234
c:0008 p:0007 s:0040 e:000039 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160
c:0007 p:0146 s:0036 e:000035 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command/update.rb:63
c:0006 p:0072 s:0031 e:000030 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334
c:0005 p:0020 s:0024 e:000023 METHOD /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52
c:0004 p:0399 s:0019 e:000018 TOP    /opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/bin/pod:55 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0112 s:0008 E:000410 EVAL   /opt/homebrew/lib/ruby/gems/2.7.0/bin/pod:23 [FINISH]
c:0001 p:0000 s:0003 E:001fd0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/opt/homebrew/lib/ruby/gems/2.7.0/bin/pod:23:in `<main>'
/opt/homebrew/lib/ruby/gems/2.7.0/bin/pod:23:in `load'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/command/update.rb:63:in `run'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `update_repositories'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `each'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:145:in `block in update_repositories'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `update'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `open'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `block in update'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `each'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:134:in `block (2 levels) in update'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:135:in `block (3 levels) in update'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:257:in `update'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:60:in `preheat_existing_files'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:78:in `deprecated_local_podspecs'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/opt/homebrew/lib/ruby/gems/2.7.0/gems/ethon-0.12.0/lib/ethon.rb:15:in `<top (required)>'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:38:in `require'
/opt/homebrew/Cellar/ruby/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:38:in `enter'

try arch -arch x86_64 pod xxx on vanilla setup.

For everyone with an M1 (Silicon) device who want run their projects on a simulator:
Set arm64 as excluding architecture for Any iOS Simulator SDK.

Screenshot 2020-11-29 at 16 35 53

I keep getting an issue with the libraries saying:

Could not find module 'Player' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator

Any idea? Thanks!

EDIT: OMG I GOT IT WORKING, thank you. I had to update those settings on the 'Pods' project :)

Seems I get the same issue with pod install. I'm using Mac mini M1, and I will try to use Swift Package as a workaround.

haibozhou@HaiboZhous-Mac-mini Vanilla Music % pod install --verbose
Preparing

Analyzing dependencies

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

Resolving dependencies of Podfile

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/usr/local/bin/pod install --verbose

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.10.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.0.1 (20B29)
       Xcode : 12.2 (12B45b)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : 

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'

target 'Vanilla Music' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Vanilla Music
  pod "GCDWebServer/WebUploader", "~> 3.0"

end

Error

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/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'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

This approach is work for me:) @jacobokoenig
#9907 (comment)

I had to update those settings on the 'Pods' project :)

Yes but won't those get overwritten every time you run pod install?

For anyone else struggling with this issue, I just found a way to solve it. In addition to running terminal in Rosetta (see above), I installed a gem that seems to be related to the symbol not found in the error:

sudo gem install ffi

After doing this, cocoapods runs as expected.

One gotcha for anyone coming from google. Make sure you sudo gem install ffi inside of an x86 shell and not an arm one. I installed ffi through an arm shell first and was getting the same error still. You must install ffi in an x86 shell

For everyone with an M1 (Silicon) device who want run their projects on a simulator:
Set arm64 as excluding architecture for Any iOS Simulator SDK.

Screenshot 2020-11-29 at 16 35 53

In addition, to get the pod project updated eveytime you run CocoaPods add this to your pod file:

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end
end

Hey everyone, I've tried a couple workarounds that were mentioned trying to run 'pod install' in terminal... I have included the ffi gem and tried running terminal in rosetta, still seem to be having the same issues installing mapbox sdk for iOS using cocoapods.. Here is the error I am getting, any suggestions? I appreciate any feedback.

`LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/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'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/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'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'`

The problem seems to be, that there are no symbols (at least not for arm64e). You can check that by running nm -g /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle.

On my system ffi_c only had symbols, when running the gem install process via arch -x86_64. the ffi_c.bundle resulted in a fat bundle, but there where no symbols for arm64e

If you keep having issues with CocoaPods on the DTK, make sure you've got Xcode CLI tools installed. Was the case for me and it didn't provide a clear error message. Use this command to install Xcode CLI tools: xcode-select --install

@whitehat007 did you get past Invalid ABI specified issue? I have tried everything listed here but nothing seems to be helping.

@whitehat007 did you get past Invalid ABI specified issue? I have tried everything listed here but nothing seems to be helping.

Nope--still getting the same issue.

@pgroot1997

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

@whitehat007 did you get past Invalid ABI specified issue? I have tried everything listed here but nothing seems to be helping.

Nope--still getting the same issue.

Yeah me too, let me know if you find any breakthrough. I'll also keep this thread updated.
Thanks Man!!

@pgroot1997

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

Did this work on Apple silicon Mac? Also which version of cocoapods and ffi you are on?

This is what I see when I run these commands on my terminal -

Screen Shot 2020-12-22 at 11 34 46 AM

The arch command is also what I'm doing on my M1 mbp. You have to have Rosetta installed for this to works, and that it should work

The arch command is also what I'm doing on my M1 mbp. You have to have Rosetta installed for this to works, and that it should work

I think I have Rosetta installed, I see it in the get info of terminal. Is there a way to be sure?

@bang9

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

it works perfect for me. Thank you!

commented

Working on the FFI gem here: https://github.com/segiddins/ffi/pull/1/files

So what state is this in?

Cool. Would you mind leaving this one open and/or pinning while I work on a fix? I'll tie it to a PR, and that way people who come looking for answers know a fix is in the works

@MatrixSenpai How's it coming? 👍

commented

Cool. Would you mind leaving this one open and/or pinning while I work on a fix? I'll tie it to a PR, and that way people who come looking for answers know a fix is in the works

@MatrixSenpai How's it coming? 👍

Not sure if mentioned here, but in the ffi Github issues, someone found that macOS's Ruby seems to identify the environment as x86_64, even on the m1 without Rosetta active in that terminal session. That's at ffi/ffi#870 (comment). I've heard of it working with rbenv replacing the factory installed version with another. I wish I had all the details but about to give some things a try now.

@andrewfashion
Right now looks like we're mostly waiting on libffi stuff as mentioned above. Best workaround right now is to install cp with the arch -x86_64 flag, or use Rosetta. Until ffi is fully working again on arm, we're kinda stuck.

I should add that this ended up being more complicated than I expected, and work dragged me away from investigation

Cool. Would you mind leaving this one open and/or pinning while I work on a fix? I'll tie it to a PR, and that way people who come looking for answers know a fix is in the works

@MatrixSenpai How's it coming? 👍

Not sure if mentioned here, but in the ffi Github issues, someone found that macOS's Ruby seems to identify the environment as x86_64, even on the m1 without Rosetta active in that terminal session. That's at ffi/ffi#870 (comment). I've heard of it working with rbenv replacing the factory installed version with another. I wish I had all the details but about to give some things a try now.

Ive been trying to use the native version with rbenv, my use case is installing pods dependencies for a React Native project.

When using original ruby it crashed on pod install when installing ffi, saying it is missing compatible arch, when using rbenv version it installs ffi but crashes right after with a segmentation fault, it happens when installing Ethon.

I think Ethan is using ffi and that is generating that segmentation fault.

commented

Cool. Would you mind leaving this one open and/or pinning while I work on a fix? I'll tie it to a PR, and that way people who come looking for answers know a fix is in the works

@MatrixSenpai How's it coming? 👍

Not sure if mentioned here, but in the ffi Github issues, someone found that macOS's Ruby seems to identify the environment as x86_64, even on the m1 without Rosetta active in that terminal session. That's at ffi/ffi#870 (comment). I've heard of it working with rbenv replacing the factory installed version with another. I wish I had all the details but about to give some things a try now.

Ive been trying to use the native version with rbenv, my use case is installing pods dependencies for a React Native project.

When using original ruby it crashed on pod install when installing ffi, saying it is missing compatible arch, when using rbenv version it installs ffi but crashes right after with a segmentation fault, it happens when installing Ethon.

I think Ethan is using ffi and that is generating that segmentation fault.

In a similar situation. I'm not sure which of my dependencies uses Ethon (or typethoes or something is what I thought the problem). I think there is some order things must be done in. Like, install Ruby, install cocoa pods with that version of Ruby, install ffi with it too, then do pod install. But those who have it working 100% are being a little tight lipped on some details.

EDIT: If using rbenv, you can run this curl command to have it check your environment

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /opt/homebrew/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /opt/homebrew/bin/rbenv-install (ruby-build 20201225)
Counting installed Ruby versions: 3 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK

And here is my ~./.zshrc

export PATH="~/.rbenv/shims:/opt/homebrew/bin:/usr/local/bin:$PATH"
alias ibrew='arch -x86_64 /usr/local/bin/brew'

export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

eval "$(rbenv init -)"

export NVM_DIR="$HOME/.nvm"
  [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

Still, with Ruby 2.7.2, I get the ffi error. I'm at a bit of a loss.

@OKNoah

those who have it working are being a little tight lipped on some details

I got it working on a fresh install (using iTerm) by passing the following

arch -x86_64 gem install --user cocoapods ffi
# OR
arch -x86_64 sudo gem install cocoapods ffi

You must have ~/.gem/ruby/<version>/bin in your path if you pass the --user flag
Screen Shot 2021-01-06 at 10 15 47

commented

@OKNoah

those who have it working are being a little tight lipped on some details

I got it working on a fresh install (using iTerm) by passing the following

arch -x86_64 gem install --user cocoapods ffi
# OR
arch -x86_64 sudo gem install cocoapods ffi

You must have ~/.gem/ruby/<version>/bin in your path if you pass the --user flag

OK, but then must I use Xcode in Rosetta, and everything else in x86_64?

I'm not using Xcode in Rosetta. And the only time you need those flags is when installing. Everything else works as normal, at least from my experience

Does anyone have experience with how this works with Xcode Server? In that case, Terminal isn't used so will I need to run Xcode in Rosetta to let bots run cocoapods setup scripts without error?

Remove First

sudo gem uninstall ffi

Step 1
Right-click on Terminal in Finder
Get Info
Open with Rosetta

Step 2
sudo gem install ffi

Step 3
pod install
After doing this, cocoapods runs as expected.

Thanks

Does anyone have experience with how this works with Xcode Server? In that case, Terminal isn't used so will I need to run Xcode in Rosetta to let bots run cocoapods setup scripts without error?

Don't know, haven't used Xcode Server tbh. My guess is that as long as cp and ffi are installed properly, there should be no problem (??) with using that functionality since they should be called as whatever is installed.

@KiranPatelSpaceo pref using the arch flag rather than Rosetta. Not saying that's wrong, but at least for the time being everything else runs in native arm mode

If I use the arch flag solution rather than the Rosetta solution, that sounds like it will alleviate my concern.
(right now I can only get everything to work if I keep Terminal in Rosetta mode; so I was concerned about the same being true of Xcode Server)

make sure you uninstall any previous version of ffi first. In my case, I had both x64 and M1 version of ffi installed so the solution proposed here did not work until I ran this command to uninstall them:

`sudo gem uninstall ffi

Select gem to uninstall:

  1. ffi-1.14.2
  2. ffi-1.14.2
  3. All versions

3

You have requested to uninstall the gem:
ffi-1.14.2
`

@pgroot1997

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

Thanks Man!!

commented

Doesn't seem to work for me. I'm on Apple silicone running Terminal and iTerm2 without Rosetta. Running the same with Rosetta gives the same results.
Screenshot 2021-01-14 at 12 29 46

Most likely your version of ruby. I'm currently using 2.6.3
The other thing you could try is reverting back to system ruby

Doesn't seem to work for me. I'm on Apple silicone running Terminal and iTerm2 without Rosetta. Running the same with Rosetta gives the same results.
Screenshot 2021-01-14 at 12 29 46

You have to try in another terminal window

commented

Thanks for the ideas guys, I managed to solve it. Turns out I did a couple of things in my terminal before enabling Rosetta, which caused strange problems like this. I uninstalled all the gems, ruby and homebrew, made sure Rosetta is enabled and re-do everything again. I'm now facing similar issue with other cocoapods dependency ethon. Unfortunately, unlike ffi, they don't seem to have a compatible version as of now.

/opt/homebrew/lib/ruby/gems/2.7.0/gems/ethon-0.12.0/lib/ethon/curls/infos.rb:127: [BUG] Segmentation fault at 0x0000000000000002

commented

Remove First

sudo gem uninstall ffi

Step 1
Right-click on Terminal in Finder
Get Info
Open with Rosetta

Step 2
sudo gem install ffi

Step 3
pod install
After doing this, cocoapods runs as expected.

Thanks

Gives me

2 warnings generated.
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi  -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -Wall -fexceptions -c -o src/closures.lo /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/closures.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wall -fexceptions -c /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/closures.c  -fno-common -DPIC -o src/.libs/closures.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi  -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -Wall -fexceptions -c -o src/aarch64/ffi.lo /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/aarch64/ffi.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wall -fexceptions -c /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/aarch64/ffi.c  -fno-common -DPIC -o src/aarch64/.libs/ffi.o
/bin/sh ./libtool  --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi  -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src  -c -o src/aarch64/sysv.lo /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/aarch64/sysv.S
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/metheuser/.rbenv/versions/2.7.2/include -I/opt/homebrew/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/include -Iinclude -I/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src -c /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/src/aarch64/sysv.S  -fno-common -DPIC -o src/aarch64/.libs/sysv.o
/bin/sh ./libtool  --tag=CC   --mode=link clang  -Wall -fexceptions  -L/usr/local/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib -o libffi_convenience.la  src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo   src/aarch64/ffi.lo src/aarch64/sysv.lo 
libtool: link: ar cru .libs/libffi_convenience.a src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/aarch64/.libs/ffi.o src/aarch64/.libs/sysv.o 
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: .libs/libffi_convenience.a(ffi.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: .libs/libffi_convenience.a(sysv.o) has no symbols
libtool: link: ranlib .libs/libffi_convenience.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: .libs/libffi_convenience.a(ffi.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: .libs/libffi_convenience.a(sysv.o) has no symbols
libtool: link: ( cd ".libs" && rm -f "libffi_convenience.la" && ln -s "../libffi_convenience.la" "libffi_convenience.la" )
/bin/sh ./libtool  --tag=CC   --mode=link clang  -Wall -fexceptions -no-undefined -version-info `grep -v '^#' /Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi/libtool-version`   '-L/usr/local/opt/openssl@1.1/lib' '-L/opt/homebrew/opt/readline/lib'  -L/usr/local/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib -o libffi.la -rpath /usr/local/lib src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo  src/aarch64/ffi.lo src/aarch64/sysv.lo 
libtool: link: clang -dynamiclib  -o .libs/libffi.8.dylib  src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/aarch64/.libs/ffi.o src/aarch64/.libs/sysv.o   -L/usr/local/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib    -install_name  /usr/local/lib/libffi.8.dylib -compatibility_version 10 -current_version 10.0 -Wl,-single_module
ld: warning: directory not found for option '-L/opt/homebrew/opt/readline/lib'
Undefined symbols for architecture x86_64:
  "_ffi_call", referenced from:
	  _ffi_raw_call in raw_api.o
	  _ffi_java_raw_call in java_raw_api.o
  "_ffi_closure_trampoline_table_page", referenced from:
	  _ffi_trampoline_table_alloc in closures.o
  "_ffi_prep_cif_machdep", referenced from:
	  _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_cif_machdep_var", referenced from:
	  _ffi_prep_cif_core in prep_cif.o
  "_ffi_prep_closure_loc", referenced from:
	  _ffi_prep_closure in prep_cif.o
	  _ffi_prep_raw_closure_loc in raw_api.o
	  _ffi_prep_java_raw_closure_loc in java_raw_api.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libffi.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** ["/Users/metheuser/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ffi-1.14.2/ext/ffi_c/libffi-arm64-darwin20"/.libs/libffi_convenience.a] Error 2

make failed, exit code 2

I feel like this isn't a complete guide, and I've yet to see one. This I did with ruby 2.7.2. So should I have done this with 2.6.0 (system)? So do I install Cocoapods through brew or gem? Do I install libffi through brew?

commented

After uninstall most gems and ruby versions, I was able to get this far:

Downloading dependencies
Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.63.4)
Installing FBReactNativeSpec (0.63.4)
Installing Folly (2020.01.13.00)
Installing RCTRequired (0.63.4)
Installing RCTTypeSafety (0.63.4)
Installing RNCAsyncStorage (1.12.1)
Installing RNCMaskedView (0.1.10)
Installing RNGestureHandler (1.8.0)
Installing RNReanimated (1.13.1)
Installing RNScreens (2.12.0)
Installing RNVectorIcons (7.1.0)
Installing React (0.63.4)
Installing React-Core (0.63.4)
Installing React-CoreModules (0.63.4)
Installing React-RCTActionSheet (0.63.4)
Installing React-RCTAnimation (0.63.4)
Installing React-RCTBlob (0.63.4)
Installing React-RCTImage (0.63.4)
Installing React-RCTLinking (0.63.4)
Installing React-RCTNetwork (0.63.4)
Installing React-RCTSettings (0.63.4)
Installing React-RCTText (0.63.4)
Installing React-RCTVibration (0.63.4)
Installing React-callinvoker (0.63.4)
Installing React-cxxreact (0.63.4)
Installing React-jsi (0.63.4)
Installing React-jsiexecutor (0.63.4)
Installing React-jsinspector (0.63.4)
Installing ReactCommon (0.63.4)
Installing Yoga (1.14.0)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.5)
[!] /bin/bash -c 
set -e
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH}"

if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then
	# Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg.
	# it's better to rely on platform name as fallback because architecture differs between simulator and device

	if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then
		CURRENT_ARCH="x86_64"
	else
		CURRENT_ARCH="armv7"
	fi
fi

export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"

# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
	rm test-driver
fi

./configure --host arm-apple-darwin

# Fix build for tvOS
cat << EOF >> src/config.h

/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif

/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif

/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF

# Prepare exported header include
EXPORTED_INCLUDE_DIR="exported/glog"
mkdir -p exported/glog
cp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/"

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot 
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
/Users/metheuser/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing: Unknown `--is-lightweight' option
Try `/Users/metheuser/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/metheuser/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13':
configure: error: C compiler cannot create executables
See `config.log' for more details


Aborting run
An unexpected error was encountered. Please report it as a bug:
Error
	at CocoaPodsPackageManager._installAsync (/Users/metheuser/.npm/_npx/7cf525d1e16b4e35/node_modules/pod-install/build/index.js:2:76150)
	at processTicksAndRejections (node:internal/process/task_queues:93:5)
	at async CocoaPodsPackageManager.installAsync (/Users/metheuser/.npm/_npx/7cf525d1e16b4e35/node_modules/pod-install/build/index.js:2:75550)
	at async runAsync (/Users/metheuser/.npm/_npx/7cf525d1e16b4e35/node_modules/pod-install/build/index.js:2:9010)
	at async /Users/metheuser/.npm/_npx/7cf525d1e16b4e35/node_modules/pod-install/build/index.js:2:9096

npm ERR! code 1
npm ERR! path /Users/metheuser/Projects/tiny-universal
npm ERR! command failed
npm ERR! command sh -c pod-install

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/metheuser/.npm/_logs/2021-01-17T06_19_36_904Z-debug.log

Which seems like a huge step froward, but why can't it find iphoneos SDK?

Remove First

sudo gem uninstall ffi

Step 1
Right-click on Terminal in Finder
Get Info
Open with Rosetta

Step 2
sudo gem install ffi

Step 3
pod install
After doing this, cocoapods runs as expected.

Thanks

It didn't work for me, I did the same thing on Mac mini M1, But i still get this error : "dlsym(0x7f860f6d6d60, Init_bigdecimal): symbol not found - /Library/Ruby/Gems/2.6.0/gems/bigdecimal-2.0.2/lib/bigdecimal.bundle (LoadError)"

For anyone else struggling with this issue, I just found a way to solve it. In addition to running terminal in Rosetta (see above), I installed a gem that seems to be related to the symbol not found in the error:

sudo gem install ffi

After doing this, cocoapods runs as expected.

Oh, Maybe I didn't pray to God, cocoapods didn't work as expected. When I run this command " flutter doctor ", flutter prompts me "cocoapods installed but not working".

Commenting just to add some results using a newly purchased and almost pristine Macbook Pro M1. Obviously the sudo gem install cocoapods regular didn't work for flutter, so I tried following workarounds with the flutter stable channel as of 1.22.5:

  • sudo arch -x86_64 gem install ffi didn't work either.
  • Installing ruby 3.0 using brew and gem install cocoapods resulted in a segfault at somewhere between ethon and ffi.
  • arch -x86_64 gem install --user cocoapods and adding ~/.gem/ruby/2.6.0/bin to PATH and trying caused various pod dependency version errors in XCode and the build failed.
  • Installed ruby@2.7 from brew and tried installing cocoapods using gem from ruby@2.7. It works for some projects and doesn't work for others (if they have too many dependencies, I guess).

From the segfault, I feel that I'll have to wait for the ffi to get fixed or try to help in any way I can.

anyone experiencing this issue on when running cocoapod on GitHub actions? I've been struggling to find a solution for that.

commented

@whitehat007 Have you solve this problem? I create an issue here

We fixed our Flutter iOS build on Apple M1 problems with git clean -f -d -x and git checkout ..

On each mac with problems, we migrated from our older macs using migration assistant, which copied older build output in build/ios over to new M1 machines along with the rest of the home directory. Build output generated on an intel mac was probably breaking various things and git clean to remove all generated data did the trick for us. All seems to be well for Flutter builds, Rosetta is not needed for ffi it seems.

However, pod repo update fails like this, but that's less of a problem now that the build seems to be working:

   CocoaPods : 1.10.1
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
    RubyGems : 3.2.6
        Host : macOS 11.1 (20C69)
       Xcode : 12.3 (12C33)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
-------
cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

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

@pgroot1997

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

For anyone using a non-system ruby with rbenv and facing issues with ffi - switching to the system ruby (atleast locally in the project directory) and following the above steps helped me

commented

Hello guys, so the only fix I have for this is to create a NEW flutter project and move your code and other dependencies from your old project to the new one. Unfortunately, this is very tedious but should take less than a day. It sorts out many problems very easily. I only found this to occur on projects that I started on my windows machine and cloned to my Silicon Mac. This seems to be the only long-term solution that works, though I know a lot of you are hesitant to creating a new project and doing all of that.
But after all of this, you should have no problem with continuing your coding endeavor!

Thank You @master950, Worked on Mac Mini M1

Remove First

-->. sudo gem uninstall ffi

Step 1
Right-click on Terminal in Finder
Get Info
Open with Rosetta

Step 2
--> sudo gem install ffi

Step 3
-->. pod install
After doing this, cocoapods runs as expected.

Thanks

❗ WORKAROUND ❗
Wrote a small post. My first published post :) https://armen-mkrtchian.medium.com/run-cocoapods-on-apple-silicon-and-macos-big-sur-developer-transition-kit-b62acffc1387

This worked for me like a charm.

arch -x86_64 pod install works for me, its same as opening terminal with rosseta 2

I was able to get past bundle exec pod install by downgrading to Cocoapods 1.8

I updated my Gemfile to the following:

gem 'cocoapods', '~>1.8.0'

@ldstreet Did you succeed to install with Cocoapdos v1.8 via bundler?

@ldstreet Did you succeed to install with Cocoapdos v1.8 via bundler?

Yep. Now hitting some issues with my test specs not running unless embedded in a host application...but other than that it's building.

@ldstreet Oh... It sounds very hopeful to me 😅
Thank you!

Thanks for the ideas guys, I managed to solve it. Turns out I did a couple of things in my terminal before enabling Rosetta, which caused strange problems like this. I uninstalled all the gems, ruby and homebrew, made sure Rosetta is enabled and re-do everything again. I'm now facing similar issue with other cocoapods dependency ethon. Unfortunately, unlike ffi, they don't seem to have a compatible version as of now.

/opt/homebrew/lib/ruby/gems/2.7.0/gems/ethon-0.12.0/lib/ethon/curls/infos.rb:127: [BUG] Segmentation fault at 0x0000000000000002

@lawicko you have any luck resolving this? I'm facing the seg fault too

commented

@lawicko you have any luck resolving this? I'm facing the seg fault too

@nikitaame Nope, but there is a ticket in the ethon repository for this:
typhoeus/ethon#172 (comment)

I am now able to bundle exec pod install on cocoapods 1.10 after upgrading to MacOS 11.2. I am using rbenv for my Ruby installation.

@pgroot1997

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

For anyone using a non-system ruby with rbenv and facing issues with ffi - switching to the system ruby (atleast locally in the project directory) and following the above steps helped me

Best so far...

Native ARM support is on the road,
see #10408

Native ARM support is on the road,

see #10408

Brew is close to full ARM support as well, so this does not surprise me, but it's very exciting to see confirmed!

commented

For anyone else struggling with this issue, I just found a way to solve it. In addition to running terminal in Rosetta (see above), I installed a gem that seems to be related to the symbol not found in the error:

sudo gem install ffi

After doing this, cocoapods runs as expected.

Thank you! This solved my problem!

Regards.

I'm currently working on fixing the ethon gem for it to work on ARM Macs. It's currently in a state where it is working on my local machine.

First, please DO NOT go to each repository and ask the maintainers to review code or make a release. Especially it the maintainer explicitly said that they don't have much spare time.
It is not your time you are making use of.

So if bundle exec pod install or bundle exec pod repo update trunk is crashing for you on an M1 Mac, adding the following lines to you Gemfile and then running bundle install might fix it. No warranty, it might depend on your environment. And do not forget to remove those once the next version of ffi and ethon get released.

# Do not forget to remove the following line once ffi > 1.14.2 gets released
gem 'ffi', git: 'https://github.com/ffi/ffi.git', branch: 'master'
# Do not forget to remove the following line once ethon > 0.12.0 gets released
gem 'ethon', git: 'https://github.com/vincentisambart/ethon.git', branch: 'fix-func-def'

The changes on the ffi gem side have been merged but not yet released (DO NOT go to the ffi repository and ask for a release).
There is no PR on the ethon gem side yet as the next version of ffi gem has to be released first.

You can easily check the quick and dirty changes that I made to ethon: typhoeus/ethon@master...vincentisambart:fix-func-def
When the fix gets into ethon, it will probably be a bit different as this just a quick and dirty change I made to make sure my idea works.

You can find a more complete description of the problem at typhoeus/ethon#180

Hi, everyone

I have a Mac Air 2020 M1, for me work to adjust a Rosseta Mode in the terminal like you see in this link: Link for Adjust Rosseta mode in the Terminal App
and after install ffi, that way:
sudo gem install ffi

I solve my problem thanks too much

arch -x86_64 pod install

$ arch -x86_64 pod install
arch: posix_spawnp: pod: Bad CPU type in executable

@rayt8909 Try installing Rosetta 2 first (run softwareupdate --install-rosetta to do that manually)

@rayt8909 Try installing Rosetta 2 first (run softwareupdate --install-rosetta to do that manually)

i am running on a new mac mini / big sur / M1 processor.

Installing Rosetta 2 on this system is not supported.

@rayt8909 This is getting off-topic but I am writing you from a MacBook Air with M1 on Big Sur with Rosetta 2 installed

@rayt8909 This is getting off-topic but I am writing you from a MacBook Air with M1 on Big Sur with Rosetta 2 installed

I have our I. T. guy checking it out. Thanks for the info. Ray

Has there been any updates on a fully compatible version of cocoa pods for m1? thanks!

@andrewfashion I am following #10408, @jasl posted about it Feb, 7th. Gives a pretty good status about this imo.

Edit: Having a second look, that looks a bit unchanged since then.

I followed the steps outlined by @armen-outco:

  1. Set Terminal to run with Rosetta (Applications > Utilities > Right-select 'Terminal' > Select 'Run with Rosetta')
  2. Ran sudo gem install ffi
  3. Restarted the computer

I was then able to run 'pod install' with success.

Does not work for me @BCWoodard :(

I'm currently working on fixing the ethon gem for it to work on ARM Macs. It's currently in a state where it is working on my local machine.

First, please DO NOT go to each repository and ask the maintainers to review code or make a release. Especially it the maintainer explicitly said that they don't have much spare time.
It is not your time you are making use of.

So if bundle exec pod install or bundle exec pod repo update trunk is crashing for you on an M1 Mac, adding the following lines to you Gemfile and then running bundle install might fix it. No warranty, it might depend on your environment. And do not forget to remove those once the next version of ffi and ethon get released.

# Do not forget to remove the following line once ffi > 1.14.2 gets released
gem 'ffi', git: 'https://github.com/ffi/ffi.git', branch: 'master'
# Do not forget to remove the following line once ethon > 0.12.0 gets released
gem 'ethon', git: 'https://github.com/vincentisambart/ethon.git', branch: 'fix-func-def'

The changes on the ffi gem side have been merged but not yet released (DO NOT go to the ffi repository and ask for a release).
There is no PR on the ethon gem side yet as the next version of ffi gem has to be released first.

You can easily check the quick and dirty changes that I made to ethon: typhoeus/ethon@master...vincentisambart:fix-func-def
When the fix gets into ethon, it will probably be a bit different as this just a quick and dirty change I made to make sure my idea works.

You can find a more complete description of the problem at typhoeus/ethon#180

This was the only thing so far that has worked for me, AND I had to change nothing about my current setup aside from adding to my Gemfile. Thank you for the great workaround and all the hard work @vincentisambart!

As an update, my changes to the ffi gem have been merged and are included in 1.15. My changes to the ethon gem have been merged but not yet released. So the line below is the only change to Gemfile that should be needed.

# Do not forget to remove the following line once ethon > 0.12.0 gets released
gem 'ethon', git: 'https://github.com/typhoeus/ethon.git', branch: 'master'