Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot run on Windows, get_opts fails #7

Open
OlivierA opened this Issue · 10 comments

6 participants

@OlivierA

I'm trying to use moonscript-0.1.0-1 installed with LuaRocks 2.0.4.1 on my Windows 7 computer.

"moonc" or "moon" always fail with the following error, whatever the command-line arguments are:

lua: fatal error: `C:\LuaRocks/share/lua/5.1//alt_getopt.lua:75: attempt to get length of local 'arg' (a nil value)
stack traceback:
        C:\LuaRocks/share/lua/5.1//alt_getopt.lua:75: in function 'get_ordered_opts'
        C:\LuaRocks/share/lua/5.1//alt_getopt.lua:156: in function 'get_opts'
        [string "..."]:11: in main chunk'
@himatako

How do you install it? I can't even install it. I can install and run it just fine on OSX though, but not on Windows :(

@OlivierA

Here is how I did, it requires a bit of setup: http://www.omnimaga.org/index.php?topic=9938.msg181241#msg181241

@yehnan

I have the same issue and don't know what to do next. Is author fixing this?
Thanks to OlivierA, your post is helpful.
By the way, is there someone trying to install MoonScript on cygwin? I can't even let LuaRocks work on cygwin.

@leafo
Owner

It sounds like a bug in the alt-getopt library I am using. I haven't had a chance to test on windows yet. I am in progress of settings up a windows machine for testing.

@OlivierA

Great!
If you want any test from me just ask.

@tommyettinger

I have the same issue as the OlivierA. I am on Windows 7 64-bit and I have tried using the VS 2010 command prompt, the Cygwin bash shell, "luarocks install xxx" for all values of xxx that could possibly relate to Moonscript dependencies, uninstalling/reinstalling Lua for Windows and LuaRocks, and so on. It might be as simple as a path separator issue, I don't know. I was getting errors with "luarocks install lpeg" before I used the VS 2010 command prompt, and I still get some odd errors with moon.exe not finding packages depending on where that executable is located. I hope someone has already figured this out...
EDIT: I just needed to check out git head, rename moon and moonc to moon.lua and moonc.lua (probably unnecessary), and create .bat files to run those lua files, like so: "C:\Lua\5.1\lua.exe moon.lua %*" is contents of moon.bat , though you would need to adjust this for your install path. Since I had already managed to get the dependencies by running LuaRocks to try to install MoonScript from the VS 2010 prompt, this worked on the first try.

@leafo
Owner

Although not a solution to this specific problem, I do have windows binaries for moonscript now:

http://moonscript.org/bin/

Included are the executables moon for and moonc, additionally I have included moonscript.dll, which is a lua module including both moonscript and lpeg, so it can be required without any additional dependencies.

The code for these is on the binaries branch: https://github.com/leafo/moonscript/tree/binaries

The binaries are using an embedded copy of alt-getopt which works fine, so I am not sure why it isn't working in the original case.

@OlivierA

Excellent leafo! It works well for me.

@ipstone

the binary works fine, but the luarocks installed version doesn't work. I explored this today, and found:
1. using a developer console (such as visual studio express command prompt) to run luarocks, then installation can proceed with compliation etc

  1. however, even if the packages compiled while, when running moon, it gives these errors:

I am guessing it's the "\" vs "/" !

I tried to install from the official luarocks,

  1. might the rock there has this flaw (with getopt line 75)?
  2. or it's the path (arg) that getopt received from others containing this?

C:\Users\teda\lua5.1>moon -h
lua: fatal error: `C:\Users\teda\lua5.1\lua/alt_getopt.lua:75: attempt to get
length of local 'arg' (a nil value)
stack traceback:
C:\Users\teda\lua5.1\lua/alt_getopt.lua:75: in function 'get_ordered_o
pts'
C:\Users\teda\lua5.1\lua/alt_getopt.lua:156: in function 'get_opts'
[string "..."]:11: in main chunk'
Content-type: text/plain

Configuration fatal error: see error log!
C:\Users\teda\lua5.1\lua/alt_getopt.lua:75: attempt to get length of local 'ar
g' (a nil value)
stack traceback:
C:\Users\teda\lua5.1\lua/alt_getopt.lua:75: in function 'get_ordered_o
pts'
C:\Users\teda\lua5.1\lua/alt_getopt.lua:156: in function 'get_opts'
[string "..."]:11: in main chunk

@leafo
Owner

It sounds like the script that wraps the moon executable is not sending the arguments down to my code.

I've been able to compile and run moonscript on windows with luarocks but I use the mingw backend instead of the visual studio one, I wonder if that has anything to do with it. I'll have to do some investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.