oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
2.98k stars 179 forks source link

TruffleRuby set `host_cpu` to `aarch64` on `arm64-darwin` causing `REUSE_AS_BINARY_ON_TRUFFLERUBY` to not work as expected #3571

Closed ntkme closed 3 weeks ago

ntkme commented 1 month ago

MRI:

irb(main):001> RbConfig::CONFIG['host_cpu']
=> "arm64"
irb(main):002> Gem::Platform.local
=> #<Gem::Platform:0x0000000100754378 @cpu="arm64", @os="darwin", @version="23">

JRuby:

irb(main):001:0> RbConfig::CONFIG['host_cpu']
=> "arm64"
irb(main):002:0> Gem::Platform.local
=> #<Gem::Platform:0x93fb44 @cpu="universal", @os="java", @version="17">

TruffleRuby:

irb(main):001:0> RbConfig::CONFIG['host_cpu']
=> "aarch64"
irb(main):002:0> Gem::Platform.local
=> #<Gem::Platform:0x1be78 @cpu="aarch64", @os="darwin", @version=nil>

Because MRI normalized aarch64 to arm64 on darwin, prebuilt native gems are shipped as arm64-darwin. This causes a platform mismatch when a gem is part of REUSE_AS_BINARY_ON_TRUFFLERUBY.

Historically, the gem platform normalization convention is messy. E.g.

However, gem authors have been publish gems with these as a naming convention for the known platforms, it's probably better for truffleruby to normalize its host_cpu to arm64 on darwin.

ntkme commented 1 month ago

Related: https://github.com/jruby/jruby/pull/7132

andrykonchin commented 1 month ago

Thank you for the report, we'll look into it.

eregon commented 1 month ago

From https://github.com/eregon/actions-shell/actions/runs/9318186931/job/25650009861, arm64 is used in ruby -v, RUBY_PLATFORM and RbConfig (except build and build_cpu which are aarch64, but I think we don't have those in TruffleRuby anyway).