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

[Lua] Windows install instructions for Lua / Busted for this track do not work #80

Open
Mythricia opened this issue Oct 20, 2019 · 8 comments

Comments

@Mythricia
Copy link

https://exercism.io/tracks/lua/installation

This does not work on a fresh Windows 10 system, and although I went through a lot of attempts at workarounds I eventually had to give up on getting Lua, LuaRocks, or Busted working natively. But along the way I discovered a whole cascade of issues:

  • choco install lua installs a version of LuaRocks that is incapable of completing the next step, throws error: Error: Parse error processing dependency 'lua_cliargs = 3.0
  • luarocks install busted fails, because the wrong LuaRocks version is incapable of processing the dependecies for Busted.
  • If you force Chocolatey to install the correct version of LuaRocks, using choco install luarocks, luarocks install busted still fails for not one, but two reasons:
    • The "wrong" LuaRocks version is still installed by the previous choco install lua installation, and overrides the newer LuaRocks install from working
    • There is no compiler available by default on Windows, so even if you fix the above LuaRocks issue, still no joy.
    • If you remove the first choco install lua installation in favor of the LuaRocks one, Lua is no longer on the path either...
  • If you navigate that minefield somehow, you get to the point of installing Visual Studio, which requires knowing what components to install and also is a giant multi-GB install, you do get a compiler
  • Most people won't realize that in order for LuaRocks to find this compiler, you have to run LuaRocks from the magical "Visual Studio 2019 Developer Command Prompt" installed by the Visual Studio tools, not just any command prompt
  • At this point, LuaRocks will succeed at installing, and building, Busted. However, neither Lua nor Busted is available from any command prompt, any user needing the help of the install instructions stands no chance to find out where these are installed or how to add them to the system Path. And frankly, neither could I, despite not being a novice.

My workarounds were:

  • Installing Lua by just downloading a simple precompiled Lua binary (e.g. from LuaBinaries), adding it to the Path manually
  • Getting Busted working by, yes seriously, installing Ubuntu WSL from the Microsoft Store, installing Lua & LuaRocks / installing Busted using LuaRocks / funally running Busted from Ubuntu WSL, against the Exercism exercise path. Fortunately this can be easily done from any terminal (including cmd or Git-bash from within VS Code) on the current directory by just typing wsl busted, but it's still a massive hack.
@NobbZ
Copy link
Member

NobbZ commented Oct 20, 2019

@exercism/lua

@iHiD iHiD transferred this issue from exercism/exercism Oct 20, 2019
@ryanplusplus
Copy link
Member

Thanks @NobbZ for the heads up.

@Mythricia sorry for the mess! Those instructions were written by a former maintainer and I don't have a Windows machine available to me. Would you mind submitting a PR with step-by-step instructions for implementing your workarounds?

@Mythricia
Copy link
Author

Mythricia commented Oct 22, 2019

@ryanplusplus I could, however, I'm not sure the workarounds are really suitable, as they could be system dependent and the Lua install requires manually editing the system path variables which, if done incorrectly, can easily really mess up a users system, on top of downloading files from a source that may change in the future. Installing Ubuntu WSL also requires making changes to the Windows installed features, and it seems a bit outside the scope of the Exercism experience. As far as I know, it's also strictly only possible on Windows 10 and is version dependent even then.

I'll write up some steps if you think it's a good idea, but it is a pretty significant change to the user's system.

Some additional thoughts:

LuaRocks is unfortunately notoriously difficult to get working on a Windows system (the install instructions for LuaRocks on Windows are, also, broken), and due to the fact so many Lua libraries and addons (like Busted) rely solely on LuaRocks for distribution and compilation, that makes getting them on Windows more or less impossible for mere mortals. There are no compilers of any kind on a default Windows system, and there are about one million slightly different and mostly incompatible options to choose from if you want to get one that works with LuaRocks, that are all impossibly difficult to configure correctly.

Maybe a better solution is to put together a small package that includes a Lua executable (which is tiny) and a simple raw Lua testing library instead of a fully-fledged unit test library like Busted, which requires C libraries to be compiled? All it's really doing is making simple comparisons, it seems like an unnecessarily complicated choice to use Busted to run the very basic tests needed for Exercism.

Just my 2¢ anyway.

@ryanplusplus
Copy link
Member

Maybe a better solution is to put together a small package that includes a Lua executable (which is tiny) and a simple raw Lua testing library instead of a fully-fledged unit test library like Busted, which requires C libraries to be compiled? All it's really doing is making simple comparisons, it seems like an unnecessarily complicated choice to use Busted to run the very basic tests needed for Exercism.

The reality is that busted is what you'll see in almost every project that has tests. It's not an exotic tool, it's one of the most frequently downloaded packages from LuaRocks. In fact, nearly all of the most frequently used LuaRocks packages require a C compiler. I think it's worth getting an environment set up that will enable developers to actually use Lua.

Maybe we should just recommend WSL for users that can, and if their Windows installation is not a suitable environment for Lua, we could recommend a VM or a tool like Cloud9.

@Mythricia
Copy link
Author

Ah, I didn't mean Busted etc are exotic tools but I just meant it feels largely overkill for the exercism exercises. Since the user doesn't really write the tests themselves I doubt they will see it as much more than a command they need to type with no care for what it actually does behind the scenes.

Either way, I've never successfully gotten LuaRocks to work on Windows, even when the C compilers are in place, many Rocks are simply not Windows compatible. So they still fail to build, or run.

I think the easiest solution is WSL, since it's not a VM, doesn't take much space, and works well straight from the native command line. The only caveat being it's Windows 10 exclusive.

I can write up the steps to get a basic setup with Ubuntu WSL w/ Lua and Busted set up. Which Lua version are we targeting?

@ryanplusplus
Copy link
Member

I can write up the steps to get a basic setup with Ubuntu WSL w/ Lua and Busted set up.

That would be great!

Which Lua version are we targeting?

Anything 5.1-5.3 should be manageable, but all of the sample solutions are 5.3 so I'd target that.

@Mythricia
Copy link
Author

Do you mind if I post it here or should I PR against the Lua install documentation repo or somewhere else?

@ryanplusplus
Copy link
Member

This is where the actual source documentation lives:
https://github.com/exercism/lua/blob/master/docs/INSTALLATION.md

You can paste your writeup here, but doing a PR against exercism/lua would be best.

Mythricia added a commit to Mythricia/lua that referenced this issue Oct 27, 2019
Previous instructions no longer work for a multitude of reasons outlined in exercism/support#80
LuaRocks is notoriously difficult to set up on Windows, and many Rocks are not compatible regardless.
Chocolatey as used in previous instructions only installed LuaRocks, but no C compiler, and doesn't know how
to configure such a compiler to work with LuaRocks even if it did install one, et cetera.

These new instructions unfortunately *require* Windows 10, since they rely on Windows Subsystem for Linux,
but I believe it's by far the easiest way to get Busted running on a Windows 10 machine.

I don't have any good answers for what to do tell Windows 7 users.
ryanplusplus pushed a commit to exercism/lua that referenced this issue Oct 27, 2019
Previous instructions no longer work for a multitude of reasons outlined in exercism/support#80
LuaRocks is notoriously difficult to set up on Windows, and many Rocks are not compatible regardless.
Chocolatey as used in previous instructions only installed LuaRocks, but no C compiler, and doesn't know how
to configure such a compiler to work with LuaRocks even if it did install one, et cetera.

These new instructions unfortunately *require* Windows 10, since they rely on Windows Subsystem for Linux,
but I believe it's by far the easiest way to get Busted running on a Windows 10 machine.

I don't have any good answers for what to do tell Windows 7 users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants