Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Lua 5.1 -> 5.2 fallout #32354

Closed
aktau opened this issue Sep 17, 2014 · 84 comments
Closed

Lua 5.1 -> 5.2 fallout #32354

aktau opened this issue Sep 17, 2014 · 84 comments
Labels

Comments

@aktau
Copy link
Contributor

aktau commented Sep 17, 2014

It seems that luarocks + luajit (and possibly other combos) have been made non-working by this recent change:

➜  pcsx2 git:(osx-compat-v1) ✗ brew install luajit
==> Downloading http://luajit.org/download/LuaJIT-2.0.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/luajit-2.0.3.tar.gz
==> make amalg PREFIX=/usr/local/Cellar/luajit/2.0.3_1
==> make install PREFIX=/usr/local/Cellar/luajit/2.0.3_1
🍺  /usr/local/Cellar/luajit/2.0.3_1: 25 files, 2,0M, built in 15 seconds
➜  pcsx2 git:(osx-compat-v1) ✗ luajit
LuaJIT 2.0.3 -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
>

➜  pcsx2 git:(osx-compat-v1) ✗ brew edit luarocks
➜  pcsx2 git:(osx-compat-v1) ✗ brew install luarocks --with-luajit
==> Installing luarocks dependency: lua51
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/lua51-5.1.5.mavericks.bottle.tar.gz
######################################################################## 100,0%
==> Pouring lua51-5.1.5.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/lua51/5.1.5: 15 files, 292K
==> Installing luarocks
==> Downloading http://luarocks.org/releases/luarocks-2.1.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/luarocks-2.1.2.tar.gz
==> Patching
patching file src/luarocks/fs/lua.lua
Hunk #1 succeeded at 741 (offset 72 lines).
==> ./configure --prefix=/usr/local/Cellar/luarocks/2.1.2_1 --rocks-tree=/usr/local --sysconfdir=/usr/local/etc/luarocks --with-lua-include=/usr/local/opt/luajit/include/luajit-2.0 --lua-suffix=jit --wi
==> make
==> make install
==> Caveats
Rocks install to: /usr/local/lib/luarocks/rocks

You may need to run `luarocks install` inside the Homebrew build
environment for rocks to successfully build. To do this, first run `brew sh`.
==> Summary
🍺  /usr/local/Cellar/luarocks/2.1.2_1: 62 files, 536K, built in 2 seconds
➜  pcsx2 git:(osx-compat-v1) ✗ brew sh
Your shell has been configured to use Homebrew's build environment:
this should help you build stuff. Notably though, the system versions of
gem and pip will ignore our configuration and insist on using the
environment they were built under (mostly). Sadly, scons will also
ignore our configuration.
When done, type `exit'.
➜  pcsx2 git:(osx-compat-v1) ✗ luarocks install
➜  pcsx2 git:(osx-compat-v1) ✗ luarocks install luafilesystem
env: lua: No such file or directory
➜  pcsx2 git:(osx-compat-v1) ✗ luarocks install luafilesystem
➜  pcsx2 git:(osx-compat-v1) ✗ lua
zsh: command not found: lua
@MikeMcQuaid
Copy link
Member

@DomT4 if you get the chance to look at this it would be great.

@DomT4
Copy link
Member

DomT4 commented Sep 17, 2014

@MikeMcQuaid On it.

@DomT4
Copy link
Member

DomT4 commented Sep 17, 2014

==> Summary
🍺  /usr/local/Cellar/luajit/2.0.3_1: 25 files, 2.0M, built in 27 seconds
➜  ~  luajit
LuaJIT 2.0.3 -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
brew install -v --debug -d luarocks --with-luajit
==> ./configure --prefix=/usr/local/Cellar/luarocks/2.1.2_1 --rocks-tree=/usr/local --sysconfdir=/usr/local/etc/luarocks --with-lua-include=/usr/local/opt/luajit/include/luajit-2.0 --lua-suffix=jit --with-lua=/usr/local/opt/luajit
LuaRocks configuration directory: /usr/local/etc/luarocks
Using Lua from: /usr/local/opt/luajit
➜  ~  luarocks install luafilesystem
lua: /usr/local/bin/luarocks:3: module 'luarocks.loader' not found:
    no field package.preload['luarocks.loader']
    no file '/usr/local/share/lua/5.2/luarocks/loader.lua'
    no file '/usr/local/share/lua/5.2/luarocks/loader/init.lua'
    no file '/usr/local/lib/lua/5.2/luarocks/loader.lua'
    no file '/usr/local/lib/lua/5.2/luarocks/loader/init.lua'
    no file './luarocks/loader.lua'
    no file '/usr/local/lib/lua/5.2/luarocks/loader.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './luarocks/loader.so'
    no file '/usr/local/lib/lua/5.2/luarocks.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './luarocks.so'
stack traceback:
    [C]: in function 'require'
    /usr/local/bin/luarocks:3: in main chunk
    [C]: in ?

If I remove Lua, Lua51, Luajit & Luarocks and start completely fresh with brew install Luajit and then brew install Luarocks I hit:

➜  ~  luarocks install filesystem
env: lua: No such file or directory

It looks like it's ignoring the Lua51 directory installation with luajit in favour of looking at the Lua52 directory regardless. I'll take a deeper poke at this ASAP.

@h4rm
Copy link

h4rm commented Sep 17, 2014

Great, having the same problem right now.

@DomT4
Copy link
Member

DomT4 commented Sep 17, 2014

I've got a few solid ideas on this, and am working as quickly as I can to test them and issue a fix.

@adamv adamv added the lua label Sep 17, 2014
@DomT4
Copy link
Member

DomT4 commented Sep 17, 2014

Still working on this. I don't think I've done much else for the last 3 hours, heh. The failure seems to be that Luajit is absolutely determined to look for a Lua binary in {bin}, which obviously now points at Lua-5.2.x rather than Lua-5.1.x, and so when we install Luajit with Lua51 it still attempts to find a Lua binary instead of Lua5.1 or some variation of that and obviously, comes up short. I'm currently going through Luajit's source code to find out if that's hard-coded in somewhere and we can tweak that in the compile process perhaps.

@DomT4
Copy link
Member

DomT4 commented Sep 17, 2014

The failure isn't actually caused by Luajit as such, because if you do brew install luarocks --with-lua51 you get the same error. So the failure must actually be with Luarocks itself, and how it expects things to be named. Luajit does look for that Lua binary, and will rub against new Lua binary, and I suspect changes will have to be made to the Luajit formula but right now I think the bigger issue driving this is the Luarocks and Lua5.1 binary name hunting issue.

I think.

Every few hours I make a little progress only to go "Ah. I see. This problem is actually caused by a bigger problem. Okay then, Let's go look at that".

@DomT4
Copy link
Member

DomT4 commented Sep 20, 2014

Making some progress on this. Some. I'm tempted to push an interim 'fix' where I cull the Luajit & Lua51 options entirely from the formula till I can sort it out, just to avoid tangling anyone else up in the issue. FWIW I haven't managed to find any other conflicts yet, partly because there are extremely few formula that have the option of which lua they prefer to tap.

This problem doesn't crop up if there's no option on which Lua you get to pick, because then the formula only looks for Lua which is Lua5.2 and the Lua5.2.pc file we create points to the right directories and files, and the formula that don't use pkg-config as a build dep find the Lua binary easily enough because of the naming convention we adopted.

I considered renaming the Lua binaries to Lua5.2 and keeping the Lua51 formula as Lua5.1 but that caused a whole host of other problems and didn't actually fix this one. But I'm still working on this, and will do my best to find a solution to this one particularly big problem. Other than this unexpected issue, which I should have caught in the pretty thorough testing to be honest, things seem to have gone fairly smoothly.

@DomT4 DomT4 mentioned this issue Sep 20, 2014
@DomT4
Copy link
Member

DomT4 commented Sep 20, 2014

Just so folks are absolutely sure, #32459 does not and is not intended to close this in any way, shape or form. I'm working on a significantly larger fix for this issue, a fix that is likely to end up revisioning quite a few other formula, so I wanted to work on that from a clean tree without the version bump causing unnecessary noise in testing. Hopeful of having the Lua51 & Luajit builds back in Luarocks within a week tops.

@h4rm
Copy link

h4rm commented Sep 20, 2014

Thanks a lot for your work. I really appreciate it.
Am 20.09.2014 22:46 schrieb "Dominyk Tiller" notifications@github.com:

Just so folks are absolutely sure, #32459
#32459 does not and is not
intended to close this in any way, shape or form. I'm working on a
significantly larger fix for this issue, a fix that is likely to end up
revisioning quite a few other formula, so I wanted to work on that from a
clean tree without the version bump causing unnecessary noise in testing.
Hopeful of having the Lua51 & Luajit builds back in Luarocks within a week
tops.


Reply to this email directly or view it on GitHub
#32354 (comment).

@daurnimator
Copy link

What is the luarocks output inside and outside of brew sh?

Should be something like:

CONFIGURATION
        Lua version: 5.2
        Configuration files:
                System: /etc/luarocks/config-5.2.lua (ok)

vs

CONFIGURATION
        Lua version: 5.1
        Configuration files:
                System: /etc/luarocks/config-5.1.lua (ok)

@DomT4
Copy link
Member

DomT4 commented Sep 22, 2014

I'm pretty sure I know what the problem is, at least with the Luarocks config. I'll be pushing some fairly major changes in the next few days to deal with this. It's going to require a lot of local testing though, which is what is slowing me down at the moment.

Right now inside Homebrew attempting to build Luarocks --with-lua51 will just fail, because we've removed the option very temporarily.

@E14
Copy link

E14 commented Oct 1, 2014

For someone looking for a workaround:

I had to solve this by uninstalling Luarocks, then rolling back the Homebrew 'lua' package to a 5.1 version (for which I thankfully still had a package in the cache, despite running a cleanup), then build and install Luarocks from source.

The 'lua51' version does not seem to add headers or libraries without the 5.1 version attached somewhere in the name, and so Rocks will fail installing when they require compilation

@DomT4
Copy link
Member

DomT4 commented Oct 1, 2014

Still working on this. Haven't abandoned it. Hope to get the fix pushed by Sunday evening. A lot of work & revisions to be done & tested & checked over hence the delay here.

Sent from my iPhone

On 1 Oct 2014, at 12:07, E14 notifications@github.com wrote:

For someone looking for a workaround:

I had to solve this by uninstalling Luarocks, then rolling back the Homebrew 'lua' package to a 5.1 version (for which I thankfully still had a package in the cache, despite running a cleanup), then build and install Luarocks from source.

The 'lua51' version does not seem to add headers or libraries without the 5.1 version attached somewhere in the name, and so Rocks will fail installing when they require compilation


Reply to this email directly or view it on GitHub.

@raguay
Copy link

raguay commented Oct 1, 2014

Not sure if this is related, but I can not get luarocks to install on my OSX 10.10 homebrew. I had homebrew before upgrading to 10.10, it died and I completely removed homebrew and just got it to successfully install today. Now, I am trying to get lua 5.2 and luarocks to install. lua works, but luarocks says that it can not find /usr/local/Cellar/luarocks/2.1.1/share/lua in the linking stage. Therefore, the script for linking is still trying to use the old version of lua. I need 5.2 for my Mjolnir installation.

@DomT4
Copy link
Member

DomT4 commented Oct 1, 2014

Looks like a user config issue rather than a Lua issue. Try the usual brew update, brew remove Lua, brew remove luarocks, brew update, brew prune, brew cleanup and finally brew install luarocks. See if that works?

Sent from my iPhone

On 1 Oct 2014, at 15:54, Richard Guay notifications@github.com wrote:

Not sure if this is related, but I can not get luarocks to install on my OSX 10.10 homebrew. I had homebrew before upgrading to 10.10, it died and I completely removed homebrew and just got it to successfully install today. Now, I am trying to get lua 5.2 and luarocks to install. lua works, but luarocks says that it can not find /usr/local/Cellar/luarocks/2.1.1/share/lua in the linking stage. Therefore, the script for linking is still trying to use the old version of lua. I need 5.2 for my Mjolnir installation.


Reply to this email directly or view it on GitHub.

@raguay
Copy link

raguay commented Oct 1, 2014

Done all that at least twice. Nothing helped. That is why I figure the brew
script is buggy.

Richard

On Wed, Oct 1, 2014 at 10:31 PM, Dominyk Tiller notifications@github.com
wrote:

Looks like a user config issue rather than a Lua issue. Try the usual brew
update, brew remove Lua, brew remove luarocks, brew update, brew prune,
brew cleanup and finally brew install luarocks. See if that works?

Sent from my iPhone

On 1 Oct 2014, at 15:54, Richard Guay notifications@github.com wrote:

Not sure if this is related, but I can not get luarocks to install on my
OSX 10.10 homebrew. I had homebrew before upgrading to 10.10, it died and I
completely removed homebrew and just got it to successfully install today.
Now, I am trying to get lua 5.2 and luarocks to install. lua works, but
luarocks says that it can not find
/usr/local/Cellar/luarocks/2.1.1/share/lua in the linking stage. Therefore,
the script for linking is still trying to use the old version of lua. I
need 5.2 for my Mjolnir installation.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#32354 (comment).

@raguay
Copy link

raguay commented Oct 1, 2014

Hey, the third time worked. Weird. Maybe I need to do a full wipe of
homebrew and re-install. What is the best method? The one brew gives when
you try to re-install ontop of brew does not seem to really get everything.

On Wed, Oct 1, 2014 at 10:39 PM, Richard Guay raguay@customct.com wrote:

Done all that at least twice. Nothing helped. That is why I figure the
brew script is buggy.

Richard

On Wed, Oct 1, 2014 at 10:31 PM, Dominyk Tiller notifications@github.com
wrote:

Looks like a user config issue rather than a Lua issue. Try the usual
brew update, brew remove Lua, brew remove luarocks, brew update, brew
prune, brew cleanup and finally brew install luarocks. See if that works?

Sent from my iPhone

On 1 Oct 2014, at 15:54, Richard Guay notifications@github.com
wrote:

Not sure if this is related, but I can not get luarocks to install on
my OSX 10.10 homebrew. I had homebrew before upgrading to 10.10, it died
and I completely removed homebrew and just got it to successfully install
today. Now, I am trying to get lua 5.2 and luarocks to install. lua works,
but luarocks says that it can not find
/usr/local/Cellar/luarocks/2.1.1/share/lua in the linking stage. Therefore,
the script for linking is still trying to use the old version of lua. I
need 5.2 for my Mjolnir installation.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#32354 (comment)
.

@DomT4
Copy link
Member

DomT4 commented Oct 1, 2014

@raguay Check out this script.

@raguay
Copy link

raguay commented Oct 2, 2014

Thanks!

@DomT4
Copy link
Member

DomT4 commented Oct 7, 2014

FWIW, I'm still working on this. Quite a few delays have managed to sneak in, from the gtk+3 update the other day that threw a few packages off, to the general way this is going to have to be fixed.

Essentially, I'm going to have to very slightly but importantly rebuild both the Luas we now ship and then once again check absolutely everything that depends on the Luas to check the changes don't require a revision elsewhere. At least both Luas, luarocks & luajit are going to require rebuilding & revisioning.

The actual changes themselves aren't overly difficult, but testing them to make sure we don't wander into another situation like this one is taking a while. Appreciate the wait is tedious, but I'd quite like to not spend too much more time staring at the word "Lua" after I fix this issue 😸.

@quentinfasquel
Copy link

Hi there,

I do need lua5.1 as the only lua on my machine, is there an easy way to get that working? and get luarocks against 5.1 instead of 5.2?

Thank you

@DomT4
Copy link
Member

DomT4 commented Oct 8, 2014

Alright. I'm too ill to do much today so I might as well spend the last few hours ironing this out. I'll finish this off finally today and solve this issue.

@DomT4
Copy link
Member

DomT4 commented Oct 8, 2014

Hilariously, lua-users where we pull the patches from is currently down. Terrific.

curl: (22) The requested URL returned error: 504 Gateway Timeout
Error: Failed to download resource "lua51--patch"
Download failed: http://lua-users.org/files/wiki_insecure/power_patches/5.1/sig_catch.patch

And the website is too:

Gateway Timeout: can't connect to remote host

Sigh. Once the website is back up I'll probably go vendor these patches manually to avoid this happening in future.

@DomT4
Copy link
Member

DomT4 commented Oct 8, 2014

Ah, this is confirmed upstream. They're looking into it:

screen shot 2014-10-08 at 19 42 02

@DomT4
Copy link
Member

DomT4 commented Oct 9, 2014

Okay. I'm back to the drawing board, again. 6 hours work and we end up in the same place ugh. Remember before when I said you get to the bottom of one issue and it turns out something else was causing that issue? Well, yeah.

It turns out the error message isn't directly from Lua, Lua51, Luarocks or Luajit itself. It comes from HOMEBREW_PREFIX/Library/Homebrew/requirements/language_module_dependency.rb, and more specifically this line:

      when :lua then %W{/usr/bin/env luarocks show #{@import_name}}

That is what is throwing the env error at me/us/anyone using 51.

This is what the env command should look like, and does look like using Lua/Lua52:

➜   /usr/bin/env luarocks

LuaRocks 2.2.0, a module deployment system for Lua

CONFIGURATION
    Lua version: 5.2
    Configuration files:
        System: /usr/local/etc/luarocks/config-5.2.lua (ok)
        User  : /Users/Dave/.luarocks/config.lua (not found)

    Rocks trees in use:
        /Users/Dave/.luarocks ("user")
        /usr/local ("system")

So when we do brew install luarocks --with-lua51 it should do:

➜   /usr/bin/env luarocks

LuaRocks 2.2.0, a module deployment system for Lua

CONFIGURATION
    Lua version: 5.1
    Configuration files:
        System: /usr/local/etc/luarocks/config-5.1.lua (ok)
        User  : /Users/Dave/.luarocks/config.lua (not found)

    Rocks trees in use:
        /Users/Dave/.luarocks ("user")
        /usr/local ("system")

But it doesn't. We hit the env error instead.

We seem to have gotten around this problem with Python and Python3 by separating out the two entities like this:

      when :python then %W{/usr/bin/env python -c import\ #{@import_name}}
      when :python3 then %W{/usr/bin/env python3 -c import\ #{@import_name}}

And that works.

But trying to do something similar with Lua doesn't work.

      when :lua then %W{/usr/bin/env luarocks show #{@import_name}}
      when :lua51 then %W{/usr/bin/env luarocks-5.1 show #{@import_name}}

      when :lua     then "luarocks install"
      when :lua51   then "luarocks-5.1 install"

And I'm kinda stumped by that, so I'll tag in @MikeMcQuaid who wrote the language requirement document, and @tdsmith who is the resident Python expert around here and see if I'm missing or doing something stupid here.

@DomT4
Copy link
Member

DomT4 commented Oct 9, 2014

If anyone wants to see the work in progress and offer up some tips/hints/etc, I've just pushed it here so it can be examined in the hope someone finds an answer to the above issue.

@tdsmith
Copy link
Contributor

tdsmith commented Oct 9, 2014

Is the problem that luarocks needs to support multiple luas and that doing that with a single luarocks formula is hard? Each flavor of python (python, python3, pypy, pypy3) bundles its own suffixed pip. Would that be easier?

@DomT4
Copy link
Member

DomT4 commented Oct 11, 2014

Prosody ship their own Homebrew formulae, with Lua51 and Luarocks as a specified dependency. Given they ship their own formula, with dependencies on other formula they ship, they could probably just add a modified luarocks formula to the ones they ship already and that would fix the problem for them easily enough. Their setup actually rubs against Homebrew a little because they don't use the tap method which will be hindering them significantly here.

@DomT4
Copy link
Member

DomT4 commented Oct 11, 2014

On the Prosody front; It'd take 15 minutes to set up a tap and sort this issue out. This particular issue has a very easy fix.

@stuartcarnie
Copy link
Contributor

Yes - I actually installed lua51 and the prosody from source. I can help with it when I get back to my computer later, @metalaureate

@metalaureate
Copy link

@stuartcarnie thank you!

@stuartcarnie
Copy link
Contributor

@DomT4 agree – a homebrew-prosody tap would be the best. I may end up creating one and a luarocks5.1 to see if they can all play nicely

@DomT4
Copy link
Member

DomT4 commented Oct 12, 2014

@stuartcarnie Yeah. Honestly, prosody's current setup is asking for trouble on several levels. They'd be far better creating a formal tap and then they could standardize the dependency format a little more and be able to use custom luarocks packages.

For the sake of knowing it works with all three luas and the sake of making life easier on you guys, you're more than welcome to use the Luarocks formula I drew up should we later decide we need to write back in Lua51 support, which is here. Obviously, If you use Lua51 by default just change the Lua references to Lua51 and vice versa.

It shouldn't take long to set up at all. 'Tis the great beauty of the tap system.

@zeen
Copy link

zeen commented Oct 12, 2014

Prosody author here. Our homebrew formula was a contribution, and does various things sub-optimally. I'd like to clean it up, and get Prosody into homebrew proper.

Regarding Lua 5.1 vs LuaJIT vs Lua 5.2, the situation is similar to Python 2 vs PyPy/etc vs Python 3.

Lua 5.1 is the most popular, widely deployed, widely supported. LuaJIT has full compatibility with 5.1, but is not fully compatible with 5.2 (it just implements a subset of 5.2's features, and on any conflict between 5.1 and 5.2, chooses the 5.1 feature). 5.2 is not binary or source compatible with 5.1 (it's theoretically a very similar but separate programming language, much like python2 vs 3). Don't let the version numbers fool you, it's not a 'minor' compatible release.

Mike Pall (LuaJIT author) has described Lua 5.2 as the Windows Vista of Lua releases, but I have no opinions on that :) I'd just like to note that 5.1 is very much in widespread use, more so than 5.2, and wont be dying too soon. Note that 5.3 is in the works now, and while it's mostly backwards compatible (not 100%), the Lua team makes no promises that it will remain compatible. Luarocks packages with binary components installed for 5.2 wont magically work on 5.3 without a recompile :)

Prosody cannot drop support for 5.1 or LuaJIT. Prosody is attempting to gain support for 5.2 as well, but this will take significant work, and then will be in a future Prosody release.

I assume you folks want to drop 5.1 support in luarocks? In my opinion this is wrong: side by side 5.1 and 5.2 installs should work in much the same way python 2 and 3 installs work. But I wont argue too much about this, if others feel differently. If luarocks can only do one or the other, it might make sense for Prosody to have a Prosody-local install of luarocks, or for Prosody to not use luarocks, and do local installs of dependencies directly (this is e.g., what happens on Debian/Ubuntu, as they have official non-luarocks packages of our dependencies). I don't want to lock a Prosody user to specific version of luarocks for their non-Prosody projects.

Another complication is Prosody has plugin support, and plugins can have their own rocks based dependencies.

Should I create a new GitHub issue around a Prosody homebrew formula?

@DomT4
Copy link
Member

DomT4 commented Oct 12, 2014

Prosody author here. Our homebrew formula was a contribution, and does various things sub-optimally. I'd like to clean it up, and get Prosody into homebrew proper.

With your level of customization you're probably better setting up a tap rather than trying to push things into the master branch here. I'll let the maintainers have some more say on that, but looking at what you do with the formulae I think a tap is the way to go and offers you the kind of setup you're looking for.

Don't let the version numbers fool you, it's not a 'minor' compatible release.

We're aware of that, and some of the significant differences. Lua 5.1 was released in 2006 though, and Lua 5.2 in 2011, and Lua 5.3 is under development. There was and is a real risk of hampering software by pegging absolutely everything to Lua 5.1 which is why we created this setup where they function side by side. For clarification - You can absolutely install Lua 5.1 and 5.2 without issue, side-by-side with Homebrew. That is done, and works. The only thing is the choice not to support a Luarocks formula that runs under multiple Luas.

I'd just like to note that 5.1 is very much in widespread use, more so than 5.2, and wont be dying too soon.

Some further information on this would be handy. As lovely as widespread use sounds, some penetration statistics would be genuinely useful here, especially in regards to Luarocks, which is the affected party here.

Luarocks packages with binary components installed for 5.2 wont magically work on 5.3 without a recompile :).

This is known and understood.

Prosody cannot drop support for 5.1 or LuaJIT.

You don't need to. Homebrew supports side-by-side installations of Lua51 and Lua52 (And Luajit too). All that Homebrew does not currently support is Luarocks using that side-by-side installation. You could go away and create a new tap with a customised Luarocks formula and it would work just fine with the Luas Homebrew-master ships presently. Setting up that new tap wouldn't take much longer than 20 minutes :).

I assume you folks want to drop 5.1 support in luarocks?

Correct. @MikeMcQuaid

side by side 5.1 and 5.2 installs should work in much the same way python 2 and 3 installs work

I think you misunderstand the way Homebrew handles Python here. We ship Python 2 & Python 3, but any formula can only generally use one of those at once, and they have separate pip and easy_install processes. Everything Python3 is appended with the number 3 so pip3 and everything from Python2.7.x is just pip and such. Note that there is absolutely no crossover between the two, everything installed with pip3 or easy_install3 goes into {homebrew_prefix}/lib/python3.4/site-packages and everything installed with pip and such goes into {homebrew_prefix}/lib/python2.7/site-packages. The two don't touch.

If luarocks can only do one or the other, it might make sense for Prosody to have a Prosody-local install of luarocks.

Yes. This is what I refer to when I talk about setting up a Prosody tap. It's git and Ruby all the way down, and a very simple process. If you need more help on the tap front please just say.

@zeen
Copy link

zeen commented Oct 12, 2014

Thanks for the clarification around homebrew current plans and around python.

My point is, that customization isn't actually needed. A separate Tap would work, certainly, but I don't think it's actually warranted.

Prosody depends on some standard things, like OpenSSL and lua51, etc, and these are not an issue at all.

Prosody then depends on some packages installed via luarocks. These are installed system-global in our current homebrew script, but should be Prosody-local. This is true regardless of whether we have a custom tap or not. I already have a fix for this, which is telling luarocks an install path while installing these packages.

The only problem is luarocks. Our script should either stop using luarocks, or should do a Prosody-local install of luarocks. Note that this is true regardless of whether we have a custom tap or not.

In the end I want a good user experience, and I don't want to force Prosody's choice of Lua or luarocks versions onto the user for their non-Prosody usage. I'd very much appreciate feedback, review or assistance in this, and am open to making changes in Prosody to support these things. I do want to support 5.2, but that's potentially months away.

jasmas pushed a commit to jasmas/homebrew that referenced this issue Oct 12, 2014
Fix some issues with luarocks looking for the wrong version and cleanup
the lua and lua51 formulae.

Closes Homebrew#32354.
@zeen
Copy link

zeen commented Oct 12, 2014

You had asked for statistics. Stats hard to find, but the Debian popularity contest is one (potentially unreliable) source:

https://qa.debian.org/popcon.php?package=lua5.1
https://qa.debian.org/popcon.php?package=lua5.2
https://qa.debian.org/popcon.php?package=luajit
https://qa.debian.org/popcon.php?package=luarocks

Ubuntu has similar numbers. They don't have an online viewer, but here's what I got from the large data dump they provide:

$ wget http://popcon.ubuntu.com/by_inst
$ cat by_inst | grep " lua5.1 "
10206 lua5.1                         20310   199 19993   100    18 (John V. Belmonte)
$ cat by_inst | grep " lua5.2 "
29786 lua5.2                          1348    56  1161   124     7 (Unknown)
$ cat by_inst | grep " luajit "
38760 luajit                           619     8   605     4     2 (Unknown)
$ cat by_inst | grep " luarocks "
35899 luarocks                         783     2   778     1     2 (Unknown)

As a sidenote: Luarocks in Debian and Ubuntu still depends on Lua 5.1, and not 5.2, despite them having a Lua 5.2 package for years now: http://packages.ubuntu.com/trusty/luarocks

@DomT4
Copy link
Member

DomT4 commented Oct 12, 2014

My point is, that customization isn't actually needed. A separate Tap would work, certainly, but I don't think it's actually warranted.

Well, unless the maintainers here have a shift of mind on the Luarocks multi-option-dependencies and the code required to support that you will need a separate formula on that, which is akin to your current setup, but a tap would be simpler IMO.

Prosody then depends on some packages installed via luarocks. These are installed system-global in our current homebrew script, but should be Prosody-local. This is true regardless of whether we have a custom tap or not. I already have a fix for this, which is telling luarocks an install path while installing these packages.

Generally, yes. The Homebrew way is to sandbox things inside their own prefix, unless required globally. Luarocks currently installs rocks in {homebrew_prefix}/lib/luarocks/rocks but the way we handle Python is to have site-packages install inside say {homebrew_prefix}/cellar/cmake/libexec/python/site-packages and that way there's no cross-contamination of global/local and the problems that can cause. Ideally, Luarocks would follow a similar setup if required on a per-formula basis.

The only problem is luarocks. Our script should either stop using luarocks, or should do a Prosody-local install of luarocks. Note that this is true regardless of whether we have a custom tap or not.

Indeed. You could just use a customised Luarocks formula, but that is arguably more likely to break than using a tap. You could also ship Luarocks inside your formula as a resource block but this is probably bulkier than ideal.

@DomT4
Copy link
Member

DomT4 commented Oct 12, 2014

As a sidenote: Luarocks in Debian and Ubuntu still depends on Lua 5.1, and not 5.2, despite them having a Lua 5.2 package for years now

I think it depends on whatever is called lua in your install? I have Lua51 and Lua52 installed on my Debian and Lua52 by default has taken the lua symlink name, and my luarocks built natively using that lua symlink to 5.2.

@E14
Copy link

E14 commented Oct 15, 2014

@DomT4 My comment was not meant to in any way spur your development, just to provide info on what I found worked for me. If that came over differently I apologise.

For what it's worth, from my point of view, side-by-side Lua is not very important, but providing a way to get a complete 5.1 version is. Many modules fail to compile against the lua51 package, as it does not provide any headers without version suffix (it only has lua51.h, but no lua.h) (Disclaimer: this knowledge is 14 days old ...)

Anyway, I believe it's an error to keep a real lua formula at all. You should switch to provide lua5.1, lua5.2, lua5.3, etc. and keep lua only as a virtual package at best (if such a thing exists in Homebrew). Otherwise you will have the same issues when 5.3 hits. Incidentally, this is how Debian does it too. Though they also provide the update-alternatives tool to provide symbolic links mimicking an upstream install.

About the luarocks 5.1 in Debian: If you compile your own luarocks on Debian, you won't have any trouble, but if you use the one from the Debian repository (https://packages.debian.org/wheezy/luarocks) it will depend on Lua 5.1. However, this is not a real issue, as the Lua version Luarocks is compiled against does not dictate which Lua versions it can install packages for.

@DomT4
Copy link
Member

DomT4 commented Oct 15, 2014

Oh the development push predated your comment, no worries. I initially wanted to support the multiple luarocks configurations natively anyway, but this thread kickstarted my desire to get that done quicker. After we found a solution the maintainers decided we couldn't shove that much potentially troublesome code onto all users unless the demand arises, but should it do so we at least now have the answer as to how to achieve that.

On the headers issue: That should be wrong? The headers should be named entirely normally except they're inside "homebrew_prefix/include/lua5.1" instead of "homebrew_prefix/include". The pkg-config file points to that directory for headers so everything should be finding them okay. The headers themselves shouldn't be renamed; the formula isn't written that way.

If you can give me some examples of things broken by this change I can look into them individually and push fixes where practical.

I am actually looking into having Lua52 as Lua52 in the executables but having a symlink from Lua52 to Lua, which is how Debian does this.

I'm not too worried about 5.3 yet. Based on Lua's historical development timetable I wouldn't expect 5.3 for at least another 2 years. I'm all for future proofing but Lua is less urgent than things with a hastier release timetable ;).

I'm pretty sure my apt-get installed luarocks uses the Lua package, which is symlinked to 5.2. I'll double check that later today. Maybe I'm wrong on that point.

@DomT4
Copy link
Member

DomT4 commented Oct 15, 2014

Comment earlier didn't format correctly. Have fixed that now, apologies.

@naartjie
Copy link

What is homebrew's official status on luajit + luarocks currently?

I'll admit I'm still pretty new to lua, but running some initial benchmarks, it looks like luaijt is multitudes faster, so I would prefer to use luajit over normal lua. It's reassuring to know it's first choice for projects like openresty.

@naartjie
Copy link

Okay, so luajit + luarocks is not supported (sorry, I didn't catch that first time around, I was trying to read it this too fast).

Is there any official unofficial workarounds? For example, how could I use the formula in this luarocks.rb gist? Should I be looking at setting up a new tap of my own, or has one been done? (@stuartcarnie ?)

@DomT4
Copy link
Member

DomT4 commented Dec 16, 2014

@naartjie Replied to your comment on the Gist I set up. Hopefully the reply is helpful to you.

@naartjie
Copy link

@DomT4 Yes it's very helpful, amazing, thank you for such a detailed response. 👍

@craigbarnes
Copy link

I'm not too worried about 5.3 yet. Based on Lua's historical development timetable I wouldn't expect 5.3 for at least another 2 years.

The first public "work" version of 5.3 was published about a year and a half ago. They've been through alpha, beta and 3 release candidates now.

Also, the versions page on lua.org says:

Lua 5.3 is almost ready.

@DomT4
Copy link
Member

DomT4 commented Dec 24, 2014

The first public "work" version of 5.3 was published about a year and a half ago. They've been through alpha, beta and 3 release candidates now.

Yes, Indeed. They've made huge progress in releases in the past few months. When I made the comment, they'd only just released the Alpha of 5.3, and based on the release schedule of the previous two Luas (2006 for 5.1, and 2011 for 5.2), I wasn't particularly expecting a quick release.

But what we do from here is largely dictated by adoption rates. If everything currently using Lua-5.2 happily transitions to Lua-5.3 then it's likely we'll shove Lua-5.1 out of the core (Into Homebrew/Versions) and start maintaining a Lua and a Lua52, but if adoption rates are slow it is likely that Lua53 will start out in Homebrew/Versions and work its way towards the core as adoption progresses.

As ever, I note that I'm not a maintainer, and I have almost no say over what goes in and what doesn't, but based on previous maintainer comments and discussion, what I said above is what I believe likely to occur in x situation.

@daurnimator
Copy link

5.3 came out this morning. I'll start another issue

@seclorum
Copy link

seclorum commented Apr 3, 2015

Hi - I have a situation where I need lua5.1/lua5.2/lua5.3 and luajit to co-exist on my system - can anyone explain to me how to do this with luarocks from homebrew, or do i need to resort to something like luajit-luarocks as a solution? Its not clear to me how homebrew expects us to just not use lua5.1 - for some projects this is not viable.

@zeen
Copy link

zeen commented Apr 3, 2015

In my work on a Prosody homebrew formula, I resorted to basically prosody-luarocks.

See: https://github.com/prosody/homebrew-prosody/blob/master/prosody.rb

@DomT4, etc, a code review of the formula would be appreciated. I would like Prosody officially in homebrew as soon as we support Lua 5.2 and 5.3.

@seclorum
Copy link

seclorum commented Apr 3, 2015

So if I get this right, I can use prosody-luarocks to get 5.1 lua packages installed on my system? If this is the case: thanks. But I'd still like to register a protest against whoever decided that the homebrew luarocks shouldn't be functional for us users who would like to rely on it to keep a 'clean' system ..

@DomT4
Copy link
Member

DomT4 commented Apr 3, 2015

I've actually proposed and detailed a different way of handling Luarocks which should suit just about everyone here. It took a long time to iron out and test properly, but seems to be something the maintainers aren't against. It internalises Luarocks into each Lua formulae in the same way pip is installed with Python every time. That PR is #37842. The existing Luarocks formula will die.

@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.