Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading plugin on M1 mac #217

Open
simonmcl opened this issue Apr 30, 2021 · 27 comments
Open

Error loading plugin on M1 mac #217

simonmcl opened this issue Apr 30, 2021 · 27 comments

Comments

@simonmcl
Copy link

simonmcl commented Apr 30, 2021

I've just gotten an M1 mac and trying to install everything and run a project that uses cocoapods keys. Its working if I run pod install with

arch -x86_64 pod install  

Other users on this thread: CocoaPods/CocoaPods#9907 are reporting that if you update the pre-installed ruby version to at least 2.7.3, that it all works natively without the new for arch -x86_64. However when I do that, i get an error that ruby_inline/ruby-2.6.0 is not compatible.

 % pod install

---------------------------------------------
Error loading the plugin `cocoapods-keys-2.2.1`.

LoadError - dlopen(/Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.bundle, 0x0009): could not use '/Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.bundle' because it is not a compatible arch - /Users/simonmcloughlin/.ruby_inline/ruby-2.6.0/Inline_OSXKeychain_5b2f8d1cd1bde9c4ff3fea49f09cd5c1.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/RubyInline-3.12.5/lib/inline.rb:526:in `load'
/Library/Ruby/Gems/2.6.0/gems/RubyInline-3.12.5/lib/inline.rb:860:in `inline'
/Library/Ruby/Gems/2.6.0/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:17:in `<class:OSXKeychain>'
/Library/Ruby/Gems/2.6.0/gems/osx_keychain-1.0.2/lib/osx_keychain.rb:6: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-keys-2.2.1/lib/keyring.rb:1: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-keys-2.2.1/lib/cocoapods_plugin.rb:1: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/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `block in safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:94:in `safe_activate_and_require'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:31:in `block in load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in `map'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command/plugin_manager.rb:30:in `load_plugins'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:326:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:325:in `each'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:325:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
---------------------------------------------

I know nothing bout ruby or these tools. I'm assuming the inline version of ruby needs to be updated. Is this something you could do and cut a new release?

@ashfurrow
Copy link
Collaborator

ruby_inline I think is only used to access the macOS Keychain API in C. osx_keychain appears to be the problematic code, which appears to be hosted here: https://github.com/seattlerb/osx_keychain

I don't have an M1 Mac and I don't use this library day-to-day anymore, so I don't really have the capacity or ability to help fix this. I know you said Ruby is unfamiliar, but with some digging I have no doubt you could resolve this problem, either by fixing the underlying issue with the build architecture, or workaround around it by using x86 emulation for the whole CocoaPods chain. It seems daunting at first but I bet you could do it, and write a really satisfying blog post afterwards too 😉 If you're keen, I can put a call our on Twitter for someone to offer assistance. Good luck!

@midhetfatema94
Copy link

midhetfatema94 commented Jul 2, 2021

I am having the exact same issue 😭😭😭 @ashfurrow @simonmcl please let me know if you find some solution :/

@midhetfatema94
Copy link

Okay @simonmcl, I think try opening the terminal with Rosetta and it will work for you! It worked for me 😊

@jiayangmiao
Copy link

jiayangmiao commented Jul 13, 2021

Okay @simonmcl, I think try opening the terminal with Rosetta and it will work for you! It worked for me 😊

@midhetfatema94 Hi there, would you kindly tell the rest of us how you managed to resolve the issue?
Did you install cocoapods / cocoapods-keys with normal arm64 terminal ..?
I have tried a bunch of things but couldn't make it work so any advices will help a lot.

Thank you in advance.

@midhetfatema94
Copy link

Hi @jiayangmiao @simonmcl

The thing I actually did was open Terminal in Rosetta. (You can Click Cmd+option+i) in the Finder after selecting Terminal. This run the cocoapods-key plugin without any problems but did not make any changes. So I then cloned my repo on my Intel Macbook > installed the key > airdropped it to my m1! I realize that this solution is not optimal, I had to do what I had to do 🙈

@jiayangmiao
Copy link

@midhetfatema94 Thank you very much for the reply!

Even though I made it work without doing what you did, I figured this might help someone else and here is the steps I taken.
Nothing was run by rosetta, all just normal terminal in arm64

  1. install homebrew for rbenv, install 2.7.3, global 2.7.3, add rbenv to .zshrc, source, all that sort of stuff.
  2. make sure, make sure ruby -v was saying 2.7.3
  3. gem install cocoapods and cocoapods-keys, not through sudo, not with homebrew.
  4. pod install.

@dyegos
Copy link

dyegos commented Sep 21, 2021

Does anyone have a solution for this issue or found what could be the problem? We are using Cocoapods Keys, and unfortunately it does not work. Using cocoa pods with home brew and then installing cocoa pods keys does not work as well, cocoa pods does not recognise the plugin.

@midhetfatema94
Copy link

Hi @dyegos,

Although the problem is clear that the build is not compatible with the new M1 system architecture, a solution has not been discovered yet. What you can do to make your cocoapod keys work is use XCode & Terminal in Rosetta.

@dyegos
Copy link

dyegos commented Sep 21, 2021

Thank you for your comment @midhetfatema94!
I believe that we tried to use terminal using Rosetta (probably iTerm2) and it did not work. I am gonna try again using both in Rosetta, or just comment it out for a while.

I wish I could help with something, to make it work in M1. I think I don't have enough knowledge for that.

Thank you.

@kluku
Copy link

kluku commented Oct 25, 2021

Hi @midhetfatema94,

running the Terminal and XCode in Rosetta didn't help us, perhaps because we still need to install command-line tools for the x86 mode (xcode-select --install on the terminal in rosetta mode). We'll see if it helps, anyway, the pod doesn't install for now and we're stuck.

@midhetfatema94
Copy link

midhetfatema94 commented Oct 25, 2021

@kluku also trying adding the architecture config to your target. Be careful if you are using this with a CI/CD deployment and the environment setup on the build server is different from yours... This could create some deployment issues.

@dyegos
Copy link

dyegos commented Oct 26, 2021

I got it to work using Homebrew, rbenv and bundler all of it with arch commands. No Rosetta needed.
I can share it if anyone would like it.

@xanderbuck
Copy link

@dyegos could you share please!!

@xanderbuck
Copy link

Update: 10/28/21

I tried every suggestion after many hours of troubleshooting and the only solution that worked for me was following @jiayangmiao instructions above. Make sure you install ruby 2.7.3. I thought I could get by with version 2.7.4 but that didn't work. If you don't have any experience with rbenv like me, I found this tutorial helpful here.

@dyegos
Copy link

dyegos commented Oct 29, 2021

@xanderbuck These are the steps I used. I attached the file. I hope it helps someone else. 10/29/2021
HowToSetupCocoapodskeys.txt

If after doing that you have any problem with LLDB in Xcode, please run chsh -s /bin/bash. It did not happen to me, but to my colleague. Just in case.

Credits to https://github.com/igorcferreira

@yostyle
Copy link

yostyle commented Jan 5, 2022

Thanks to @xanderbuck and @jiayangmiao
You don't need to use arch command. Just install ruby 2.7.3

  1. install rbenv
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
  1. install and switch to ruby 2.7.3
rbenv install 2.7.3
rbenv global 2.7.3
  1. make sure ruby -v was saying 2.7.3
  2. install cocoapods and cocoapods-keys, not through sudo, not with homebrew.
    gem install cocoapods cocoapods-keys
  3. install pod packages
    pod install

@OmarJalil
Copy link

@jiayangmiao @yostyle
Why ruby 2.7.3? And not 3.1.0? Or another version?
Also, thank you! Because it works.

@jflavio11
Copy link

Thank you, @yostyle! 💯
I would like to know: how did you get to the solution? I think I would've never got to this 🥲

@jiayangmiao
Copy link

