Add rust-1-linux dependency to all ruby packages for YJIT/ZJIT#63
Open
aramprice wants to merge 1 commit into
Open
Add rust-1-linux dependency to all ruby packages for YJIT/ZJIT#63aramprice wants to merge 1 commit into
aramprice wants to merge 1 commit into
Conversation
Closed
There was a problem hiding this comment.
Pull request overview
This PR vendors the rust-1-linux package and wires it into the Ruby 3.3/3.4/4.0 packages so Ruby auto-detects Rust at build time and compiles in YJIT/ZJIT (with CI assertions to verify YJIT availability and runtime enablement).
Changes:
- Add
rust-1-linuxas a compile-time dependency forruby-3.3,ruby-3.4, andruby-4.0, and source Rust’s compile environment on Linux while explicitly selecting GCC. - Disable Rust ThinLTO in Ruby’s
common.mkon Linux to avoid GNU ld + embedded LLVM bitcode issues. - Add/extend CI: new Concourse job to auto-bump vendored Rust and new test assertions that YJIT is compiled in and can be enabled.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/compile-3.3.env | Removes clang auto-selection from compile env script. |
| src/compile-3.4.env | Removes clang auto-selection from compile env script. |
| src/compile-4.0.env | Removes clang auto-selection from compile env script. |
| packages/rust-1-linux/spec.lock | Adds vendored Rust package lock metadata. |
| packages/ruby-3.3/spec | Adds rust-1-linux dependency. |
| packages/ruby-3.4/spec | Adds rust-1-linux dependency. |
| packages/ruby-4.0/spec | Adds rust-1-linux dependency. |
| packages/ruby-3.3/packaging | Forces GCC on Linux, sources Rust env, disables ThinLTO in common.mk. |
| packages/ruby-3.4/packaging | Forces GCC on Linux, sources Rust env, disables ThinLTO in common.mk. |
| packages/ruby-4.0/packaging | Forces GCC on Linux, sources Rust env, disables ThinLTO in common.mk. |
| jobs/ruby-3.3-test/templates/run | Adds YJIT compile/runtime enablement checks. |
| jobs/ruby-3.4-test/templates/run | Adds YJIT compile/runtime enablement checks. |
| jobs/ruby-4.0-test/templates/run | Adds YJIT compile/runtime enablement checks. |
| config/blobs.yml | Adds Rust toolchain blob entry. |
| ci/templates/src/compile.env.erb | Removes clang auto-selection from template. |
| ci/templates/packages/ruby/spec.erb | Adds rust-1-linux dependency in spec template. |
| ci/templates/packages/ruby/packaging.erb | Mirrors GCC + Rust env + ThinLTO disabling in packaging template. |
| ci/templates/jobs/ruby-test/templates/run.erb | Mirrors YJIT checks in job template. |
| ci/pipeline.yml | Adds bump-rust-1-linux Concourse job and rust-release resource. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+27
| rust-1-linux/rust-1.97.0-x86_64-unknown-linux-gnu.tar.gz: | ||
| size: 384617996 | ||
| sha: sha256:eb89b20287153391c49ebcdb7fd91b683a12438d129bfb92eadcc495545af3a7 |
Member
Author
There was a problem hiding this comment.
This will be resolved later / in CI
…port - Vendor rust-1-linux (1.97.0) from bosh-package-rust-release via spec.lock - Add rust-1-linux as a compile-time dependency of ruby-3.3, ruby-3.4, and ruby-4.0 - Drop Clang support: use explicit GCC/G++ on Linux; Rust is now in PATH during ./configure so Ruby auto-detects and enables YJIT (3.3/3.4) and ZJIT (4.0) - Patch common.mk: replace -C lto=thin with -C lto=no before ./configure because GNU ld (used with GCC) cannot link LLVM bitcode objects emitted by thin LTO; disabling thin LTO makes Rust emit plain native objects that GCC links cleanly - Add bump-rust-1-linux CI job: triggered by new bosh-package-rust-release releases, runs bosh vendor-package + tests all ruby versions in parallel before finalizing - Add rust-release git resource to pipeline (watches .final_builds for new releases) - CI: verify that RubyVM::YJIT is compiled in and can be enabled at runtime in all ruby test jobs ai-assisted=yes [TNZ-109821] Bosh ruby package compiles with rustc
c95763a to
623fb88
Compare
Comment on lines
+22
to
+25
| source "${BOSH_PACKAGES_DIR:-/var/vcap/packages}/rust-1-linux/bosh/compile.env" | ||
|
|
||
| if command -v clang++ &> /dev/null | ||
| then | ||
| export CXX="$(command -v clang++)" | ||
| echo "Rust version:" | ||
| rustc --version --verbose |
sethboyles
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rust-1-linux(1.97.0) from bosh-package-rust-release viaspec.lockrust-1-linuxa compile-time dependency ofruby-3.3,ruby-3.4, andruby-4.0so Ruby auto-detects Rust and enables YJIT/ZJIT during./configureCC=gcc/CXX=g++on Linux; the original "Clang is faster" comment was incorrect — the slowdown was a GCC optimization-flag bugcommon.mkto replace-C lto=thinwith-C lto=nobefore./configurebump-rust-1-linuxConcourse job that auto-bumps the vendored Rust package whenbosh-package-rust-releaseships a new releaseRubyVM::YJITis compiled in and can be enabled at runtimeWhy
sed -i 's/-C lto=thin/-C lto=no/' common.mk?Ruby's source tarball ships a
common.mkthat includes YJIT/ZJIT Rust compilation rules. In newer Ruby versions (3.3+) these rules set-C lto=thin(ThinLTO) for the Rust crate that implements the JIT.The problem with GNU ld + thin LTO: Rust's ThinLTO (
-C lto=thin) embeds LLVM bitcode alongside the native code in the resulting object files. While this is transparent within a pure-Rust link (rustc/LLVM handles it internally), some configurations of GNU ld can encounter errors or unexpected behavior when it encounters these LLVM bitcode sections while linking the final Ruby binary. Since we are now explicitly using GCC (and thus GNU ld) — and dropping Clang/lld — the safest path is to disable thin LTO entirely with-C lto=no.-C lto=notrade-offs: The Rust YJIT/ZJIT objects are slightly larger (no dead-code elimination across translation units within the Rust crate), and Rust compilation is marginally faster. There is no runtime performance impact — LTO is a compile-time optimization only. The Ruby binary still runs YJIT/ZJIT at full speed.This is consistent with PR #60 which also applied this sed, and is the recommended approach for environments using GCC as the C compiler.
CI changes
bump-rust-1-linuxjob triggers on changes to.final_builds/packages/rust-1-linux/index.ymlinbosh-package-rust-release; it runsbosh vendor-package rust-1-linux(using the shared task from rust-release), tests all three ruby versions in parallel, then finalizesrunscripts now assertdefined?(RubyVM::YJIT)andRubyVM::YJIT.enabled?