Gentoo Archives: gentoo-dev

From: Jaco Kroon <jaco@××××××.za>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Slotted Lua + revdeps to be unmasked on Christmas Eve
Date: Thu, 24 Dec 2020 10:21:31
Message-Id: 27c0fd47-7993-072a-3d8a-18362f3307c7@uls.co.za
In Reply to: [gentoo-dev] Re: Slotted Lua + revdeps to be unmasked on Christmas Eve by Jonathan Callen
1 Hi,
2 >> Hmm, how would that work?
3 >> I have package A with a binary /usr/bin/binA linked to liblua51.so (which in
4 >> your suggestion would change to /usr/lib64/lua5.1/liblua.so) and
5 >> and /usr/bin/binB linked to liblua52.so (or /usr/lib64/lua5.2/liblua.so).
6 >> I don't see any ordering of /usr/lib64/lua5.1/ and /usr/lib64/lua5.2/
7 >> that allows for binA and binB to find their correct lua libraries.
8 >> (This doesn't need to be for binaries, other shared libraries even)
9 >>
10 >> Admittedly, I am not a lua or linker expert...
11 >>
12 >> Aisha
13 >>
14 >>
15 > My intention with the suggestion was that the actual library be stored
16 > in /usr/lib64/liblua52.so (or whatever the appropriate name is), but a
17 > symlink used for linking be stored in /usr/lib64/lua5.2/liblua.so. When
18 > you pass "-L /usr/lib64/lua5.2 -llua" to the compiler, it will find the
19 > file /usr/lib64/lua5.2/liblua.so and read the DT_SONAME entry in it.
20 > That will cause the linker to store "liblua52.so" as a DT_NEEDED entry
21 > in the executable. At runtime, the runtime linker ld.so
22 > (/lib64/ld-linux-x86-64.so.2) will read the DT_NEEDED entry, and try to
23 > find the library liblua52.so, which is in /usr/lib64, so it will be
24 > found without any ld.so.conf tricks. This requires no special runtime
25 > support, as the actual name the compiler/linker will end up storing in
26 > the output contains the proper version. This means that if
27 > /usr/bin/binA linked to liblua51.so (via the linker finding
28 > /usr/lib64/lua5.1/liblua.so) and /usr/bin/binB linked to liblua52.so
29 > (likewise), they would both be able to find the correct libraries, as
30 > the DT_SONAMEs are different.
31 net-misc/asterisk don't need this (any more,
32 https://gerrit.asterisk.org/c/asterisk/+/15234), but I'd be in support
33 of something like this as a general "pattern", both for lua as well as
34 other SLOT'ed libs.  I might suggest that /usr/lib64/lua5.x/ is perhaps
35 not the most ideal location, since include headers needs to match too
36 ... and most of these ./configure type things just take --with-lua=PATH
37 and I think assume $PATH/include + $PATH/lib{,32,64} ... granted they
38 also allow for additional LUA_INCLUDE environment variables in *some* cases.
39
40 So perhaps something we can learn from the "scripting" world ...
41
42 /usr/pkgslots/${pkgname}/${version}/{include,lib64,lib32} kind of thing,
43 with as few as possible actual directories, preferring symlinks and
44 definitely no files ever.
45
46 So for lua5.1, this would be something like:
47
48 /usr/pkgslots/lua/5.1/
49    include => /usr/include/lua5.1
50    for X in so{,.0,.0.0.0} a la:
51        lib{32,64}/liblua.$X => /usr/lib{32,64}/liblua5.1.$X
52
53 This might be worth an eclass (which I'd love to take a shot at,
54 probably with LOADS of help) if there is general interest in making this
55 a kind of pattern.
56
57 Having said all of that, I tend to agree that ./configure should as a
58 rule try to use pkgconfig whenever and wherever possible.
59
60 Kind Regards,
61 Jaco