Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaRocks can't find the custom build back-end for the current Lua version #1509

Closed
jonasgeiler opened this issue May 17, 2023 · 2 comments · Fixed by #1578
Closed

LuaRocks can't find the custom build back-end for the current Lua version #1509

jonasgeiler opened this issue May 17, 2023 · 2 comments · Fixed by #1578
Labels

Comments

@jonasgeiler
Copy link

jonasgeiler commented May 17, 2023

  • Platform: Windows

  • LuaRocks version: 3.9.2

  • Configuration file:

    lua_version = "5.1"
    
  • LuaRocks output from when the issue occurred:

    • LuaRocks output with --verbose
    • LuaRocks output without --verbose:
      PS C:\Users\skayo\Documents> luarocks install lua-ryaml
      Installing https://luarocks.org/lua-ryaml-0.1.0-1.src.rock
      
      lua-ryaml 0.1.0-1 depends on lua >= 5.1 (5.1-1 provided by VM)
      lua-ryaml 0.1.0-1 depends on luarocks-build-rust-mlua (0.1.0-1 installed)
      
      Error: Failed initializing build back-end for build type 'rust-mlua': module 'luarocks.build.rust-mlua' not found:
              Failed loading module luarocks.build.rust-mlua in LuaRocks rock luarocks-build-rust-mlua 0.1.0-1
              no field package.preload['luarocks.build.rust-mlua']
              no file 'C:\Program Files\LuaRocks\lua\luarocks\build\rust-mlua.lua'
              no file 'C:\Program Files\LuaRocks\lua\luarocks\build\rust-mlua\init.lua'
              no file 'C:\Program Files\LuaRocks\luarocks\build\rust-mlua.lua'
              no file 'C:\Program Files\LuaRocks\luarocks\build\rust-mlua\init.lua'
              no file 'C:\Program Files\LuaRocks\..\share\lua\5.4\luarocks\build\rust-mlua.lua'
              no file 'C:\Program Files\LuaRocks\..\share\lua\5.4\luarocks\build\rust-mlua\init.lua'
              no file '.\luarocks\build\rust-mlua.lua'
              no file '.\luarocks\build\rust-mlua\init.lua'
              no file 'C:\Users\skayo\AppData\Roaming/luarocks/share/lua/5.4/luarocks\build\rust-mlua.lua'
              no file 'C:\Users\skayo\AppData\Roaming/luarocks/share/lua/5.4/luarocks\build\rust-mlua/init.lua'
              no file 'C:\Program Files\LuaRocks\luarocks\build\rust-mlua.dll'
              no file 'C:\Program Files\LuaRocks\..\lib\lua\5.4\luarocks\build\rust-mlua.dll'
              no file 'C:\Program Files\LuaRocks\loadall.dll'
              no file '.\luarocks\build\rust-mlua.dll'
              no file 'C:\Users\skayo\AppData\Roaming/luarocks/lib/lua/5.4/luarocks\build\rust-mlua.dll'
              no file 'C:\Program Files\LuaRocks\luarocks.dll'
              no file 'C:\Program Files\LuaRocks\..\lib\lua\5.4\luarocks.dll'
              no file 'C:\Program Files\LuaRocks\loadall.dll'
              no file '.\luarocks.dll'
              no file 'C:\Users\skayo\AppData\Roaming/luarocks/lib/lua/5.4/luarocks.dll'
      
  • Description:
    Okay so I installed Lua 5.1 by building from source using Visual Studio 2022, and then manually created the C:\Program Files\Lua folder and moved all the built .dll and .exe files in there, as well as create a include folder with the Lua headers and a lua\luarocks folder with all the LuaRocks files (for the loader).
    Then, I created the C:\Program Files\LuaRocks folder and put the two LuaRocks .exe in there.
    Afterwards, I told LuaRocks not to use the inbuilt Lua version using luarocks --scope system lua_version 5.1.

    The problem I am now facing is that for some reason LuaRocks won't respect this Lua version when it is searching for custom build back-ends. As you can see in the error message above, it's looking for C:\Users\skayo\AppData\Roaming/luarocks/share/lua/5.4/luarocks\build\rust-mlua.lua even though C:\Users\skayo\AppData\Roaming/luarocks/share/lua/5.1/luarocks\build\rust-mlua.lua actually exists and should be used. But it's only looking for the 5.4 version for some reason...

    I think the way I installed everything is unrelated to this bug, and that the problem lies somewhere within the LuaRocks source code. But I don't know anything about the code so correct me if I'm wrong. When I run luarocks without any arguments it shows ok for all the configuration entries.
    Also I don't think it's a problem with this custom build back-end either.
    Let me know if you need any additional info.

@jonasgeiler
Copy link
Author

Okay so I actually looked where this error message originates from in the source code and I found it in the build.lua file. Above this line I noticed that it's just requireing the build back-end that is needed, so I tried this:

PS C:\Users\skayo\Documents> lua -l luarocks.loader
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> return pcall(require, "luarocks.build.rust-mlua")
true    table: 0000022AE1726210

So as you can see when I require the build back-end manually, it's found without problems. It's just that LuaRocks won't find it...

@jonasgeiler
Copy link
Author

jonasgeiler commented May 17, 2023

A temporary fix I've found is to create a junction/symlink like this:

mklink /j "C:\Users\skayo\AppData\Roaming\luarocks\share\lua\5.4" "C:\Users\skayo\AppData\Roaming\luarocks\share\lua\5.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants