Skip to content

Force build-time gem installs to use current JRuby config#9197

Closed
headius wants to merge 1 commit intojruby:masterfrom
headius:build_time_rubygems_platform
Closed

Force build-time gem installs to use current JRuby config#9197
headius wants to merge 1 commit intojruby:masterfrom
headius:build_time_rubygems_platform

Conversation

@headius
Copy link
Member

@headius headius commented Jan 29, 2026

The RubyGems we run at build time runs with JRuby 9.4, which causes it to use properties from that version for things like gem paths and extension directories. This is related to the extension disabling change in #8415 and causes the build-time extension faking to use the wrong path. For example:

.../gems/shared/extensions/universal-java-25/3.1.0

when it should be

.../gems/shared/extensions/universal-java/3.4.0

The change here uses RubyGems' cross-compiling capability by forcing a specific rbconfig.rb to be use, and additionally fakes out the Ruby API version by setting @ruby_api_version on the Gem module.

This was discovered while attempting to switch fully to the syslog gem in #9109, since as a bundled gem it will not be activated unless we successfully fake-out the extension build.

See also this bug related to the resolv gem installing extensions:

The RubyGems we run at build time runs with JRuby 9.4, which causes
it to use properties from that version for things like gem paths
and extension directories. This is related to the extension
disabling change in jruby#8415 and causes the build-time
extension faking to use the wrong path. For example:

  .../gems/shared/extensions/universal-java-25/3.1.0

when it should be

  .../gems/shared/extensions/universal-java/3.4.0

The change here uses RubyGems' cross-compiling capability by
forcing a specific rbconfig.rb to be use, and additionally fakes
out the Ruby API version by setting @ruby_api_version on the Gem
module.

This was discovered while attempting to switch fully to the syslog
gem in jruby#9109, since as a bundled gem it will not be
activated unless we successfully fake-out the extension build.

See also this bug related to the resolv gem installing extensions:

* jruby#8649
@headius headius added this to the JRuby 10.0.3.0 milestone Jan 29, 2026
headius added a commit to headius/jruby that referenced this pull request Jan 29, 2026
Because of the issue described in an fixed by jruby#9197,
the fake-out of the syslog extension build fails. Because it was
being installed as a bundled gem rather than a default gem, and
RubyGems will not activate a gem whose extension has not been
built, this prevented syslog from being loadable.

The change here moves it to a default gem for now, so that it can
still be loaded from stdlib as well as being upgraded by users.

These changes should be reverted once the gem platform fix has
been merged.
headius added a commit to headius/jruby that referenced this pull request Jan 29, 2026
Because of the issue described in an fixed by jruby#9197,
the fake-out of the syslog extension build fails. Because it was
being installed as a bundled gem rather than a default gem, and
RubyGems will not activate a gem whose extension has not been
built, this prevented syslog from being loadable.

The change here moves it to a default gem for now, so that it can
still be loaded from stdlib as well as being upgraded by users.

These changes should be reverted once the gem platform fix has
been merged.
@headius headius mentioned this pull request Jan 29, 2026
@enebo enebo modified the milestones: JRuby 10.0.3.0, JRuby 10.0.4.0 Feb 2, 2026
@headius
Copy link
Member Author

headius commented Feb 3, 2026

I merged #9198 before this so that pulled in the changes here.

@headius headius closed this Feb 3, 2026
@headius headius deleted the build_time_rubygems_platform branch February 3, 2026 18:28
@headius headius modified the milestones: JRuby 10.0.4.0, Non-Release Feb 3, 2026
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