Help compiling on windows
rayaman opened this issue · 4 comments
I used the rockspec to compile the code, but this was the error message I got:
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26430.6
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
C:\Windows\System32>C:\Users\Ryan\Desktop\luazen-master
C:\Windows\System32>cd C:\Users\Ryan\Desktop\luazen-master
C:\Users\Ryan\Desktop\luazen-master>luarocks install luazen-0.8-1.rockspec
Cloning into 'luazen'...
remote: Counting objects: 28, done.
remote: Compressing objects: 100% (26/26), done.
Receiving objects: 71% (20/28) 18 (delta 1), pack-reused 0
Receiving objects: 100% (28/28), 54.43 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
cl /nologo /MD /O2 -c -Fosrc/luazen.obj -IC:/Program Files (x86)/Lua/5.1/include src/luazen.c
luazen.c
src/luazen.c(561): error C2057: expected constant expression
src/luazen.c(561): error C2466: cannot allocate an array of constant size 0
src/luazen.c(561): error C2133: 'drop': unknown size
Error: Build error: Failed compiling object src/luazen.obj
I also tried with visual studio 2005 cmd and still got an error, a slightly different one though:
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
C:\WINDOWS\system32>cd C:\Users\Ryan\Desktop\luazen-master
C:\Users\Ryan\Desktop\luazen-master>luarocks install luazen-0.8-1.rockspec
Cloning into 'luazen'...
remote: Counting objects: 28, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 28 (delta 1), reused 18 (delta 1), pack-reused 0
Receiving objects: 100% (28/28), 54.43 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
cl /nologo /MD /O2 -c -Fosrc/luazen.obj -IC:/Program Files (x86)/Lua/5.1/include src/luazen.c
luazen.c
src/luazen.c(38) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Error: Build error: Failed compiling object src/luazen.obj
Any help would be very much appreciated
Thanks for the report. I will try to look into it. I only built on Windows with Mingw gcc, not with Microsoft VS. So, in supported_platforms = {"unix", "windows"}
in the rockspec, the "windows"
bit may be a bit too ambitious... :(
MSC requires a few 'hacks'
Issues I found were mostly with array dimensioned with a variable.
variable-sized arrays have been introduced with C99. Not supported in C89 ...and in VC (even VC 2014!)
I fixed what I could (luazen.c, base58.c). Could you please test building the last luazen version and let me know if works for you?
Hey thanks for your reply and sorry for the really late response. I re-ran the install command and still got the error:
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26430.6
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
C:\Windows\System32>luarocks install luazen
Installing https://luarocks.org/luazen-0.8-1.rockspec
Cloning into 'luazen'...
remote: Counting objects: 32, done.
remote: Compressing objects: 100% (30/30), done.
Receiving objects: 78% (25/32) 20 (delta 1), pack-reused 0 eceiving objects: 75% (24/32)
Receiving objects: 100% (32/32), 60.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
cl /nologo /MD /O2 -c -Fosrc/luazen.obj -IC:/Program Files (x86)/Lua/5.1/include src/luazen.c
luazen.c
cl /nologo /MD /O2 -c -Fosrc/base58.obj -IC:/Program Files (x86)/Lua/5.1/include src/base58.c
base58.c
cl /nologo /MD /O2 -c -Fosrc/lzf_c.obj -IC:/Program Files (x86)/Lua/5.1/include src/lzf_c.c
lzf_c.c
cl /nologo /MD /O2 -c -Fosrc/lzf_d.obj -IC:/Program Files (x86)/Lua/5.1/include src/lzf_d.c
lzf_d.c
cl /nologo /MD /O2 -c -Fosrc/mono.obj -IC:/Program Files (x86)/Lua/5.1/include src/mono.c
mono.c
cl /nologo /MD /O2 -c -Fosrc/norx.obj -IC:/Program Files (x86)/Lua/5.1/include src/norx.c
norx.c
cl /nologo /MD /O2 -c -Fosrc/md5.obj -IC:/Program Files (x86)/Lua/5.1/include src/md5.c
md5.c
cl /nologo /MD /O2 -c -Fosrc/rc4.obj -IC:/Program Files (x86)/Lua/5.1/include src/rc4.c
rc4.c
cl /nologo /MD /O2 -c -Fosrc/randombytes.obj -IC:/Program Files (x86)/Lua/5.1/include src/randombytes.c
randombytes.c
link -dll -def:luazen.def -out:luazen.dll C:/Program Files (x86)/Lua/5.1/lua5.1.lib src/luazen.obj src/base58.obj src/lz
f_c.obj src/lzf_d.obj src/mono.obj src/norx.obj src/md5.obj src/rc4.obj src/randombytes.obj
Microsoft (R) Incremental Linker Version 14.10.25019.0
Copyright (C) Microsoft Corporation. All rights reserved.
Creating library luazen.lib and object luazen.exp
luazen.obj : error LNK2019: unresolved external symbol _blz_workmem_size referenced in function _lz_blz
luazen.obj : error LNK2019: unresolved external symbol _blz_max_packed_size referenced in function _lz_blz
luazen.obj : error LNK2019: unresolved external symbol _blz_pack referenced in function _lz_blz
luazen.obj : error LNK2019: unresolved external symbol _blz_depack_safe referenced in function _lz_unblz
randombytes.obj : error LNK2019: unresolved external symbol __imp__CryptAcquireContextA@20 referenced in function _rando
mbytes
randombytes.obj : error LNK2019: unresolved external symbol __imp__CryptReleaseContext@8 referenced in function _randomb
ytes
randombytes.obj : error LNK2019: unresolved external symbol __imp__CryptGenRandom@12 referenced in function _randombytes
luazen.dll : fatal error LNK1120: 7 unresolved externals
Error: Build error: Failed compiling module luazen.dll
For now I will continue using linux for my tests.