jiayangmiao commented May 3, 2022

I don't remember the details, but it was not 3.0 because my intel Mac at that time worked and it was running something 2.x, and the Mac usually comes with a ruby release that's 2.x as well.

I probably was running under some other restrictions for other libraries, and additionally looked at the dependencies of other libraries that were emitting error. Now I don't interact with this library for my work so the memory is not fresh, but one day I might revisit this and write up something about it.

@rsenerol
Copy link

Hi, I've tried the solution described above that involves installing Ruby 2.7.3 with rbenv. When doing so, I get an error (see below). Is the solution above still valid for latest version of macOS? Should I consider dropping this plugin for development on M1 machines?

Error:

Downloading openssl-1.1.1q.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
Installing openssl-1.1.1q...

BUILD FAILED (macOS 12.4 using ruby-build 20220710)

Inspect or clean up the working tree at /var/folders/6m/m0blyx852ysfp214tcvv3m_40000gn/T/ruby-build.20220714161205.75382.xdcE3o
Results logged to /var/folders/6m/m0blyx852ysfp214tcvv3m_40000gn/T/ruby-build.20220714161205.75382.log

Last 10 log lines:
clang  -Iinclude -arch x86_64 -O3 -Wall -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/raffis/.rbenv/versions/2.7.3/include  -MMD -MF test/verify_extra_test.d.tmp -MT test/verify_extra_test.o -c -o test/verify_extra_test.o test/verify_extra_test.c
clang  -Iinclude -arch x86_64 -O3 -Wall -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/raffis/.rbenv/versions/2.7.3/include  -MMD -MF test/versions.d.tmp -MT test/versions.o -c -o test/versions.o test/versions.c
test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
        if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
                       ^
test/v3ext.c:201:24: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
1 error generated.

Current setup:
Macbook Pro M1 Max
macOS Monterey 12.4

@Re-recursion
Copy link

Re-recursion commented Oct 31, 2022

Hello, I too have tried the above solution of installing Ruby 2.7.3 via rbenv - I get as far as running:

gem install cocoapods cocoapods-keys
and getting : 2 gems installed.

After running pod install, I get :

[!] Your Podfile requires that the plugin cocoapods-keysbe installed. Please install it and try installation again.
Running pod keys command results in:

[!] Unknown command: `keys`
Did you mean: try?

Current setup:
MacBook Pro M1 Pro
macOS Monterey 12.6
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [arm64-darwin21]

@sawalon
Copy link

sawalon commented Nov 5, 2022

@xanderbuck These are the steps I used. I attached the file. I hope it helps someone else. 10/29/2021 HowToSetupCocoapodskeys.txt

If after doing that you have any problem with LLDB in Xcode, please run chsh -s /bin/bash. It did not happen to me, but to my colleague. Just in case.

Credits to https://github.com/igorcferreira

Its save my time. Thanks bro.

@eduardo-calzado-ag
Copy link

Same issue here. I have tried all the stuff:

I'm about to remove cocoapod-keys.

@magnett
Copy link

magnett commented Nov 16, 2022

Unfortunately I couldn't find a solution either and I had to remove it too. It's a shame because it was a good project.

@MhMudSalAh
Copy link

Your Podfile requires that the plugin cocoapods-keys be installed. Please install it and try installation again.

I have this error in M1 MAX & Monterey 12.6.1 & Xcode 14.1 & ruby version 3.1.2

I couldn't solve this problem with all possible solutions
and I did all steps in this Article
and setup "gem install cocoapods-keys" and I have the same error, however I have ruby version 3.1.2
Can anyone solve this problem ?!!

@justinkumpe
Copy link

justinkumpe commented Nov 27, 2022

Unfortunately I couldn't find a solution either and I had to remove it too. It's a shame because it was a good project.

@magnett so what did you use in place of cocoapods-keys? I'm about ready to ditch it myself.

@tritter
Copy link
Contributor

tritter commented Dec 5, 2022

Please checkout my PR: #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests