Skip to content

build(rspec): upgrade rb-sys and magnus for LLVM 22 and unpin ubuntu-24.04 (TRUNK-23633) - #1311

Merged
trunk-io[bot] merged 1 commit into
mainfrom
tylerbeebe/trunk-23633-rb-sys-clang-21
Nov 12, 2026
Merged

trunk-io[bot] merged 1 commit into
mainfrom
tylerbeebe/trunk-23633-rb-sys-clang-21

Conversation

@acatxnamedvirtue

Copy link
Copy Markdown
Contributor

Part of TRUNK-23633

Why

GitHub's ubuntu-latest moved to 26.04, so #1300 pinned the rspec gem's build job to ubuntu-24.04. On 26.04 the runner has clang 20, 21 and 22, and clang-sys loads the newest, libclang 22. rb-sys 0.9.124 ships bindgen 0.69, which can't handle LLVM 22 (oxidize-rb/rb-sys#712, matsadler/magnus#174). It made rb_data_type_struct opaque (_address: u8), so magnus failed to compile against Ruby 3.1. Forcing libclang 21 or 20 built fine. rb-sys 0.9.125 and later use bindgen 0.72, which fixes it.

What changes

  • rb-sys crate and rb_sys gem: =0.9.124 → =0.9.130 (bindgen 0.69.5 → 0.72.1). rb-sys-dock 0.9.130 images exist for all six release platforms.
  • magnus: 0.8.2 → 0.8.4 in the gem, context and test_report. A patch release; 0.9.x has breaking API changes, so it stays on 0.8. magnus pulled rb-sys-env 0.2.2 → 0.2.3.
  • Cargo.lock files and Gemfile.lock updated. rake-compiler-dock 1.11 → 1.12 came along with the gem.
  • ruby.yml's build job back on ubuntu-latest, and the pin's comment removed. release_ruby_gem.yml already ran on ubuntu-latest.
  • No code changes were needed.

Testing

Run on an Ubuntu 26.04 host with clang 20, 21 and 22 installed, as on the runner, using ruby-builder's ubuntu-26.04 Rubies installed the way setup-ruby installs them. Command: bundle exec rake test.

  • libclang 22 (the default): Ruby 3.1.7, 3.3.13, 3.4.12 and 4.0.9 each build, and 50/50 specs pass.
  • libclang 21 or 20 forced: Ruby 3.1 builds.
  • Workspace: nextest 155/155. Clippy (--all-features) shows no new warnings. cargo fmt, trunk check and trunk fmt are clean.

Not run locally: cross-compiling in the rb-sys-dock 0.9.130 images (build-ruby-gem, the release cross-gem job). This PR's CI covers it.

Known, out of scope: ruby-builder's 26.04 build of Ruby 3.2.11 fails in bindgen with unknown type name 'bool', with either rb-sys version and on any libclang. Its config.h lacks HAVE_STDBOOL_H, probably because GCC 15 built it as C23. BINDGEN_EXTRA_CLANG_ARGS=-std=gnu23 works around it. Neither CI nor the release gems compile against that Ruby; only a source build with Ruby 3.2 on 26.04 would hit it.

🤖 Generated with Claude Code

…ubuntu-24.04 (TRUNK-23633)

The ubuntu-26.04 runner image ships clang 20, 21 and 22, and clang-sys
loads the newest libclang it finds, so bindgen ran against libclang 22.
rb-sys 0.9.124's bindgen 0.69 then emits rb_data_type_struct (and
rb_io_t) as opaque structs, and magnus fails to compile against Ruby
3.1's headers. rb-sys 0.9.125 moved rb-sys-build to bindgen 0.72, which
generates the full structs (oxidize-rb/rb-sys#712, matsadler/magnus#174).

- rb-sys 0.9.124 -> 0.9.130 (crate and rb_sys gem, so rb-sys-dock uses
  the 0.9.130 images); bindgen 0.69.5 -> 0.72.1
- magnus 0.8.2 -> 0.8.4 in the gem, context and test_report (patch
  releases; 0.8.4 requires rb-sys ^0.9.124 and fixes a $! crash)
- Move ruby.yml's build job back to ubuntu-latest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@trunk-io
trunk-io Bot merged commit ae69665 into main Nov 12, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants