cygwinldluajitluarocks

ld: i386 architecture of input file lua51.dll is incompatible with i386:x86-64 output


I wanted to install luasocket for luajit(2.1) by using luarocks but it is telling me that i386 architecture of input file lua51.dll is incompatible with i386:x86-64 output

I tried to use ld -m i386pe but this resulted in cannot find -lm: No such file or directory

logs:

with ld -m i386pep

C:\Users\Administrator>luarocks --lua-version 5.1 install luasocket
Warning: Failed searching manifest: Failed downloading https://luarocks.org/manifest-5.1 - connection refused
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasocket-3.1.0-1.src.rock

luasocket 3.1.0-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
x86_64-w64-mingw32-gcc -O2 -c -o src/luasocket.o -IC:\Users\Administrator\Desktop\jit/include src/luasocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/timeout.o -IC:\Users\Administrator\Desktop\jit/include src/timeout.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/buffer.o -IC:\Users\Administrator\Desktop\jit/include src/buffer.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/io.o -IC:\Users\Administrator\Desktop\jit/include src/io.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/auxiliar.o -IC:\Users\Administrator\Desktop\jit/include src/auxiliar.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/options.o -IC:\Users\Administrator\Desktop\jit/include src/options.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/inet.o -IC:\Users\Administrator\Desktop\jit/include src/inet.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/except.o -IC:\Users\Administrator\Desktop\jit/include src/except.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/select.o -IC:\Users\Administrator\Desktop\jit/include src/select.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/tcp.o -IC:\Users\Administrator\Desktop\jit/include src/tcp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/udp.o -IC:\Users\Administrator\Desktop\jit/include src/udp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/compat.o -IC:\Users\Administrator\Desktop\jit/include src/compat.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/wsocket.o -IC:\Users\Administrator\Desktop\jit/include src/wsocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
ld -m i386pep  -shared -o C:\Users\ADMINI~1\AppData\Local\Temp\luarocks_build-LuaSocket-3.1.0-1-2118495\socket\core.dll src/luasocket.o src/timeout.o src/buffer.o src/io.o src/auxiliar.o src/options.o src/inet.o src/except.o src/select.o src/tcp.o src/udp.o src/compat.o src/wsocket.o -lws2_32 C:\Users\Administrator\Desktop\jit\bin\lua51.dll -lm
ld: i386 architecture of input file `C:\Users\Administrator\Desktop\jit\bin\lua51.dll' is incompatible with i386:x86-64 output
ld: src/luasocket.o:luasocket.c:(.text+0x20): undefined reference to `luaL_checkinteger'
ld: src/luasocket.o:luasocket.c:(.text+0x2b): undefined reference to `lua_gettop'
ld: src/luasocket.o:luasocket.c:(.text+0x6f): undefined reference to `lua_createtable'

with ld -m i386pe

C:\Users\Administrator>luarocks --lua-version 5.1 install luasocket
Warning: Failed searching manifest: Failed downloading https://luarocks.org/manifest-5.1 - connection refused
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasocket-3.1.0-1.src.rock

luasocket 3.1.0-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
x86_64-w64-mingw32-gcc -O2 -c -o src/mime.o -IC:\Users\Administrator\Desktop\jit/include src/mime.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
x86_64-w64-mingw32-gcc -O2 -c -o src/compat.o -IC:\Users\Administrator\Desktop\jit/include src/compat.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\windows\system32\include
ld -m i386pe  -shared -o C:\Users\ADMINI~1\AppData\Local\Temp\luarocks_build-LuaSocket-3.1.0-1-710111\mime\core.dll src/mime.o src/compat.o -Lc:\windows\system32 C:\Users\Administrator\Desktop\jit\bin\lua51.dll -lm
ld: cannot find -lm: No such file or directory

Error: Build error: Failed compiling module mime\core.dll

This is the only emulator modes that I have, and I don't know from where I can get more like other people that had similar problem

OS: Windows 11


Solution

  • I fixed that by adding to my luarocks config CC = "cl", LD = "link" and LUALIB = 'lua51.lib'