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
Segmentation fault on M1 macOS Big Sur #864
Comments
Is there anything those of us with M1 devices can do to help debug this? |
I had this exact error when I installed
Uninstalling the homebrew ruby and using the system ruby got rid of the crash in my case. The root cause may be some sort of architecture mismatch. The system ruby reports itself as being x86 for legacy purposes: #870 (comment) The homebrew ruby is |
Yeah, it's certainly possible to do an x86_64 thing with system Ruby (to avoid the But what we're saying in this ticket is more accurately: segmentation fault on M1 when actually using M1 and not just faking x86 😄 |
I've read all the (I just wanted to run |
In case a more minimal reproduction would help: $ ruby --version
ruby 2.7.2p137 (2020-10-01) [arm64-darwin20]
$ ruby -e 'require "rbconfig"; pp RbConfig::CONFIG' | grep "cpu"
"target_cpu"=>"arm64",
"host_cpu"=>"aarch64",
"build_cpu"=>"aarch64",
$ ruby -e 'require "ffi";; module MyLib; extend FFI::Library; ffi_lib "c"; attach_function :puts, [:string], :int; end'
/Users/jon/.gem/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000103cd8000
ruby 2.7.2p137 (2020-10-01) [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.
... Full crashlog is attached. |
I might be nuts, but using that test case @jdelStrother, this looks to be fixed in 1.15.0. wrb@Ryans-Mac-mini ethon % bundle | grep ffi
Using ffi 1.15.0
wrb@Ryans-Mac-mini ethon % bundle exec ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
wrb@Ryans-Mac-mini ethon % bundle exec ruby -e 'require "rbconfig"; pp RbConfig::CONFIG' | grep "cpu"
"target_cpu"=>"arm64",
"host_cpu"=>"arm",
"build_cpu"=>"arm",
wrb@Ryans-Mac-mini ethon % bundle exec ruby -e 'require "ffi";; module MyLib; extend FFI::Library; ffi_lib "c"; attach_function :puts, [:string], :int; end'
wrb@Ryans-Mac-mini ethon % |
Hmph. I installed my version of Ruby from Nix, whose support for darwin-arm is pretty experimental. Maybe that's affecting things - did you install from source? |
Mine is rvm
|
Same error here using ffi 1.15.0
|
Same here on M1 |
Same here on M1. Just got M1, didn't install any different versions of ruby or do anything with homebrew. My steps: installed Xcode, installed ffi via
|
if I install it with
and pod install with:
It all works fine on the latest xcode. Others are reporting upgrading the pre-installed ruby to at least 2.7.3 fixes everything and allows you to run it all natively. This currently doesn't work for me using |
Same error with ffi 1.10.0 $ rake db:migrate
/Users/keithwong/.rvm/gems/ruby-2.6.6/gems/ffi-1.10.0/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001011ac000 |
I was having the same issue with Ruby 2.6.7 + FFI 1.10.0 on my M1 MacBook Pro. Interestingly, Ruby 2.6.5 + FFI 1.10.0 was working just fine. I was able to do a diff on the two builds and I noticed the
I've created PR #899 that hopefully fixes this issue. I've tested on Ruby 2.6.7 and 2.7.2. |
Thanks @andrewferk. I tried the following and it worked:
|
same issue i am also facing i try all the method but didnt get any positive response Analyzing dependencies -- Crash Report log information -------------------------------------------- -- Control frame information ----------------------------------------------- -- Ruby level backtrace information ---------------------------------------- -- Other runtime information -----------------------------------------------
[NOTE] [IMPORTANT] |
I can also confirm running |
The above line of code didn't fix it for me. I'm using Ruby 2.6.6 on an M1 Macbook Air. Edit: |
Another confirmation that command System Ruby version |
Ruby version: |
i fixed the issue using this steps : be sure to have this in .zshrc or .bashrc alias pod="arch -x86_64 pod"
alias brew="arch -arm64 brew"
alias gem="arch -x86_64 sudo gem"
brew install rbenv then ## add this 2 line to .zshrc or .bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
rbenv install 2.7.4
rbenv global 2.7.4
gem install bundler:2.2.19 -n /usr/local/bin
gem install --user-install ffi -- --enable-libffi-alloc
rbenv local 2.7.4
bundle install --path vendor/bundle This fixed the issue for me ! macOS BigSure 11.4 M1 Ship |
It works!!!!!!!!! |
Before run this i have error: Report
Stack
Plugins
Podfilerequire_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'pendekin' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll'
# add manual for rn vector icon
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
target 'pendekinTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end Error
After run this |
So I encountered this issue with RSpec and updating the gems did it for me:
As far as I know the maintainers for ffi and ethon made the necessary updates to support these new M1 ARM processors. FWIW I also installed ffi with this command and used homebrew to install/update |
On M1 Max, macOS Monterey. This worked too. |
How does one do (the equivalent of) |
To answer my own question: Use |
Just a heads up, also getting this on aws Graviton2 arm64 /home/ubuntu/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Segmentation fault at 0x0000ffff00000020 |
Running gem install --user-install ffi -- --enable-libffi-alloc fixed my issue (Mac pro -M1 Pro) |
Just FYI, for those who needs to install gem in specific location, instead of using |
I can also confirm that I can start server after running |
Thank you it worked for me. MacBook air m1, Monterey 12.3 |
I'm not seeing this issue anymore with ffi 1.15.5 (macOS 12.6 on M1; default system Ruby 2.6) |
I'm using FFI 1.14.2, Ruby 2.7.2, ARM64 build
I think this the same issue with typhoeus/typhoeus#667
here are logs
ruby_2020-12-23-052054_Jasl-Mac-mini.crash.log
crash.log
The text was updated successfully, but these errors were encountered: