-
Notifications
You must be signed in to change notification settings - Fork 336
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
1.14.2: missing compatible arch in ffi_c.bundle on M1 Mac mini with system Ruby #870
Comments
I've seen many solutions. Some install ffi via brew in x86_64 mode, others in native. None have worked for me. There's also the option of compiling yourself, although I don't know all the steps and don't think it helps. |
Running in x86 (Rosetta) mode is not a solution and more a workaround. Native support would be much better. |
Hmm so y'all can confirm there is a bug with |
Any idea if there's work on to fix it in the near future? I wish I could help, but I'm not familiar with this low level stuff at all. |
@venkatasg Have to correct myself, the issue seems to be the version jekyll is depending on. Jekyll still depends on 1.13 while the support for M1 seems to have been implemented in 1.14. For now the only solution seems to be the rosetta workaround: Install: |
Thank you so much! Should we open an issue on the |
You're welcome! Both projects need to update, but as long as the problem resides in ffi on M1 I think it makes no sense for jekyll to update its dependencies. |
Fwiw, native |
After playing around a bit I found out that the pre-installed ruby on macOS seems to falsely recognize the CPU as x86, no matter what you tell it to do:
So the problems seems to be more deeply than we thought and we might just have to wait for Apple to update the pre-installed ruby. |
I guess we need to file a Feedback/Radar with Apple then? I might get around to it sometime, but I've never gotten any response on any of the feedbacks I've filed thus far, so I've learnt never to place high trust in that. Should I close this issue? |
What's so frustrating is some say that everything works fine, but don't say whether they used the solution and/or workaround they used. So it's been very frustrating. I was hoping for a constructive reply, but dismayed that even though I clearly said "in x86_64 mode" you'd have some subjective semantical objection to a word in the previous sentence. Anyway, it's hard to tell if anyone has it working natively or not. |
This might explain reports of only using Rosetta to install ffi as a fix for some projects/frameworks. But I think those have all been early victories, that lead to folks needing to use Rosetta for everything else too. Could using another installation of Ruby be a better option for now? |
It seems to be the only "solution" for now and it might be an explanation why some people are reporting they have no problems and / or run ruby natively. I just think some people might not have the permissions to install custom ruby installations, so this is no option for them. Nevertheless it's still a bug, that the ruby universal binary is not choosing the correct architecture which needs to be fixed by Apple. |
Look, I want to share your discovery above in other threads on the topics. And I'd love to include what you or this community suggest is the best resolution until one comes from Apple. I know when I make posts, I sometimes feel they're glossed over and it's annoying. Then I've made responses that try redirect attention to my post. So, sorry if I didn't praise your discovery at the time. But I have the link in my clipboard to show others, I was just asking you and company that since we now know more or less where the problem lies, what's the best way to keep working while we wait for Apple's vaccine? While I hope most @sanzaru has a temporary method, I ask you you only reply with it if you do, and not to reply at all if it's to tell me only how you would have worded something or other different. I'm just finding that irritating right now (if not always). Open to everyone's thoughts that may help folks get through the wait. Thank you. |
What version did you install? |
$ rbenv which ruby
/Users/kameliya/.rbenv/versions/2.7.2/bin/ruby
$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20] |
Apple added deprecation notices to the system Ruby installation starting in 10.15 (Catalina). Fire up
I'm not entirely sure how users are supposed to know about this though, I just recall it being reported at the time. Might as well be on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying “Beware of the Leopard.” @venkatasg you're "using the system ruby and bundle" which goes against this recommendation and that of the article, which tells you to go to the Ruby site for installation options, not use the preinstalled one. Again I'm not faulting you here, it's a frustrating/confusing situation for sure when these utilities are "available" but often ancient and/or broken.
@sanzaru could you provide the script you used? I can help file a radar and share the appropriate Open Radar here if no one is doing that. |
That's interesting. I didn't know about this warning at all. Could be more transparent for devs...
Of course. It was quite simple: require 'rbconfig'
OSVERSION = RbConfig::CONFIG['host_os']
CPU = RbConfig::CONFIG['host_cpu']
ARCH = RbConfig::CONFIG['arch']
puts "OS: #{OSVERSION}"
puts "CPU #{CPU}"
puts "Arch: #{ARCH}" I found out that the RbConfig module (rbconfig.rb) seems to be the problem as it was compiled for x86 and therefore always returns that value when reading the module. Hope I can publish a detailed article about that, soon. |
Sorry, do you need to put this file somewhere and then compile Ruby? |
You can put it in a file (e.g. call it |
Is there any obvious fix for |
Sorry but where do I run 'arch -arch x86_64 bundle install`? It says no gem file found. Please help! |
@StupidRepo Make sure to run the command inside a folder that contains a Gemfile. |
Thank you but when setting it up I get |
I did run the command it told me to run (
|
It seems one solution is to run whole terminal in Rosetta mode (go to apps -> tools -> terminal -> right click -> get info -> open using rosetta) and then install everything in that mode (I use XCode in rosetta and that works for my mobile dev env) - but personally I gave up on that idea - you have to juggle with |
Nope, still doesn't work for me when in Rosetta |
Any status update on that? |
@mkocus: At least as of 2021-06-21: if you make sure to install ruby from homebrew, and make sure |
I go this when I ran the command
|
@Basitomania Did you install Rosetta? This error normally occurs when Rosetta is missing. Try: |
For me, it seems that I got 2 different versions of ffi and it was choosing the bad one so first uninstall both: |
I've been working around this by using devcontainer in vscode: https://github.com/DelfinaCare/jekyll-devcontainer or microsoft/vscode-dev-containers#1038 as examples |
from an Above comment :
This worked for me! here's how... I'm using an Apple M1 Mac Mini , running Big Sur 11.6 some notes on the solution: It was important for me to realize I was using zsh now, instead of Bash like I was used to on my old Mac laptop. This is a new default, so I installed Oh My Zsh to make things easier going forward for myself. ymmv. Homebrew installation of ruby did me dirty because there was a command that is supposed to update the $PATH, but it wasn't working. This was due to homebrew some how, I forget now sorry I should have noted it... but anyways, I uninstalled the home-brew version of ruby. No matter what with this home-brew version, when I typed So I installed a fresh ruby after deleting the home-brew ruby. The next hurdle was how to tell the system to use this 3.x x version of ruby by default and not the 2.x.x oldie one. For this, I installed a 'manager' called 'asdf', which allowed me to fix the issues with my $PATH. After following the asdf install instructions, what worked in the end was running Then when I typed Then, with ruby working, I moved on to jekyll. I followed this advice to uninstall my accidental jekyll installs just to start fresh to not mess myself up somehow. turns out I had a few extra installs so I nuked them all and followed the generic instructions to get my fresh install. I thought everything was done right but then I encountered this thread's main topic, the issue with the m1 chip. So after having installed jekyll, then
then
Thank you :) |
Got it to work by using system ffi :
|
When I run the command |
I had an existing Jekyll project that hit the ffi issue. It was already placing all code into vendor/bundle I was able to install a new libffi with brew, setup things to use it rather than the system version, and then the bundle install succeeded (which included the ffi gem).
|
pod install worked after I ran this. Thanks @charlesvallieres |
Was running similar problems with Flutter and cocoapods. From here, https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon the following worked for me:
|
This did the trick for me! Thanks Stef! |
On my M1, I enabled rosetta on xcode and terminal, to support older projects.
PS: I'm using cocoapods from gem and not from brew. |
@sanzaru Perhaps Apple preinstalled
Below are some results from macOS Ventura 13.4 (22F66). which -a ruby
# /usr/bin/ruby
ruby -v
# ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22]
ruby test.rb
# OS: darwin22
# CPU aarch64
# Arch: universal-darwin22
arch -x86_64 ruby test.rb
# OS: darwin22
# CPU x86_64
# Arch: universal-darwin22
arch -arm64 ruby test.rb
# OS: darwin22
# CPU aarch64
# Arch: universal-darwin22
arch -arm64e ruby test.rb
# OS: darwin22
# CPU aarch64
# Arch: universal-darwin22
arch -c -arch x86_64 ruby test.rb
# OS: darwin22
# CPU x86_64
# Arch: universal-darwin22
arch -c -arch arm64 ruby test.rb
# OS: darwin22
# CPU aarch64
# Arch: universal-darwin22
arch -c -arch arm64e ruby test.rb
# OS: darwin22
# CPU aarch64
# Arch: universal-darwin22 |
This worked for me on an M2 mac pro, I am not using rosetta |
I had these issue a few minutes ago. Sound weird, but the solution was to start Xcode. I updated Xcode a few days ago and the licence had to be acknoledged, after that I could run |
I'm trying to build my Github Pages website locally on my M1 mac Mini using this guide. For now, Im trying to create a dummy GitHub Pages site following that guide command by command. However, whenever I execute
bundle exec jekyll new --force --skip-bundle .
orbundle exec jekyll serve
, I get the following error:I'm using the system ruby and bundle installed on macOS Big Sur. I've tried a bunch of troubleshooting steps -- they all seem to point to an issue with ffi-1.14.2 loading the
ffi_c.bundle
. Any help would be appreciated.Happy New Year!
The text was updated successfully, but these errors were encountered: