sorbet: sorbet-static has "Illegal instruction" on AMD Phenom II
CPU: AMD Phenom™ II X4 955 Processor (model 4, stepping 2) OS: openSUSE-LEAP-15.1
$ gem install --user sorbet-static
$ ~/.gem/ruby/2.5.0/gems/sorbet-static-0.4.4573-x86_64-linux/libexec/sorbet
Illegal instruction
I guess this is somehow caused, by how the binaries for https://rubygems.org/gems/sorbet are being build.
I tried to compile sorbet-static myself, but that failed due to some bazel errors. See: #1486
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 18 (4 by maintainers)
I’m getting something similar when running it in docker using the
linux/amd64
platform. It works great when running it natively on my mac.Found the problem, I managed
I managed to reproduce your problem and the binary is indeed not working. I managed to get it working by compiling the Linux distribution with the flag “–copt=-march=x86-64” instead of “–copt=-march=sandybridge”. This is concerning because it seems that the gem in it’s current state is unusable in MacBooks with Docker containers on x86-64 architecture.
I don’t know if this flag is important to this gem performance, but the only solution I see here is compiling the binary ourselves or convincing the repo mainteners to compile the binary with “–copt=-march=x86-64”.
Yep, can confirm this. Making the docker image as described in the previous comment, and then running
bundle exec srb init
ends in:This is on an M1 MacBook Pro running Sonoma.
I was having the same issue as you on my project on apple silicon + docker. But when trying to recreate to test it on a clean docker container I couldn’t replicate the issue. Running this command resulted in no errors:
After digging up my dockerfile I notice some commands to cleanup some gems artifacts in the directory ‘/usr/local/bundle/gems/’ . I commented them out from the dockerfile and Sorbet started working normally.
@DarkDimius is there any documentation on how to use the WASM version?
I was able to successfully compile and run on an Intel Xeon L5520 using this option:
Now that I have a working binary, I’m not sure if there’s a better way to get it running in my project other than dropping it into
~/.gem/ruby/2.6.0/gems/sorbet-static-0.4.5072-x86_64-linux/libexec/sorbet
.EDIT: I see I can use https://github.com/sorbet/sorbet/tree/master/gems/sorbet#environment-variables
SRB_SORBET_EXE=bazel-bin/main/sorbet
.