edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
2.07k stars 67 forks source link

can't build on windows .. ? #5

Closed ffred closed 4 years ago

ffred commented 4 years ago

can't build on Windows 8.1 64bits. (Mingw-w64 8.1.0 already installed) just installed Luarock, with no error and I got those errors when trying to build nelua :

# luarocks install https://raw.githubusercontent.com/edubart/nelua-lang/master/rockspecs/nelua-dev-1.rockspec
Cloning into 'nelua-lang'...
remote: Enumerating objects: 169, done.
remote: Counting objects: 100% (169/169), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 169 (delta 0), reused 65 (delta 0), pack-reused 0
Receiving objects: 100% (169/169), 200.60 KiB | 769.00 KiB/s, done.
Missing dependencies for nelua dev-1:
   penlight >= 1.7.0 (not installed)
   lpeglabel >= 1.6.0 (not installed)
   tableshape >= 2.1.0 (not installed)
   lua-term >= 0.7 (not installed)
   argparse >= 0.7.0 (not installed)
   hasher >= 0.1.0 (not installed)
   chronos >= 0.2 (not installed)
   lbc >= 20180729 (not installed)
   busted >= 2.0.0 (not installed)
   luacheck >= 0.23.0 (not installed)
   luacov >= 0.13.0 (not installed)
   cluacov >= 0.1.1 (not installed)
   dumper >= 0.1.1 (not installed)

nelua dev-1 depends on lua >= 5.1 (5.1-1 provided by VM)
nelua dev-1 depends on penlight >= 1.7.0 (not installed)
Installing https://luarocks.org/penlight-1.7.0-1.src.rock
Missing dependencies for penlight 1.7.0-1:
   luafilesystem (not installed)

penlight 1.7.0-1 depends on luafilesystem (not installed)
Installing https://luarocks.org/luafilesystem-1.7.0-2.src.rock

luafilesystem 1.7.0-2 depends on lua >= 5.1 (5.1-1 provided by VM)
C:\Programs\mingw-w64\mingw64\bin\gcc.exe -O2 -c -o src/lfs.o -Ic:\programs\luarock\include src/lfs.c
C:\Programs\mingw-w64\mingw64\bin\gcc.exe -shared -o lfs.dll src/lfs.o c:\programs\luarock/lua5.1.dll -lMSVCR80
collect2.exe: error: ld returned 5 exit status

Error: Failed installing dependency: https://luarocks.org/penlight-1.7.0-1.src.rock - Failed installing dependency: https://luarocks.org/luafilesystem-1.7.0-2.src.rock - Build error: Failed compiling module lfs.dll

got a error window with a message about ld.exe crashing during the process... just starting with nelua, first try. will look more at home later, but if you see something obvious, please let me know. thanks.

ffred commented 4 years ago

if I set my mingw-w64 config to 32 bits :

# luarocks install https://raw.githubusercontent.com/edubart/nelua-lang/master/rockspecs/nelua-dev-1.rockspec
Cloning into 'nelua-lang'...
remote: Enumerating objects: 169, done.
remote: Counting objects: 100% (169/169), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 169 (delta 0), reused 62 (delta 0), pack-reused 0R
Receiving objects: 100% (169/169), 201.31 KiB | 223.00 KiB/s, done.
Missing dependencies for nelua dev-1:
   penlight >= 1.7.0 (not installed)
   lpeglabel >= 1.6.0 (not installed)
   tableshape >= 2.1.0 (not installed)
   lua-term >= 0.7 (not installed)
   argparse >= 0.7.0 (not installed)
   hasher >= 0.1.0 (not installed)
   chronos >= 0.2 (not installed)
   lbc >= 20180729 (not installed)
   busted >= 2.0.0 (not installed)
   luacheck >= 0.23.0 (not installed)
   luacov >= 0.13.0 (not installed)
   cluacov >= 0.1.1 (not installed)
   dumper >= 0.1.1 (not installed)

nelua dev-1 depends on lua >= 5.1 (5.1-1 provided by VM)
nelua dev-1 depends on penlight >= 1.7.0 (not installed)
Installing https://luarocks.org/penlight-1.7.0-1.src.rock
Missing dependencies for penlight 1.7.0-1:
   luafilesystem (not installed)

