Skip to content

Commit 38066d4

Browse files
authored
Merge pull request #165 from rake-compiler/disable-rpath
Disable rpath in cross compiled C extensions
2 parents 1cf53d5 + d99391b commit 38066d4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

build/patches/rake-compiler-1.2.9/0004-Enable-build-of-static-libruby.patch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
22
index 8317a2a3..8ed21718 100644
33
--- a/tasks/bin/cross-ruby.rake
44
+++ b/tasks/bin/cross-ruby.rake
5-
@@ -116,11 +116,31 @@
5+
@@ -116,11 +116,32 @@
66
"--host=#{mingw_host}",
77
"--target=#{mingw_target}",
88
"--build=#{RUBY_BUILD}",
99
- '--enable-shared',
1010
+ '--enable-install-static-library',
1111
+ '--disable-jit-support',
12+
+ '--disable-rpath',
1213
+ 'ac_cv_lib_z_uncompress=no',
1314
+ 'ac_cv_lib_crypt_crypt=no',
1415
+ 'ac_cv_func_crypt_r=no',

test/rcd_test/test/test_basic.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,15 @@ def test_largefile_op_removed_from_musl
3535
is_linux = RUBY_PLATFORM.include?("linux")
3636
assert_equal(is_linux, RcdTest.largefile_op_removed_from_musl)
3737
end
38+
39+
def test_disabled_rpath
40+
skip("jruby uses jar files without rpath") if RUBY_ENGINE == "jruby"
41+
42+
cext_fname = $LOADED_FEATURES.grep(/rcd_test_ext/).first
43+
refute_nil(cext_fname, "the C-ext should be loaded")
44+
cext_text = File.binread(cext_fname)
45+
assert_match(/Init_rcd_test_ext/, cext_text, "C-ext shoud contain the init function")
46+
refute_match(/usr\/local/, cext_text, "there should be no rpath to /usr/local/rake-compiler/ruby/x86_64-unknown-linux-musl/ruby-3.4.5/lib or so")
47+
refute_match(/home\//, cext_text, "there should be no path to /home/ or so")
48+
end
3849
end

0 commit comments

Comments
 (0)