Bug #19331
closed--enable-rpath results in incorrect RPATH in Ruby 3.1.3+
Description
I just updated Ruby from 3.1.2 to 3.1.3 and found out that all .so libraries from the enc directory have wrong RPATH/RUNPATH (when building with --enable-rpath
). I first hit this on Solaris, but my testing on Linux resulted in the same thing. It can be easily reproduced with the following:
wget http://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.3.tar.gz
tar xzf ruby-3.1.3.tar.gz
cd ruby-3.1.3
./configure --prefix=/usr/ruby/3.1 --mandir=/usr/ruby/3.1/share/man --bindir=/usr/ruby/3.1/bin --sbindir=/usr/ruby/3.1/sbin --libdir=/usr/ruby/3.1/lib/amd64 --with-rubylibprefix=/usr/ruby/3.1/lib/ruby --enable-shared --enable-rpath
/usr/bin/make -j 16 -l 32
objdump -x ./.ext/x86_64-linux/enc/windows_31j.so | grep RPATH
While previously this resulted in the following output:
RPATH /usr/ruby/3.1/lib/amd64
in 3.1.3 it is wrongly set to the build directory:
RPATH /home/jkulik/rubytest/ruby-3.1.3
I tried looking for some obvious change but didn't find the core of this issue yet. All I found out is that generated enc.mk
differs in prefix
and libdir
-prefix = /usr/ruby/3.1
+prefix = /home/jkulik/rubytest/ruby-3.1.3
exec_prefix = $(prefix)
-libdir = $(exec_prefix)/lib/amd64
+libdir = /home/jkulik/rubytest/ruby-3.1.3
rbconfig.rb
is similar in both versions, but when I print out CONFIG
in make_encmake.rb
right after load File.expand_path("lib/mkmf.rb", dir)
, I can see the differences from above, so it's probably something in the lib/mkmf.rb
file that changes that.
I am seeing the same issue in the current latest ruby 3.1 branch cloned from github.