[MacPorts] #67765: Change #37496 seems to have broken lua54-luarocks

MacPorts noreply at macports.org
Thu Aug 3 17:06:12 UTC 2023


#67765: Change #37496 seems to have broken lua54-luarocks
------------------------------+----------------------
  Reporter:  michaellenaghan  |      Owner:  l2dy
      Type:  defect           |     Status:  assigned
  Priority:  Normal           |  Milestone:
 Component:  ports            |    Version:
Resolution:                   |   Keywords:
      Port:  lua54-luarocks   |
------------------------------+----------------------

Comment (by michaellenaghan):

 Just to make sure we're on the same page: I understand the intent of the
 change. From a user perspective, I'm not sure it works. Try this:

 {{{
 $ sudo port install lua54
 $ sudo port install lua-luarocks
 $ luarocks install --local LuaFileSystem
 $ lua5.4
 > lfs = require("lfs")

 }}}

 That won't work, for two reasons.

 First, as far as I can tell, installing `luarocks` doesn't add the
 `luarocks` paths to `LUA_PATH` and `LUA_CPATH`.  Maybe that's "as
 designed", but it isn't obvious; the port doesn't publish any usage notes,
 etc. as most ports that require additional config do.

 Second, and perhaps more importantly: the rock will be built and installed
 for `lua5.3` rather than `lua5.4`. It's true that `luarocks` can build for
 any version. But it's also true that, by default, it builds for the
 version it's based on. In order to build for any *other* version, you have
 to specify that version — e.g. `--lua-version 5.4` -- every time you do
 anything.

 To make matters worse, `luarocks` still installs a bunch of versioned
 symlinks:

 {{{
 $ ls /opt/local/bin/luarocks*
 /opt/local/bin/luarocks*           /opt/local/bin/luarocks-admin*
 /opt/local/bin/luarocks-5.1@       /opt/local/bin/luarocks-admin-5.1@
 /opt/local/bin/luarocks-5.2@       /opt/local/bin/luarocks-admin-5.2@
 /opt/local/bin/luarocks-5.3@       /opt/local/bin/luarocks-admin-5.3@
 /opt/local/bin/luarocks-5.4@       /opt/local/bin/luarocks-admin-5.4@
 }}}

 Using a versioned symlink still builds for the *default* `lua` version,
 rather than the version you selected:

 {{{
 $ luarocks-5.4

 ...

 Configuration:
    Lua:
       Version    : 5.3
       Interpreter: /opt/local/bin/lua (ok)
       LUA_DIR    : /opt/local (ok)
       LUA_BINDIR : /opt/local/bin (ok)
       LUA_INCDIR : /opt/local/include (ok)
       LUA_LIBDIR : /opt/local/lib (ok)

    Configuration files:
       System  : /opt/local/etc/luarocks/config-5.3.lua (ok)
       User    : /Users/example/.luarocks/config-5.3.lua (not found)

    Rocks trees in use:
       /Users/example/.luarocks ("user")
       /opt/local/share/luarocks ("system")

 }}}

 and:

 {{{
 $ luarocks-5.4 path
 export
 LUA_PATH='/opt/local/share/lua/5.3/?.lua;/opt/local/share/lua/5.3/?/init.lua;/opt/local/lib/lua/5.3/?.lua;/opt/local/lib/lua/5.3/?/init.lua;…'
 export
 LUA_CPATH='/opt/local/lib/lua/5.3/?.so;/opt/local/lib/lua/5.3/loadall.so;./?.so;/Users/example/.luarocks/lib/lua/5.3/?.so;/opt/local/share/luarocks/lib/lua/5.3/?.so;…'
 export PATH='/Users/example/.luarocks/bin:/opt/local/share/luarocks/bin:…'
 }}}

 Notice that in both cases I'm using `luarocks-5.4` but seeing `5.3` in the
 paths.

 I don't know what the previous experience was like. I just know that this
 one is incredibly confusing. It may be possible to make it work right, but
 if something doesn't change you're likely to get more tickets like this
 one.

 P.S. It's also odd that 5.3 is the default `lua`? 5.4 was released in
 2020. I bring that up because if `luarocks` was using the *latest* version
 then maybe fewer users would run into these problems?

-- 
Ticket URL: <https://trac.macports.org/ticket/67765#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list