luafilesystem icon indicating copy to clipboard operation
luafilesystem copied to clipboard

Cannot install lfs

Open helloworldguy4 opened this issue 7 years ago • 10 comments

If im trying to install luafilesystem on Windows 10 with luarocks and lua 5.1 then its not working. Heres the full log: (no matter if im entering it with --local or not, its the same)

C:\Users\LuckyChicken>luarocks install luafilesystem --local Installing https://luarocks.org/luafilesystem-1.7.0-2.src.rock cl /nologo /MD /O2 -c -Fosrc/lfs.obj -IC:/Program Files (x86)/LuaRocks/include src/lfs.c Der Befehl "cl" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

Error: Build error: Failed compiling object src/lfs.obj

(The text "Der Befehl "cl" ist entweder falsch geschrieben oder konnte nicht gefunden werden." is german and means in english: Could not found the command "cl")

I think theres something wrong with the installation. Im on windows and I dont have the command "cl"

What can I do?

helloworldguy4 avatar Oct 09 '17 13:10 helloworldguy4

Just tested. All works with MSVC 2010 on Windows 7. Did you run this command from Visual Studio Command Prompt?

moteus avatar Oct 09 '17 15:10 moteus

No I run this command from the normal cmd because I have installed luarocks there

helloworldguy4 avatar Oct 09 '17 15:10 helloworldguy4

But I also have linux subsystem on my windows. So I can use bash. And if im installing it there it works. But unfornately I can still not use lfs somehow then if im requiring it.

helloworldguy4 avatar Oct 09 '17 15:10 helloworldguy4

Again. Try run luarocks install luafilesystem from correct Visual Studio Command Prompt

moteus avatar Oct 10 '17 06:10 moteus

Go to your visual studio installation and there should be a vcvarsall bat file. CMD there and do vcvarsall x86 (assuming you're 32 bit). type cl in console and check if it works.

KayleMaster avatar Apr 10 '18 21:04 KayleMaster

The easiest fix is that this is a documentation bug.

The installation instructions for windows need to state that you need to:

  • install the VC compilers
  • install the Windows 10 SDK
  • you need to use the Visual Studio Command Prompt to run luarocks install luafilesystem.

I'm guessing that once compilation is complete you can just use luafilesystem directly? If not the luarock is broken on windows, as it is no longer self contained.

The right fix would be to use autotools to find the most appropriate C compiler and libraries.

eg. for windows (with the aid of chocolatey), you can:

PS > choco install mingw
... lots of stuff here ...
PS > choco install make
... more stuff here ...
PS > cat hello.c
#include <stdio.h>

int main() {
        printf("Hello, World!\n\r");
        return 0;
}
PS > make hello CC=gcc
gcc     hello.c    -o hello
PS > ./hello
Hello, World!

presuming you're presenting only the standard C filesystem APIs to lua, if you build using mingw, you can pretend windows doesn't exist, and throw away all of the windows-specific build stuff.

mrudat avatar Apr 09 '19 13:04 mrudat

@hishamhm can we close this? enough solutions presented...

Tieske avatar Apr 16 '19 20:04 Tieske

Hi Team, I am still with the same issue

venkateshveeroju avatar Sep 24 '19 09:09 venkateshveeroju

@venkateshveeroju what's the exact error you're getting?

Tieske avatar Sep 24 '19 09:09 Tieske

Hello, Im getting the very same error with LUA 5.3 and MinGW compiler.

PS C:\Users\Pc> luarocks install luafilesystem
Installing https://luarocks.org/luafilesystem-1.8.0-1.src.rock
 
luafilesystem 1.8.0-1 depends on lua >= 5.1 (5.3-1 provided by VM)
mingw32-gcc -O2 -c -o src/lfs.o -IC:\Lua\src src/lfs.c

Error: Build error: Failed compiling object src/lfs.o

JiriAtanasovsky avatar Dec 19 '20 19:12 JiriAtanasovsky