Gentoo Archives: gentoo-dev

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo development <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] the state of dev-lang/lua
Date: Mon, 25 Mar 2019 04:23:17
Message-Id: robbat2-20190325T032311-646182547Z@orbis-terrarum.net
In Reply to: [gentoo-dev] the state of dev-lang/lua by William Hubbs
1 On Sat, Mar 23, 2019 at 04:23:27PM -0500, William Hubbs wrote:
2 > Hi all,
3 >
4 > Soon I will be working on fixing up the state of dev-lang/lua, and there
5 > are a couple of things I want to mention.
6 >
7 > The first thing is liblua as a shared library. If you are using lua
8 > internally in a program, upstream strongly recommends not linking it
9 > this way; it is supposed to be statically linked into the executable.
10 > Because of this, and because of the amount of custom patching we do to
11 > maintain liblua as a shared library, I plan to stop creating the shared
12 > library.
13 Please don't go back to static libraries. Look at the other major
14 distros, all of them shipped shared Lua as the primary method.
15
16 I'm just going to link to the Ubuntu examples here, but Debian, Fedora &
17 Arch are similar:
18 https://packages.ubuntu.com/source/cosmic/lua5.1
19 https://packages.ubuntu.com/source/cosmic/lua5.2
20 https://packages.ubuntu.com/source/cosmic/lua5.3
21 https://packages.ubuntu.com/cosmic/amd64/liblua5.1-0/filelist
22 https://packages.ubuntu.com/cosmic/amd64/liblua5.2-0/filelist
23 https://packages.ubuntu.com/cosmic/amd64/liblua5.3-0/filelist
24
25 Ubuntu & Debian DO ship the static library .a file, as part of
26 the liblua5.X-dev binary package.
27
28 That said, the pkgconfig files we output for Lua5.2 & Lua5.3 do have
29 errors in some cases, bringing in the non-slotted include directory, and
30 trying to use the non-slotted library soname; which need to be fixed
31 properly.
32
33 Upstream's original objections about static libraries mostly revolved
34 around the lack of registers on i386 with -fPIC, as well as subtle
35 breakage when the library SONAME was just generically 'liblua', without
36 much version information, as this broke when functions were dropped.
37
38 > I'm a bit undecided still about slotting lua. I'm sure we
39 > need subslots so we can force rebuilds when new lua releases enter the
40 > tree. However, I'm still unsure whether we need slots. I don't know of
41 > many things in the tree that are locked to a specific version
42 > of lua (there is only one package based on an irc conversation I
43 > had this week).
44 > Does anyone have any thoughts?
45 Lua needs first class slots, just like Python & Ruby, not just subslots.
46 Changing between versions can be a major undertaking.
47
48 I think the slots to start with should be:
49 - lua5.1
50 - lua5.2
51 - lua5.3
52 - luajit5.1 (this is basically an alternative implementation of Lua5.1,
53 much like pypy implements Python2).
54
55 Porting between versions is non-trivial, as the API has changed in
56 incompatible ways.
57
58 There are two tricks to make porting easier, but they are not
59 guaranteed.
60 1. USE=deprecated on Lua5.2/5.3 offers most of the prior version APIs;
61 mostly from Lua5.3 back to Lua5.2 & Lua5.1 with the LUA_COMPAT_5_2 &
62 LUA_COMPAT_5_1 compile-time defines.
63 2. In the other direction, there is 'lua-compat-5.3', which we don't
64 have packaged; It offers parts of Lua-5.3 functionality to
65 Lua-5.1/5.2. I'll quote from the docs:
66 "This does not make Lua 5.2 (or even Lua 5.1) entirely compatible
67 with Lua 5.3, but it brings the API closer to that of Lua 5.3."
68 That project maintains a good list of what's not implemented:
69 https://github.com/keplerproject/lua-compat-5.3#whats-not-implemented
70
71 > Are there more packages in the tree that are locked to a specific version of lua?
72 Yes, several, and more on that in a second.
73
74 I think packages will need one of two variables:
75 LUA_SINGLE_TARGET
76 LUA_TARGETS
77
78 LUA_TARGETS is probably only going to be used by the dev-lua/ modules.
79 LUA_SINGLE_TARGET is probably going to be used by MOST packages that
80 include Lua as an embedded scripting language; of which I'll discuss a
81 few below.
82
83 The pain in Lua thusfar I see comes when one of the packages with
84 embedded Lua scripting needs to consume a system-wide Lua module.
85
86 Some Lua modules provide special-case handling for luajit, to ensure
87 best performance.
88
89 I personally work on net-proxy/haproxy, which supports ONLY Lua 5.3. It
90 relies on some functionality that cannot be back-ported to earlier
91 releases (heavy usage of coroutine/yield & uint64)
92
93 I'm also about to add back sys-apps/likwid to the tree, for which the
94 upstream bundles Lua 5.3, but the code explicitly is written to support
95 a system-wide copy of Lua 5.2 or Lua 5.3. The ebuild now uses the
96 system-wide copy of Lua 5.3. likwid ships as both a set of Lua scripts
97 that bring in a special C library, as well as Lua scripting placed back
98 into that C library.
99
100 x11-wm/awesome is a good example of a package with support for multiple
101 versions of Lua. For a long time upstream only supported Lua 5.1, but in
102 the recent major versions of Awesome, the upstream dev has Lua 5.2 & Lua
103 5.3 support with a test environment. I'm running on my own local ebuild
104 with Awesome linked against Lua 5.3 as I write this.
105
106 dev-db/redis is a good example of where Upstream tried to port from 5.1
107 to newer versions, but did an incomplete job:
108 - Try to compile it with Lua5.3 and it falls over numeric types.
109 - Try to compile it with Lua5.2 and it falls over the
110 lua_open/lua_newstate.
111
112 --
113 Robin Hugh Johnson
114 Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
115 E-Mail : robbat2@g.o
116 GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
117 GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] the state of dev-lang/lua "Michał Górny" <mgorny@g.o>
Re: [gentoo-dev] the state of dev-lang/lua Patrick McLean <chutzpah@g.o>