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

sorbet-static-0.5.10667-universal-darwin-21 does not include arm64 code #6778

Open
ianks opened this issue Feb 24, 2023 · 8 comments
Open

sorbet-static-0.5.10667-universal-darwin-21 does not include arm64 code #6778

ianks opened this issue Feb 24, 2023 · 8 comments
Labels
bug Something isn't working unconfirmed This issue has not yet been confirmed by the Sorbet team

Comments

@ianks
Copy link

ianks commented Feb 24, 2023

It seems like there may be a bug with fat binaries on mac with sorbet-static. I imagine most devs have rosetta installed, so it's probably not an urgent issue. But figured I'd report.

$ sorbet tc
/path/sorbet-static-0.5.10667-universal-darwin-21/libexec/sorbet: Bad CPU type in executable

Looking into it a bit more, file seems to agree that the binary only works for x86_64:

$ file /somepath/gems/sorbet-static-0.5.10667-universal-darwin-21/libexec/sorbet
/somepath/gems/sorbet-static-0.5.10667-universal-darwin-21/libexec/sorbet: Mach-O 64-bit executable x86_64
@ianks ianks added bug Something isn't working unconfirmed This issue has not yet been confirmed by the Sorbet team labels Feb 24, 2023
@garymh
Copy link

garymh commented Jul 24, 2023

Getting this issue with sorbet-static-0.5.10929-universal-darwin-22 as well.

@crespire
Copy link

Also getting this issue on an M1 mac with sorbet-static-0.5.11141-universal-darwin

@technicalpickles
Copy link

I started looking into this while investigating sorbet's performance on our code-base. One thing I found

sorbet/.bazelrc

Lines 111 to 120 in b1ec9d2

# This is to turn on vector instructions where available.
# We used to do this unconditionally, but Rosetta 2 doesn't translate all vector instructions well.
#
# If we ever start making universal x86-64 + aarch64 binaries for macOS, we
# could think about re-enabling the vector instructions for x86-64.
#
# At Stripe: developer laptops run skylake, devboxes run skylake-avx512
# however some AWS instances in our fleet still run Sandy Bridge (Skylake predecessor), as of 2018.
build:release-linux --copt=-march=sandybridge
build:release-sanitized-linux --copt=-march=sandybridge
where we linux gets some custom arch flags

My general understanding is that universal binaries are made by effectively compiling with multiple arches, ie -arch x86_64 -arch arm64. If that is the case, I think it should be possible to add something like --copt="-march=x86_86 -march= arm64 to release-mac.

I wanted to test locally, but I haven't able to build with bazel locally yet 🤔

@noizwaves
Copy link

Hey folks, I'm curious if anyone has the knowledge of how to build the sorbet-static gem for M1, either as a universal gem for arm & x86, or as two different gems?

I set up https://github.com/sorbet-multiarch/ this weekend to help out with linux/arm64 builds for this issue, and theoretically can do the same for darwin. (using CircleCI's macos machines).

Maybe @nathunsmitty (because of https://rubygems.org/gems/sorbet-static-m1)?

@coreyja
Copy link

coreyja commented Jan 25, 2024

Just for anyone else who might stuble across this issue, having Rosetta installed was enough to fix this for me and my team!

I didn't have to run my terminal or VS Code with x86 binaries or anything, just installing Rosetta fixed this issue for me

And if you want to do that from the cmd line you can run this

/usr/sbin/softwareupdate --install-rosetta 

@eddiecheung-shopify
Copy link

When I run bundle exec bin/tapioca dsl for updating Sorbet DSLs for our repo, I am experiencing the following error:

Error: `Tapioca::Dsl::Compilers::Protobuf` failed to generate RBI for `Google::Api::ClientLibrarySettings`
bundler: failed to load command: bin/tapioca (bin/tapioca)
/Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:305:in `create_descriptor_method': NoMethodError: undefined method `has_presence?' for an instance of Google::Protobuf::FieldDescriptor (Parallel::UndumpableException)
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/sorbet-runtime-0.5.11305/lib/types/private/methods/_methods.rb:279:in `bind_call'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/sorbet-runtime-0.5.11305/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:127:in `block (2 levels) in decorate'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:127:in `each'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:127:in `map'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:127:in `block in decorate'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/rbi_ext/model.rb:40:in `block in create_class'
        from <internal:kernel>:90:in `tap'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/rbi_ext/model.rb:39:in `create_class'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/rbi_ext/model.rb:16:in `create_path'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/compilers/protobuf.rb:83:in `decorate'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/pipeline.rb:180:in `block in rbi_for_constant'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/pipeline.rb:176:in `each'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/pipeline.rb:176:in `rbi_for_constant'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/pipeline.rb:79:in `block in run'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:627:in `call_with_index'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:597:in `process_incoming_jobs'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:577:in `block in worker'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:568:in `fork'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:568:in `worker'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:559:in `block in create_workers'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:558:in `each'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:558:in `each_with_index'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:558:in `create_workers'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:497:in `work_in_processes'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/parallel-1.24.0/lib/parallel.rb:291:in `map'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/executor.rb:31:in `run_in_parallel'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/dsl/pipeline.rb:78:in `run'
        from /Users/eddiecheung/.gem/ruby/3.3.0/gems/tapioca-0.13.0/lib/tapioca/commands/abstract_dsl.rb:73:in `generate_dsl_rbi_files

Any clue? Thanks 🙏

@Morriar
Copy link
Collaborator

Morriar commented Mar 26, 2024

@eddiecheung-shopify, this error is actually related to Tapioca and not to the present issue. I'd suggest moving it to https://github.com/Shopify/tapioca/issues.

@bfad
Copy link

bfad commented Apr 2, 2024

This is still an issue with version 0.5.11230, and I think the problem is only going to get worse as there's less of a need to install Rosetta these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed This issue has not yet been confirmed by the Sorbet team
Projects
None yet
Development

No branches or pull requests

9 participants