编译Luasocket

时间:2015-01-13 20:45:50

标签: lua luasocket

所以我试图将Luasocket用于拥有Lua API的第三方游戏。它支持包但它说它需要一些我没有的luasocket文件(虽然它在IDE之外工作,因为我在lua目录中安装了Luasocket)。这些似乎是core.dll,core.lua和core / init.lua。我假设我通过编译Luasocket得到了这些。

我尝试了很少的成功。我发现构建luasocket的脚本总是给我错误。我怎么能得到这些文件并编译它们?

编辑:这是我尝试构建Luasocket时Cygwin给出的错误:

src/wsocket.c: In function ‘socket_open’:
src/wsocket.c:19:5: error: unknown type name ‘WSADATA’
     WSADATA wsaData;
     ^
src/wsocket.c:20:5: error: unknown type name ‘WORD’
     WORD wVersionRequested = MAKEWORD(2, 0);
     ^
src/wsocket.c:23:24: error: request for member ‘wVersion’ in something not a structure or union
     if ((LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) &&
                        ^
src/wsocket.c:23:57: error: request for member ‘wVersion’ in something not a structure or union
     if ((LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) &&
                                                         ^
src/wsocket.c:24:24: error: request for member ‘wVersion’ in something not a structure or union
         (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)) {
                        ^
src/wsocket.c:24:57: error: request for member ‘wVersion’ in something not a structure or union
         (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)) {
                                                         ^
src/wsocket.c: In function ‘socket_select’:
src/wsocket.c:82:16: error: ‘DWORD’ undeclared (first use in this function)
         Sleep((DWORD) (1000*t));
                ^
src/wsocket.c:82:16: note: each undeclared identifier is reported only once for each function it appears in
src/wsocket.c: In function ‘socket_connect’:
src/wsocket.c:127:16: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
     if (err != WSAEWOULDBLOCK && err != WSAEINPROGRESS) return err;
                ^
src/wsocket.c:127:41: error: ‘WSAEINPROGRESS’ undeclared (first use in this function)
     if (err != WSAEWOULDBLOCK && err != WSAEINPROGRESS) return err;
                                         ^
src/wsocket.c: In function ‘socket_accept’:
src/wsocket.c:180:20: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK && err != WSAECONNABORTED) return err;
                    ^
src/wsocket.c:180:45: error: ‘WSAECONNABORTED’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK && err != WSAECONNABORTED) return err;
                                             ^
src/wsocket.c: In function ‘socket_send’:
src/wsocket.c:211:20: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK) return err;
                    ^
src/wsocket.c: In function ‘socket_sendto’:
src/wsocket.c:233:20: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK) return err;
                    ^
