build: build with baseruby that is compiled from the same source #15
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_dir
to lookup gems installed by the OS package managers.And
rbinstall.rb
respectsGem.default_dir
to select installdirectory of gems under
DESTDIR
. So it installs gems inDESTDIR/var/lib/gems/3.2.0+1
where the Debian'soperating_system.rb
specifies.
However,
Gem.default_dir
is not overridden at runtime on Wasm, so itlookups
DESTDIR/usr/local/lib/ruby/gems/3.2.0+1
instead. The mismatchof
default_dir
between 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