Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: build with baseruby that is compiled from the same source #15

Merged
merged 1 commit into from
May 11, 2022

Conversation

kateinoigakukun
Copy link
Member

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

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 kateinoigakukun merged commit 8788d54 into main May 11, 2022
@kateinoigakukun kateinoigakukun deleted the katei/fix-gem-default-dir branch May 11, 2022 06:31
@c4lliope c4lliope mentioned this pull request May 12, 2022
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.

None yet

1 participant