src/wsocket.c: In function ‘socket_recv’:
src/wsocket.c:259:20: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK) {
                    ^
src/wsocket.c:260:24: error: ‘WSAECONNRESET’ undeclared (first use in this function)
             if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
                        ^
src/wsocket.c: In function ‘socket_recvfrom’:
src/wsocket.c:288:20: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         if (err != WSAEWOULDBLOCK) {
                    ^
src/wsocket.c:289:24: error: ‘WSAECONNRESET’ undeclared (first use in this function)
             if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
                        ^
src/wsocket.c: In function ‘socket_hoststrerror’:
src/wsocket.c:333:14: error: ‘WSAHOST_NOT_FOUND’ undeclared (first use in this function)
         case WSAHOST_NOT_FOUND: return "host not found";
              ^
src/wsocket.c: In function ‘socket_strerror’:
src/wsocket.c:341:14: error: ‘WSAEADDRINUSE’ undeclared (first use in this function)
         case WSAEADDRINUSE: return "address already in use";
              ^
src/wsocket.c:342:14: error: ‘WSAECONNREFUSED’ undeclared (first use in this function)
         case WSAECONNREFUSED: return "connection refused";
              ^
src/wsocket.c:343:14: error: ‘WSAEISCONN’ undeclared (first use in this function)
         case WSAEISCONN: return "already connected";
              ^
src/wsocket.c:344:14: error: ‘WSAEACCES’ undeclared (first use in this function)
         case WSAEACCES: return "permission denied";
              ^
src/wsocket.c:345:14: error: ‘WSAECONNABORTED’ undeclared (first use in this function)
         case WSAECONNABORTED: return "closed";
              ^
src/wsocket.c:346:14: error: ‘WSAECONNRESET’ undeclared (first use in this function)
         case WSAECONNRESET: return "closed";
              ^
src/wsocket.c:347:14: error: ‘WSAETIMEDOUT’ undeclared (first use in this function)
         case WSAETIMEDOUT: return "timeout";
              ^
src/wsocket.c: In function ‘wstrerror’:
src/wsocket.c:359:14: error: ‘WSAEINTR’ undeclared (first use in this function)
         case WSAEINTR: return "Interrupted function call";
              ^
src/wsocket.c:360:14: error: ‘WSAEACCES’ undeclared (first use in this function)
         case WSAEACCES: return "Permission denied";
              ^
src/wsocket.c:361:14: error: ‘WSAEFAULT’ undeclared (first use in this function)
         case WSAEFAULT: return "Bad address";
              ^
src/wsocket.c:362:14: error: ‘WSAEINVAL’ undeclared (first use in this function)
         case WSAEINVAL: return "Invalid argument";
              ^
src/wsocket.c:363:14: error: ‘WSAEMFILE’ undeclared (first use in this function)
         case WSAEMFILE: return "Too many open files";
              ^
src/wsocket.c:364:14: error: ‘WSAEWOULDBLOCK’ undeclared (first use in this function)
         case WSAEWOULDBLOCK: return "Resource temporarily unavailable";
              ^
src/wsocket.c:365:14: error: ‘WSAEINPROGRESS’ undeclared (first use in this function)
         case WSAEINPROGRESS: return "Operation now in progress";
              ^
src/wsocket.c:366:14: error: ‘WSAEALREADY’ undeclared (first use in this function)
         case WSAEALREADY: return "Operation already in progress";
              ^
src/wsocket.c:367:14: error: ‘WSAENOTSOCK’ undeclared (first use in this function)
         case WSAENOTSOCK: return "Socket operation on nonsocket";
              ^
src/wsocket.c:368:14: error: ‘WSAEDESTADDRREQ’ undeclared (first use in this function)
         case WSAEDESTADDRREQ: return "Destination address required";
              ^
src/wsocket.c:369:14: error: ‘WSAEMSGSIZE’ undeclared (first use in this function)
         case WSAEMSGSIZE: return "Message too long";
              ^
src/wsocket.c:370:14: error: ‘WSAEPROTOTYPE’ undeclared (first use in this function)
         case WSAEPROTOTYPE: return "Protocol wrong type for socket";
              ^
src/wsocket.c:371:14: error: ‘WSAENOPROTOOPT’ undeclared (first use in this function)
         case WSAENOPROTOOPT: return "Bad protocol option";
              ^
src/wsocket.c:372:14: error: ‘WSAEPROTONOSUPPORT’ undeclared (first use in this function)
         case WSAEPROTONOSUPPORT: return "Protocol not supported";
              ^
src/wsocket.c:373:14: error: ‘WSAESOCKTNOSUPPORT’ undeclared (first use in this function)
         case WSAESOCKTNOSUPPORT: return "Socket type not supported";
              ^
src/wsocket.c:374:14: error: ‘WSAEOPNOTSUPP’ undeclared (first use in this function)
         case WSAEOPNOTSUPP: return "Operation not supported";
              ^
src/wsocket.c:375:14: error: ‘WSAEPFNOSUPPORT’ undeclared (first use in this function)
         case WSAEPFNOSUPPORT: return "Protocol family not supported";
              ^
src/wsocket.c:376:14: error: ‘WSAEAFNOSUPPORT’ undeclared (first use in this function)
         case WSAEAFNOSUPPORT:
              ^
src/wsocket.c:378:14: error: ‘WSAEADDRINUSE’ undeclared (first use in this function)
         case WSAEADDRINUSE: return "Address already in use";
              ^
src/wsocket.c:379:14: error: ‘WSAEADDRNOTAVAIL’ undeclared (first use in this function)
         case WSAEADDRNOTAVAIL: return "Cannot assign requested address";
              ^
src/wsocket.c:380:14: error: ‘WSAENETDOWN’ undeclared (first use in this function)
         case WSAENETDOWN: return "Network is down";
              ^
src/wsocket.c:381:14: error: ‘WSAENETUNREACH’ undeclared (first use in this function)
         case WSAENETUNREACH: return "Network is unreachable";
              ^
src/wsocket.c:382:14: error: ‘WSAENETRESET’ undeclared (first use in this function)
         case WSAENETRESET: return "Network dropped connection on reset";
              ^
src/wsocket.c:383:14: error: ‘WSAECONNABORTED’ undeclared (first use in this function)
         case WSAECONNABORTED: return "Software caused connection abort";
              ^
src/wsocket.c:384:14: error: ‘WSAECONNRESET’ undeclared (first use in this function)
         case WSAECONNRESET: return "Connection reset by peer";
              ^
src/wsocket.c:385:14: error: ‘WSAENOBUFS’ undeclared (first use in this function)
         case WSAENOBUFS: return "No buffer space available";
              ^
src/wsocket.c:386:14: error: ‘WSAEISCONN’ undeclared (first use in this function)
         case WSAEISCONN: return "Socket is already connected";
              ^
src/wsocket.c:387:14: error: ‘WSAENOTCONN’ undeclared (first use in this function)
         case WSAENOTCONN: return "Socket is not connected";
              ^
src/wsocket.c:388:14: error: ‘WSAESHUTDOWN’ undeclared (first use in this function)
         case WSAESHUTDOWN: return "Cannot send after socket shutdown";
              ^
src/wsocket.c:389:14: error: ‘WSAETIMEDOUT’ undeclared (first use in this function)
         case WSAETIMEDOUT: return "Connection timed out";
              ^
src/wsocket.c:390:14: error: ‘WSAECONNREFUSED’ undeclared (first use in this function)
         case WSAECONNREFUSED: return "Connection refused";
              ^
src/wsocket.c:391:14: error: ‘WSAEHOSTDOWN’ undeclared (first use in this function)
         case WSAEHOSTDOWN: return "Host is down";
              ^
src/wsocket.c:392:14: error: ‘WSAEHOSTUNREACH’ undeclared (first use in this function)
         case WSAEHOSTUNREACH: return "No route to host";
              ^
src/wsocket.c:393:14: error: ‘WSAEPROCLIM’ undeclared (first use in this function)
         case WSAEPROCLIM: return "Too many processes";
              ^
src/wsocket.c:394:14: error: ‘WSASYSNOTREADY’ undeclared (first use in this function)
         case WSASYSNOTREADY: return "Network subsystem is unavailable";
              ^
src/wsocket.c:395:14: error: ‘WSAVERNOTSUPPORTED’ undeclared (first use in this function)
         case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range";
              ^
src/wsocket.c:396:14: error: ‘WSANOTINITIALISED’ undeclared (first use in this function)
         case WSANOTINITIALISED:
              ^
src/wsocket.c:398:14: error: ‘WSAEDISCON’ undeclared (first use in this function)
         case WSAEDISCON: return "Graceful shutdown in progress";
              ^
src/wsocket.c:399:14: error: ‘WSAHOST_NOT_FOUND’ undeclared (first use in this function)
         case WSAHOST_NOT_FOUND: return "Host not found";
              ^
src/wsocket.c:400:14: error: ‘WSATRY_AGAIN’ undeclared (first use in this function)
         case WSATRY_AGAIN: return "Nonauthoritative host not found";
              ^
src/wsocket.c:401:14: error: ‘WSANO_RECOVERY’ undeclared (first use in this function)
         case WSANO_RECOVERY: return "Nonrecoverable name lookup error";
              ^
src/wsocket.c:402:14: error: ‘WSANO_DATA’ undeclared (first use in this function)
         case WSANO_DATA: return "Valid name, no data record of requested type";
              ^
Error: failed to build LuaSocket

1 个答案:

答案 0 :(得分:0)

SO answer可能有所帮助。它提供了有关如何使用gcc进行编译的详细信息以及对我使用的构建脚本的引用以及为luasocket 3.0-rc1和Lua 5.2编译的二进制文件。