Skip to content

Commit 09495d9

Browse files
committed
fix: propagate libyaml/openssl prefix for TruffleRuby
1 parent 7729d1d commit 09495d9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ruby/private/download.bzl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ def _rb_download_impl(repository_ctx):
108108
# TruffleRuby needs explicit locale
109109
# https://www.graalvm.org/dev/reference-manual/ruby/UTF8Locale/
110110
env.update({"LANG": "en_US.UTF-8"})
111+
112+
# TruffleRuby dynamically locates libyaml/openssl which are not available in sandbox,
113+
# so we need to preserve explicit paths to them and propagate down the builds.
114+
# https://github.com/oracle/truffleruby/blob/ac88a0fe68bf957f75af7d316594b89731fdec4e/lib/truffle/rbconfig.rb#L119-L135
115+
libyaml_prefix = _execute_command(repository_ctx, ["dist/bin/ruby", "-rrbconfig", "-e", "puts ENV['LIBYAML_PREFIX']"])
116+
if libyaml_prefix:
117+
env.update({"LIBYAML_PREFIX": libyaml_prefix})
118+
openssl_prefix = _execute_command(repository_ctx, ["dist/bin/ruby", "-rrbconfig", "-e", "puts ENV['OPENSSL_PREFIX']"])
119+
if openssl_prefix:
120+
env.update({"OPENSSL_PREFIX": openssl_prefix})
121+
111122
elif version == "system":
112123
engine = _symlink_system_ruby(repository_ctx)
113124
elif repository_ctx.os.name.startswith("windows"):

0 commit comments

Comments
 (0)