lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

  Luasocket compiled fine on linux, using lua 5.2.2, but when I try to do it on Windows, for VS2012 I run into errors.

 

I get unresolved errors such as:

   Creating library socket.lib and object socket.exp

mime.o : error LNK2019: unresolved external symbol _luaL_prepbuffsize referenced in function _mime_global_wrp

buffer.obj : error LNK2001: unresolved external symbol _luaL_prepbuffsize

buffer.obj : error LNK2019: unresolved external symbol _lua_tonumberx referenced in function _buffer_meth_receive

options.obj : error LNK2001: unresolved external symbol _lua_tonumberx

select.obj : error LNK2001: unresolved external symbol _lua_tonumberx

except.obj : error LNK2019: unresolved external symbol _lua_pcallk referenced in function _finalize

inet.obj : error LNK2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function _inet_global_getaddrinfo

tcp.obj : error LNK2001: unresolved external symbol __imp__getaddrinfo@16

inet.obj : error LNK2019: unresolved external symbol __imp__freeaddrinfo@4 referenced in function _inet_global_getaddrinfo

tcp.obj : error LNK2001: unresolved external symbol __imp__freeaddrinfo@4

inet.obj : error LNK2019: unresolved external symbol __imp__getnameinfo@28 referenced in function _inet_global_getaddrinfo

inet.obj : error LNK2019: unresolved external symbol _inet_ntop@16 referenced in function _inet_meth_getpeername

udp.obj : error LNK2001: unresolved external symbol _inet_ntop@16

select.obj : error LNK2019: unresolved external symbol _lua_callk referenced in function _check_dirty

udp.obj : error LNK2019: unresolved external symbol __imp__inet_pton@12 referenced in function _meth_sendto

socket.dll : fatal error LNK1120: 9 unresolved externals

 

   Creating library mime.lib and object mime.exp

mime.o : error LNK2019: unresolved external symbol _luaL_prepbuffsize reference in function _mime_global_wrp

mime.dll : fatal error LNK1120: 1 unresolved externals

 

When I built lua 5.2 I used this build.bat:

cl /MD /O2 /W3 /c /DLUA_BUILD_AS_DLL /DLUA_COMPAT_MODULE *.c

del *.o

ren lua.obj lua.o

ren luac.obj luac.o

link /DLL /IMPLIB:lua5.2.lib /OUT:lua5.2.dll *.obj

link /OUT:lua.exe lua.o lua5.2.lib

lib /out:lua5.2-static.lib *.obj

ren lua.o lua.obj

ren luac.o luac.obj

link /OUT:luac.exe luac.obj lua5.2-static.lib

 

I use this build.bat for luasocket.  I got the source for luasocket from github, on the unstable branch:

set INCLUDE=%INCLUDE%;C:\Users\my\Downloads\lua-5.2.2\src

echo %INCLUDE%

set LIB=%LIB%;C:\Users\my\Downloads\lua-5.2.2\src

echo %LIB%

ren unix.c unix.c00

ren usocket.c usocket.c00

del *.o

cl /MD /O2 /W3 /c /nologo /DWIN32_LEAN_AND_MEAN /DLUA_COMPAT_MODULE *.c

ren mime.obj mime.o

link /DLL /OUT:socket.dll /base:0x67800000 /export:luaopen_socket_core mime.o *.obj msvcrt.lib lua5.2.lib wsock32.lib

link /DLL /OUT:mime.dll /base:0x67700000 /export:luaopen_mime_core mime.o msvcrt.lib lua5.2.lib

 

I am curious what I may have done wrong in compiling luasocket.

 

I am trying to embed lua in a C++ program.

 

Thank you.