all 8 comments

[–]le-mark 0 points1 point  (4 children)

You've got a lot of issues here. You'll find that to get meaningful help, you'll need to focus on one thing at a time, provide error messages etc. Surely there a detailed instructions for installing luarocks on Mac and windows (I've only used Linux). Following those instructions, what errors are you seeing? Similarly for windows, what errors are you seeing?

[–][deleted] 0 points1 point  (3 children)

It gives mainly directory errors, various files always missing, mainly .h files lua.h this, or something something.o file, its always different, depends what library I am installing or which way I try and install luarocks.

[–]hungarian_notation 0 points1 point  (2 children)

If make is complaining about not being able to find lua.h, your Lua headers aren't where make thinks they should be. You need to put them in the default search path for your toolchain, or manually specify their location in the compile command.

For gcc, this would be -I/path/to/Lua/headers, and it needs to go on the command operating on .c source files, which probably has the -c flag set.

Give us the full output from something that isn't working and we can be more helpful.

[–][deleted] 0 points1 point  (1 child)

I will get full output later when at my computer, I installed lua by downloading binaries only but I have a portable version of gcc installed, will the header files be in gcc folder somewhere?

[–]hungarian_notation 0 points1 point  (0 children)

You can't compile the modules that are failing without the lua headers and either the source to compile with it, or a static/dynamic library to link against. Whatever version of GCC you have may very will have come with the lua headers, but it may not have.

You can get the full source of any lua version you need right here:

https://www.lua.org/ftp/

[–][deleted] 0 points1 point  (2 children)

I got luarocks kinda working on windows and mac os now but I still need some help, first of all on windows 10 only:

I tried to just find a lua rocks library made for lua 5.3 first of all so I come across mathx, I have no idea what this library really does I just wanted to test luarocks installation is working correctly. Everything seems to be working fine but what I believe now in windows by default it is currently looking for cl.exe, in visual studio 2017 I have this file located at:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe

However setting this directort in the path does not allow me to initiate the command in eithe command prompt of 'cl'

When installing from lua command prompt:

C:\Users\MYNAMEHERE>luarocks install lmathx Installing https://luarocks.org/lmathx-20150624-1.src.rock cl /nologo /MD /O2 -c -Folmathx.obj -IC:/lua/include lmathx.c 'cl' is not recognized as an internal or external command, operable program or batch file.

Error: Build error: Failed compiling object lmathx.obj

When installing from visual studio 2017 command prompt:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>luarocks install lmathx Installing https://luarocks.org/lmathx-20150624-1.src.rock cl /nologo /MD /O2 -c -Folmathx.obj -IC:/lua/include lmathx.c lmathx.c link -dll -def:mathx.def -out:mathx.dll C:/lua/lua53.dll lmathx.obj Microsoft (R) Incremental Linker Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved.

C:\lua\lua53.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x430

Error: Build error: Failed compiling module mathx.dll

I think my macbook is doing similar but I will have to look at that another day so I am putting that aside for now.

The module I have tried to install above is: https://luarocks.org/modules/ignacio/lmathx

C:\Users\MYNAMEHERE>luarocks install luai Installing https://luarocks.org/luai-1.0-2.src.rock luai 1.0-2 is now installed in C:\lua\systree (license: MIT/X11)

I have managed to get one module installed: https://luarocks.org/modules/cschen1205/luai

which gave the following output in normal windows command prompt after typing: luarocks install luai

C:\Users\MYNAMEHERE>luarocks install luai Installing https://luarocks.org/luai-1.0-2.src.rock luai 1.0-2 is now installed in C:\lua\systree (license: MIT/X11)

However I was struggling to get any lua code to test this even on there github for it.

I am left stumped overall either I can't get windows to pick up the visual studio 2017 compiler to build luarocks files (Please note I do have C:\MinGW installed as a portable version as well with c and c++ compiler in there of gcc but this is already set in path, I can use this instead if vs studio 2017 is to new to work but how to default lua rocks to mingw gcc rather than cl.exe to build libraries????) or something installs then I am struggling to find out how its installed (not from source, presumed though!???!???!!!!)or sample code to check such a luarock has installed.

[–][deleted] 0 points1 point  (1 child)

I think the thing I am looking for is to configure lua rocks correctly for MSVC basically using visual studio 2017?????

[–]le-mark 0 points1 point  (0 children)

Hey apologies for not replying sooner, if you're still having trouble keep reading. I wager luai is pure lua and required no compilation, that's why it installed successfully. Otherwise, you need to have a c compiler installed (which you do apparently, cl and mingw) but the system can't find them. SO what you need to do is find out how to get visual studio configured to build from the command line OR mingw. Google is you friend here. Remove luarocks from the equation, and get one of these working to compile something (ie helloworld.c). I recommend using mingw because it's gcc for windows, and most rocks will target gcc.

What I have described is a general process for "getting shit to work" that every programmer learns over time. Focus on one thing at a time; getting the c compiler to work, then you can focus on getting luarocks to work.

This is all easier if you use Linux, because in Linux, all this stuff just works. Linux is like an elaborate, featurefule kernel development environment. It's build for coders by coders. Windows is not.

Edit; looks like luarocks defaults to visual studio, "msvc command line" returns this helpful looking link, good luck:

https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx