Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 582672 - dev-lang/ruby: dangling symlink on /usr/lib64/libruby.so? (was: dev-util/cmake-3.5.2 (and earlier) does not support Ruby shared libraries correctly)
Summary: dev-lang/ruby: dangling symlink on /usr/lib64/libruby.so? (was: dev-util/cmak...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 590854
  Show dependency tree
 
Reported: 2016-05-10 18:15 UTC by Hans de Graaff
Modified: 2017-07-23 07:45 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log output (build.log.xz,77.79 KB, application/x-xz)
2016-05-14 09:43 UTC, Hans de Graaff
Details
CMakeCache.txt (CMakeCache.txt,43.60 KB, text/plain)
2016-05-14 09:44 UTC, Hans de Graaff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans de Graaff gentoo-dev Security 2016-05-10 18:15:45 UTC
cmake set the RUBY_LIBRARY to /usr/lib64/libruby.so but this library is no longer in use on Gentoo since we deprecated ruby 1.8 support. The reason for this is that code linked against an unversioned libruby.so would break when people switch implementations with "eselect ruby"

A test case for this issue can be seen in sci-libs/shogun with USE=ruby. This fails because /usr/lib64/libruby.so is not found.

The problem appears to lie in list of _RUBY_POSSIBLE_LIB_NAMES in Modules/FindRuby.cmake. This list starts with the unversioned options "ruby" and "ruby-static". Removing these locally fixed the problem since ruby${_RUBY_VERSION_SHORT_NODOT} later in the list matches our versioned libraries, e.g. /usr/lib64/libruby21.so.

It may be better to move "ruby ruby-static" to the end of the list to cater for people who don't use a Gentoo-provided ruby versions.

What is not clear to me is why the find_libary() later on accepts this version, rather than iterating over the options until it find an existing versioned variant that works. Perhaps there are other issues here that I did not find.
Comment 1 Michael Palimaka (kensington) gentoo-dev 2016-05-11 20:22:58 UTC
I wasn't able to reproduce. Could you please attach the failing build log and CMakeCache.txt?
Comment 2 Hans de Graaff gentoo-dev Security 2016-05-14 09:43:09 UTC
Created attachment 434260 [details]
build.log output
Comment 3 Hans de Graaff gentoo-dev Security 2016-05-14 09:44:25 UTC
Created attachment 434262 [details]
CMakeCache.txt
Comment 4 Hans de Graaff gentoo-dev Security 2016-05-14 09:45:11 UTC
(In reply to Michael Palimaka (kensington) from comment #1)
> I wasn't able to reproduce. Could you please attach the failing build log
> and CMakeCache.txt?

Done. Note that shogun only fails with USE=ruby since that is when the ruby part is built.
Comment 5 Michael Palimaka (kensington) gentoo-dev 2016-05-14 19:05:16 UTC
Is it possible /usr/lib64/libruby.so could be a dangling symlink?
Comment 6 Hans de Graaff gentoo-dev Security 2016-05-15 05:46:02 UTC
(In reply to Michael Palimaka (kensington) from comment #5)
> Is it possible /usr/lib64/libruby.so could be a dangling symlink?

Yes, we used to have a /usr/lib64/libruby.so link as part of the eselect mechanism, but we stopped supporting that somewhere around ruby19. When I started looking at this issue I still had a dangling symlink around.

I'm convinced that I removed that link while testing this issue, but I now see that it is still around. :-(  Removing it makes the issue go away.

@soap: can you also check that you have this link?
Comment 7 Johannes Huber (RETIRED) gentoo-dev 2016-05-17 12:30:27 UTC
(In reply to Hans de Graaff from comment #6)
> (In reply to Michael Palimaka (kensington) from comment #5)
> > Is it possible /usr/lib64/libruby.so could be a dangling symlink?
> 
> Yes, we used to have a /usr/lib64/libruby.so link as part of the eselect
> mechanism, but we stopped supporting that somewhere around ruby19. When I
> started looking at this issue I still had a dangling symlink around.
> 
> I'm convinced that I removed that link while testing this issue, but I now
> see that it is still around. :-(  Removing it makes the issue go away.
> 
> @soap: can you also check that you have this link?

Removing kde then.
Comment 8 Hans de Graaff gentoo-dev Security 2016-05-30 16:57:02 UTC
It looks like this link is only present on old (ca. 2008) systems that still had ruby 1.8 installed at some point.

@ruby: a suggested fix would be to remove this link in the remove_symlinks() method of eselect-ruby. Please review attached patch:

@@ -8,6 +8,7 @@ SVN_DATE="20151229"
 VERSION="20151229"
 
 bindir=/usr/bin
+libdir=/usr/lib
 man1dir=/usr/share/man/man1
 
 find_targets() {
@@ -43,6 +44,13 @@ check_target() {
 remove_symlinks() {
        rm -f ${EROOT}${bindir}/{ruby,gem,irb,erb,ri,rdoc,testrb} && \
        rm -f ${EROOT}${man1dir}/{ruby,irb,erb,ri}.1*
+
+       # Remove unversioned legacy link set by ruby 1.8 and earlier
+       # see bug 582672
+       local link="${EROOT}${libdir}/libruby.so"
+       if [[ -e ${link} ]]; then
+               rm -f ${link}
+       fi
 }
 
 create_man_links() {
Comment 9 William L. Thomson Jr. 2016-11-17 17:11:38 UTC
I am running into this on newer systems. I had another on my build host from 2015.

12 Apr  4  2013 /usr/lib/libruby.so -> libruby18.so
Comment 10 Hans de Graaff gentoo-dev Security 2017-07-23 07:45:09 UTC
(In reply to Hans de Graaff from comment #8)

> @ruby: a suggested fix would be to remove this link in the remove_symlinks()
> method of eselect-ruby. Please review attached patch:

This patch is now available in eselect-ruby-20170723.