Changes between Version 5 and Version 6 of Ticket #70420, comment 9
- Timestamp:
- Aug 8, 2024, 12:48:25 AM (2 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #70420, comment 9
v5 v6 3 3 Starting with this bug report and #66077 ... 4 4 5 ` luajit` is used for much of the build process, and the neovim Portfile contains `configure.args-append -DLUA_PRG=${prefix}/bin/luajit`. `luajit` is its own thing and adheres only to the lua-5.1 language spec. `luajit` works regardless of the state of other lua packages on my system. All good so far.5 `neovim` depends on `lua51-lpeg`, which depends on `lua-luarocks`, which depends on `lua` and `lua53-luarocks`, guaranteeing that `lua` and `lua53` ports will be installed when trying to install neovim. 6 6 7 But neovim also uses some C, and builds a library, `nlua0`, from `src/nlua0.c` in the neovim source tree. The first line of this file is `#include <lua.h>`. 7 `luajit` is used for much of the build process, and the neovim Portfile contains `configure.args-append -DLUA_PRG=${prefix}/bin/luajit`. `luajit` is its own thing and adheres only to the lua-5.1 language spec. `luajit` works regardless of the state of other lua packages on my system. 8 8 9 When the `lua` port is installed, it creates `/opt/local/include/lua.h`, which contains C headers for lua 5.3. Because this is the first `lua.h` file the compiler finds in the include directory, the C compiler uses this header and then builds `nlua0` against lua 5.3. 9 But neovim also uses some C, and builds a library, `nlua0`, from `src/nlua0.c` in its source tree, which `luajit` uses later in the build process. The first line of `nlua0.c` is `#include <lua.h>`. 10 11 The `lua` port creates `/opt/local/include/lua.h`, which contains C headers for lua 5.3. Because this is the first `lua.h` file the compiler finds in the include directory, the C compiler uses this header and then builds `nlua0` against lua 5.3. 10 12 11 13 This breaks the neovim build as described in this ticket and in #66077 because `nlua0` pulls in symbols from lua 5.3 that `luajit` can't grok (because `luajit` is strictly 5.1). 12 14 13 The fix for this is to get the compiler to look in `/opt/local/include/lua5.1` and usethe `lua.h` header from the `lua51` port. ''See'' [https://github.com/macports/macports-ports/pull/25223 GitHub PR].15 The fix for this is to get the compiler to look in `/opt/local/include/lua5.1` so that it uses the `lua.h` header from the `lua51` port. ''See'' [https://github.com/macports/macports-ports/pull/25223 GitHub PR]. 14 16 15 17 {{{ … … 55 57 Now on to some of my other discoveries while investigating this issue ... 56 58 57 I don't think the build/install issues with `luarocks` are as simple as the commit referenced abovesuggests. There seem to be a few broken layers to unpack here (though to be clear this is unrelated to the neovim build).59 I don't think the build/install issues with `luarocks` are as simple as the commit referenced [https://trac.macports.org/ticket/70420?cnum_edit=9#comment:8 above] suggests. There seem to be a few broken layers to unpack here (though to be clear this is unrelated to the neovim build). 58 60 59 61 At the top of the [https://github.com/luarocks/luarocks/blob/master/src/luarocks/core/cfg.lua config file] referenced in that git commit: … … 86 88 }}} 87 89 88 Whether I run `luarocks`, `luarocks-5.1`, `luarocks-5.2`, `luarocks-5.3`, or `luarocks-5.4`, they all return the same configuration. The versioned copies are all symlinks to the same `/opt/local/bin/luarocks` script, so this comes as no shock.90 Whether I run `luarocks`, `luarocks-5.1`, `luarocks-5.2`, `luarocks-5.3`, or `luarocks-5.4`, they all return the same info. The versioned copies are all symlinks to the same `/opt/local/bin/luarocks` script, so this comes as no shock. 89 91 90 That `luarocks` script has lua-5.3 paths hard-coded into it:92 That `luarocks` script also has lua 5.3 paths hard-coded into it: 91 93 92 94 {{{ … … 115 117 So in summary: 116 118 117 1. The `lua` port decides for you what version of lua (currently 5.3) will be the default lua on your system, and that all C libraries linking against `lua.h` will build against that version without extra care. 118 1. Any port that depends on `lua` installs and makes the `lua` port's version (currently 5.3) your default lua, even if your lua-based port actually depends on an older version of lua. 119 1. The `lua` port decides for you what version of lua (currently 5.3) will be the default lua on your system. 120 a. Note that all C libraries linking against `lua.h` will build against that version without extra care. 121 1. There is no facility to manage which version of lua is used as the system default. 122 1. Any port that depends on `lua` installs and makes the `lua` port's version (currently 5.3) the default, even if the dependent port is incompatible with that version. 119 123 1. The `lua` port installs a 5.3 binary in `/opt/local/bin/lua` that appears to be similar, but not identical, to the `/opt/local/bin/lua5.3` binary installed by the `lua53` port. 120 1. There is no facility to manage which version of lua is used as the system default.121 124 1. Uninstalling the `lua` port will break `luarocks` and potentially other lua ports, even though they could use a different version of lua. 122 125 1. `neovim` depends on `lua51-lpeg`, which depends on `lua-luarocks`, which depends on `lua` and `lua53-luarocks`, guaranteeing that `lua53` will be installed when trying to install neovim, even though neither `lua51-lpeg` nor `neovim` wants anything to do with lua 5.3. 123 1. Building `neovim` is breaking because it links against the `lua.h` provided by the `lua` port (currently 5.3), which is incompatible with neovim and luajit (not for any reasons having to do with `luarocks`).126 1. Building `neovim` is breaking because it links against the `lua.h` provided by the `lua` port (currently 5.3), which is incompatible with neovim and luajit. 124 127 1. `luarocks` always runs against the version of lua installed by the `lua` port, because its shebang is `/opt/local/bin/lua`, which is (currently) lua 5.3 by design of the `lua` port. 125 128 a. This remains true even if running `luarocks-5.n` because the versioned copies are all symlinks to the same `luarocks` script. 129 a. The `luarocks-5.n` symlinks are therefore not likely useful and/or probably broken for their intended purpose. 126 130 1. `luarocks` always manages packages in `/opt/local/share/lua/5.3` because this value is hard-coded in the script. 131 1. MacPorts probably needs to add a selection mechanism for setting and using the desired version of lua on the system. 127 132 128