Re: [PATCH 2/4] libselinux, libsemanage: link Ruby wrapper with -lruby

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 21, 2017 at 3:42 PM, Stephen Smalley <sds@xxxxxxxxxxxxx> wrote:
> On Wed, 2017-06-21 at 11:38 +0200, Laurent Bigonville wrote:
>> Hello,
>>
>> Le 14/11/16 à 22:28, Nicolas Iooss a écrit :
>> > When linking with -Wl,-no-undefined in LDFLAGS (in order to find
>> > possible link-time errors), the Ruby wrapper module needs to be
>> > linked
>> > with the libruby.so which is used by $(RUBY). Introduce a new
>> > RUBYLIBS
>> > variable to find this library.
>> >
>> > Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx>
>> > ---
>> >   libselinux/src/Makefile  | 3 ++-
>> >   libsemanage/src/Makefile | 3 ++-
>> >   2 files changed, 4 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
>> > index 4fe1f7002181..82a1010af2d8 100644
>> > --- a/libselinux/src/Makefile
>> > +++ b/libselinux/src/Makefile
>> > @@ -15,6 +15,7 @@ INCLUDEDIR ?= $(PREFIX)/include
>> >   PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
>> >   PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site;
>> > print(site.getsitepackages()[0])')
>> >   RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" +
>> > RbConfig::CONFIG["rubyarchhdrdir"] + " -I" +
>> > RbConfig::CONFIG["rubyhdrdir"]')
>> > +RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" +
>> > RbConfig::CONFIG["libdir"] + " -lruby"')
>>
>> I'm trying to package 2.7-rc2 in debian and unfortunately this is
>> not
>> working out of the box for me. The library is not installed as
>> -lruby
>> but as -lruby-2.3 (for ruby 2.3). In addition the lib is not
>> installed
>> in /usr/lib.
>>
>> I can see in the RbConfig::CONFIG hash a key called LIBRUBYARG_SHARED
>> or
>> LIBRUBYARG which contains "-lruby-2.3". Also I see a "archlibdir" or
>> "sitearchlibdir" key which contains the correct path to the lib (the
>> multiarch path)
>>
>> RUBYLIBS ?= $(shell $@ -e 'puts "-L" + RbConfig::CONFIG["archlibdir"]
>> +
>> " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
>>
>> Could this be a possible alternatives for the other distributions?
>
> Assuming you mean $(RUBY) rather than $@ above, that works for me on
> Fedora:
> $ ruby -e 'puts "-L" + RbConfig::CONFIG["archlibdir"] + " " +
> RbConfig::CONFIG["LIBRUBYARG_SHARED"]'
> -L/usr/lib64 -lruby

On Arch Linux:

$ ruby -e 'puts RbConfig::CONFIG["LIBRUBYARG"]'
-lruby
$ ruby -e 'puts RbConfig::CONFIG["LIBRUBYARG_SHARED"]'
-lruby
$ ruby -e 'puts RbConfig::CONFIG["archlibdir"]'
/usr/lib/x86_64-linux
$ ls -l /usr/lib/x86_64-linux/libruby.so
ls: cannot access '/usr/lib/x86_64-linux/libruby.so': No such file or directory
$ ruby -e 'puts RbConfig::CONFIG["libdir"]'
/usr/lib
$ ls -l /usr/lib/libruby.so
lrwxrwxrwx 1 root root 16 2017-04-22 15:40 /usr/lib/libruby.so ->
libruby.so.2.4.1*

So replacing -lruby with RbConfig::CONFIG["LIBRUBYARG_SHARED"] and
adding "-L" + RbConfig::CONFIG["archlibdir"] in RUBYLIBS definition
seem to work fine.

Nicolas





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux