luafilesystem icon indicating copy to clipboard operation
luafilesystem copied to clipboard

installing on windows fails with LNK1107 (lua 5.2)

Open soapdog opened this issue 7 years ago • 5 comments

Can't install using luarocks on windows 10 with lua 5.2

c:\Users\soapdog\prog\lua\luarocks-2.4.0-win32>luarocks install luafilesystem
Installing https://luarocks.org/luafilesystem-1.6.3-2.src.rock
cl /nologo /MD /O2 -c -Fosrc/lfs.obj -IC:/lua/include src/lfs.c
lfs.c
link -dll -def:lfs.def -out:lfs.dll C:/lua/lua52.dll src/lfs.obj
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

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

Error: Build error: Failed compiling module lfs.dll

soapdog avatar Oct 05 '16 18:10 soapdog

luabinaries has a folder for Static windows libraries: https://sourceforge.net/projects/luabinaries/files/5.3.4/Windows%20Libraries/Static/

Those zip files contain lua53.lib. As described on #22, edit your config to point to that lib file.

You need the right one for your version of Visual Studio. See the "Windows Libraries Downloads" section of that page for more info.

idbrii avatar Jun 28 '17 21:06 idbrii

How did you build your lua binaries? Seems the microsoft toolchain is used while building lfs, whereas the Lua binaries seem to have been build with MinGW or other gcc toolchains.

Tieske avatar Jun 28 '17 22:06 Tieske

whoops, only now seeing this is a very old issue, got triggered by the previous comment.

@soapdog did you fix your issue? Can you post your resolution and close this issue if so?

Tieske avatar Jun 28 '17 22:06 Tieske

@Tieske, I couldn't solve it myself. Ended up using Lua For Windows which has it already https://github.com/rjpcomputing/luaforwindows

soapdog avatar Jun 29 '17 23:06 soapdog

I came across this error on Windows when, in the Luarocks configuration, both CC and LD were set to cl. I fixed it by keeping CC as cl, and changing LD to link.

leonardus avatar Jan 27 '24 16:01 leonardus