Repository navigation
build: build with baseruby that is compiled from the same source - #15
Merged
Merged
Conversation
The system installed Ruby (especially Debian) can override `Gem.default_dir` to lookup gems installed by the OS package managers. And `rbinstall.rb` respects `Gem.default_dir` to select install directory of gems under `DESTDIR`. So it installs gems in `DESTDIR/var/lib/gems/3.2.0+1` where the Debian's `operating_system.rb` specifies. However, `Gem.default_dir` is not overridden at runtime on Wasm, so it lookups `DESTDIR/usr/local/lib/ruby/gems/3.2.0+1` instead. The mismatch of `default_dir` between install-time and runtime causes the failure of gem lookup. To fix this mismatch, stop using system packaged ruby to avoid loading `operating_system.rb`, and use self-built ruby, which doesn't patch `Gem.default_dir`. This change also makes our build compatible with cross-compilation prerequisite: https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#prerequisite
kateinoigakukun
force-pushed
the
katei/fix-gem-default-dir
branch
from
May 11, 2022 05:51
7309042 to
1e1f70c
Compare
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.
The system installed Ruby (especially Debian) can override
Gem.default_dirto lookup gems installed by the OS package managers.And
rbinstall.rbrespectsGem.default_dirto select installdirectory of gems under
DESTDIR. So it installs gems inDESTDIR/var/lib/gems/3.2.0+1where the Debian'soperating_system.rbspecifies.
However,
Gem.default_diris not overridden at runtime on Wasm, so itlookups
DESTDIR/usr/local/lib/ruby/gems/3.2.0+1instead. The mismatchof
default_dirbetween install-time and runtime causes the failure ofgem lookup.
To fix this mismatch, stop using system packaged ruby to avoid loading
operating_system.rb, and use self-built ruby, which doesn't patchGem.default_dir.This change also makes our build compatible with cross-compilation
prerequisite:
https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#prerequisite