penlight 1.7.0-1 depends on luafilesystem (not installed)
Installing https://luarocks.org/luafilesystem-1.7.0-2.src.rock

luafilesystem 1.7.0-2 depends on lua >= 5.1 (5.1-1 provided by VM)
C:\Programs\mingw-w64\mingw64\bin\gcc.exe -O2 -c -o src/lfs.o -Ic:\programs\luarock\include src/lfs.c
C:\Programs\mingw-w64\mingw64\bin\gcc.exe -shared -o lfs.dll src/lfs.o c:\programs\luarock/lua5.1.dll -lMSVCR80
collect2.exe: error: ld returned 255 exit status

Error: Failed installing dependency: https://luarocks.org/penlight-1.7.0-1.src.rock - Failed installing dependency: https://luarocks.org/luafilesystem-1.7.0-2.src.rock - Build error: Failed compiling module lfs.dll
edubart commented 4 years ago

Hello, first thanks for your interest in Nelua!

Unfortunately I am not a Windows user myself and I am yet trying to sort out how users can get a working C compiler + Lua + LuaRocks on Windows. I did try installing a fresh Windows few days ago but wasn't able myself to get a working LuaRocks after multiple tries, even following LuaRocks website instructions, this is kinda sad because at the moment Nelua depends in a lot of LuaRocks packages to minimize the development work on the Nelua compiler, so I am not able to drop its dependency right know, maybe in the future I will remove this dependency and provide a standalone compiler package for Windows users.

After giving up on installing Lua + LuaRocks natively on Windows, I came up with another alternative for Windows users, by cross compiling Windows binaries using an Linux system through windows WSL, you can get Nelua working this way in a few commands, you can look the instructions in the installing tutorial. However I was able to do that with an updated Windows 10, I think it might not work on Windows 8.1.

If you or anyone reading here is able to get a successful installation of Nelua on Windows without WSL, please share the instructions by answering this ticket or creating a page on the project public wiki.

ffred commented 4 years ago

Hi, thanks for replying. well, I'm not an expert with compilation, but the Luarocks installation (with the included Lua) finished with no errors and seem to be working, but after that there are linking problems when trying to install something with luarocks. just tried again rapidly at home, on a Win10 64bits computer (with same Mingw-w64) and got the same result. maybe should try with an older mingw-w64, with a different linker...

really don't have much time actually for this kind of experiment, but will still try again and let you know what I found.

ffred commented 4 years ago

I think I will have to verify the luarocks install and it's settings, because there's an odd flag just before the error on my report on first message : -lMSVCR80 that looks more like a Microsoft toolchain flag, but I set luarocks to use mingw.. maybe I missed something.

edubart commented 4 years ago

@ffred I've just installed Nelua on Windows in another way, using MSYS2 with mingw-w64 9.2.0 (x86_64), this should work on Windows 8.1 I think. I've put step by step tutorial on https://nelua.io/installing/ let me know if this is helpful.

edubart commented 4 years ago

@ffred Yeah the -lMSVCR80 is odd for mingw-w64 env, looks like a LuaRocks detection problem on your system, I think with MSYS2 environment this will go away.

ffred commented 4 years ago

ok, nice you find another solution with MSYS2, but I already have a working Git installed and the same for Mingw-w64 and don't want to mess with them, so I need it to work this way..

if you search online for "luarocks MSVCR80", you can see that many others have the same kind of problem. it seems that the problem is in the Luarocks windows install files.

I found another option with luawinmulti and just tried it with the command :make --clean --53 --nocompat install C:\Programs\Lua I had to add the path values manually (take them at the end of the "setlua.bat" file. after that installed nelua with the standard command : luarocks install https://raw.githubusercontent.com/edubart/nelua-lang/master/rockspecs/nelua-dev-1.rockspec and it's working ! so, it would really be better the day when you could have all included in just one simple install for nelua, but for now we have two different possibilities to install it on Windows. :-)

edubart commented 4 years ago

Closing the issue as we have two options to install on Windows instructed in the language website and a third using luawinmulti as mentioned above.