Skip to content

Support CRuby 3.1 and older on ubuntu-26.04 - #31

Closed
hsbt wants to merge 2 commits into
ruby:masterfrom
hsbt:build-old-cruby-on-ubuntu-26.04
Closed

hsbt wants to merge 2 commits into
ruby:masterfrom
hsbt:build-old-cruby-on-ubuntu-26.04

Conversation

@hsbt

@hsbt hsbt commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

ubuntu-latest is moving to ubuntu-26.04 (actions/runner-images#14748), and setup-ruby has no builds of Ruby 3.1 and older there, so CI jobs across the ecosystem that test those versions on ubuntu-latest fail at setup. ruby/actions#156 found 87 repositories in the ruby org alone, and I've been moving such jobs to ubuntu-24.04 (tdiary/tdiary-core#1418, tdiary/tdiary-contrib#262, tdiary/tdiary-style-gfm#39).

They fail to build there because GCC 15 defaults to C23 and GCC 14 made implicit declarations errors. The first commit passes the minimal flags on CC for those versions, and the second adds them to the matrix for ubuntu-26.04 and ubuntu-26.04-arm. I built 1.9.3 through 3.1.7 with ruby-build in an ubuntu:26.04 container, including the https and gem install json checks. I haven't tried arm64.

It would be great if you could merge this and publish the binaries. Thanks for maintaining ruby-builder and setup-ruby.

Generated with Claude Code

setup-ruby issue: ruby/setup-ruby#954

hsbt and others added 2 commits October 31, 2026 11:29
Ruby 3.1 and older fail to build there with GCC 15.

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

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

Thank you for the PR.
Is the workaround something we could do in https://github.com/rbenv/ruby-build instead?
I think so, because there is a similar workaround but it's currently Fedora-only: https://github.com/rbenv/ruby-build/blob/b6a92c15f0df872047c74f7dfa0b92dfd4de8a92/bin/ruby-build#L743-L755
I think that would be the more-generally-useful fix, and a better place for this logic.

In general I'm not very keen to adding workarounds here, but no objection if ruby-build fixes such issues as then there is no need for a workaround here.

The second commit looks great, happy to merge that once ruby-build handles the C23/C17 issue.

@eregon

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

I'm making a PR to ruby-build to handle this.
My plan is to only handle Ruby 2.3+, I'm unsure we should add workarounds for 2.0-2.2 and 1.9, nobody should use those anymore and I think it's fully expected they don't build on recent platforms.

eregon added a commit to rbenv/ruby-build that referenced this pull request Oct 31, 2026
GCC 15 defaults to C23, which Ruby < 3.2 can't compile as. Detect the
GCC version instead of the OS, so that e.g. Ubuntu 26.04 is handled too.

The flag keeps going through the cflags configure variable, except for
Ruby 2.6 where it goes on CC, because its MJIT header check runs a bare
$(CC) and would otherwise fail.

Ported from ruby/ruby-builder#31

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@eregon

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

rbenv/ruby-build#2649 and I've cherry-picked your second commit as d86a862

@eregon

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

2.4 - 3.1 are built, except 2.7 which failed unexpectedly, investigating:
https://github.com/ruby/ruby-builder/actions/runs/41236443425/job/124641118792

2.3 fails like 2.2 and older with undefined references in openssl (libcrypto.so), which reinforces my thinking we should not bother with it.

@eregon

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

@eregon

eregon commented Oct 31, 2026

Copy link
Copy Markdown
Member

I'll close this as I have integrated the changes, thank you for the help!

@eregon eregon closed this Oct 31, 2026
@hsbt

hsbt commented Oct 31, 2026 •

Copy link
Copy Markdown
Member Author

👍 Thanks for porting it to ruby-build and getting 2.4 to 3.1 out so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants