Project

General

Profile

Actions

Bug #20783

open

--enable-shared and the rpath/runpath are broken on Linux on CRuby master

Added by Eregon (Benoit Daloze) 3 days ago. Updated 3 days ago.

Status:
Assigned
Target version:
-
[ruby-core:119444]

Description

https://github.com/ruby/ruby-dev-builder/actions/runs/11095200420

$ ruby test_files/cli_test.rb
ruby: error while loading shared libraries: libruby.so.3.4: cannot open shared object file: No such file or directory

And indeed locally I can confirm it's broken (I use ruby-build for convenience, as you can see it just does a bunch of regular build commands):

$ RUBY_CONFIGURE_OPTS=--enable-shared ruby-build ruby-dev -d ~/.rubies   
==> Cloning https://github.com/ruby/ruby.git...
-> git clone --depth 1 --branch master https://github.com/ruby/ruby.git ruby-master
...
==> Installing ruby-master...
-> autoreconf -i
-> ./configure "--prefix=$HOME/.rubies/ruby-dev" --enable-shared
-> make -j 16
-> make update-gems extract-gems install
==> Installed ruby-master to /home/eregon/.rubies/ruby-dev

And that build with --enable-shared is not working, same as on GitHub Actions:

$ /home/eregon/.rubies/ruby-dev/bin/ruby -v
/home/eregon/.rubies/ruby-dev/bin/ruby: error while loading shared libraries: libruby.so.3.4: cannot open shared object file: No such file or directory

$ ldd /home/eregon/.rubies/ruby-dev/bin/ruby
	linux-vdso.so.1 (0x00007fff9018c000)
	libruby.so.3.4 => not found
	libz.so.1 => /lib64/libz.so.1 (0x00007f4c8d928000)
	libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007f4c8d8ef000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f4c8d80e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f4c8d62c000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f4c8d95e000)

$ readelf -d /home/eregon/.rubies/ruby-dev/bin/ruby

Dynamic section at offset 0x2db8 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libruby.so.3.4]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypt.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/home/eregon/.rubies/ruby-dev/lib-L/home/eregon/.rubies/ruby-dev/lib]
...

@hsbt (Hiroshi SHIBATA) said he remembers https://github.com/ruby/ruby/commit/1f6d2e77d9be9a5a829e60908d21d621f4e1ceb0 changed something in this area which might be the cause.

Once this is fixed we should also revert https://github.com/ruby/docker-images/pull/107.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0