无法通过cygwin编译LuaJIT

时间:2014-03-20 14:35:16

标签: cygwin luajit

我正在尝试在Windows上安装最新版本的LuaJIT。我按照说明尽可能安装LuaJIT。我安装了cygwin和make软件包,打开了cygwin,cd ed到解压缩的源文件夹,然后键入make。我得到了这个输出:

$ make
==== Building LuaJIT 2.0.3 ====
make -C src
make[1]: Entering directory '/cygdrive/c/Users/Daniel/Downloads/LuaJIT-2.0.3/LuaJIT-2.0.3/src'
CC        lj_alloc.o
lj_alloc.c:249:2: error: #error "NYI: need an equivalent of MAP_32BIT for this 64 bit OS"
 #error "NYI: need an equivalent of MAP_32BIT for this 64 bit OS"
  ^
lj_alloc.c: In function ‘direct_alloc’:
lj_alloc.c:742:5: warning: implicit declaration of function ‘CALL_MMAP’ [-Wimplicit-function-declaration]
     char *mm = (char *)(DIRECT_MMAP(mmsize));
     ^
lj_alloc.c:742:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     char *mm = (char *)(DIRECT_MMAP(mmsize));
                ^
lj_alloc.c: In function ‘alloc_sys’:
lj_alloc.c:911:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       char *mp = (char *)(CALL_MMAP(rsize));
                  ^
lj_alloc.c: In function ‘lj_alloc_create’:
lj_alloc.c:1143:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   tbase = (char *)(CALL_MMAP(tsize));
           ^
Makefile:647: recipe for target 'lj_alloc.o' failed
make[1]: *** [lj_alloc.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Daniel/Downloads/LuaJIT-2.0.3/LuaJIT-2.0.3/src'
Makefile:103: recipe for target 'default' failed
make: *** [default] Error 2

搜索任何这些错误消息都没有任何结果。我做错了什么?

2 个答案:

答案 0 :(得分:3)

如果你阅读文档,你会发现cygwin64尚不支持,只有32位。 http://luajit.org/install.html

然而,添加对它的支持并不难。试一试。 例如文档建议:

配置LuaJIT

标准配置应该适用于大多数安装。通常无需调整设置。以下文件包含所有用户可配置的设置:

src/luaconf.h设置了一些配置变量。

Makefile具有安装LuaJIT(仅限POSIX)的设置。

src/Makefile具有在POSIX,MinGW或Cygwin下编译LuaJIT的设置。

src/msvcbuild.bat具有使用MSVC或WinSDK编译LuaJIT的设置。

在更改任何设置之前,请阅读这些文件中的说明。


因此修复src / Makefile似乎是最简单的。不幸的是,我现在有点不舒服,现在不能这样做。 我看了一下,这个补丁修复了CALL_MMAP问题: --- src/lj_alloc.c~ 2014-03-23 20:47:09.000000000 -0500 +++ src/lj_alloc.c 2014-03-23 20:47:54.145877000 -0500 @@ -188,7 +188,7 @@ return ptr; }

-#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__)
+#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__) || defined(__CYGWIN__)

 /* OSX and FreeBSD mmap() use a naive first-fit linear search.
 ** That's perfect for us. Except that -pagezero_size must be set for OSX,

-#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__) +#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__) || defined(__CYGWIN__) /* OSX and FreeBSD mmap() use a naive first-fit linear search. ** That's perfect for us. Except that -pagezero_size must be set for OSX, 添加__CYGWIN__检查。

现在只是没有链接lj_err_unwind_win64开卷器。这是迈克帕尔现在。不确定EXT或INT是否合适以及它是如何链接的。

答案 1 :(得分:2)

值得一提的是:LuaJIT-2.1.0-beta2(现已在luajit.org下载)在Cygwin 64上构建得很好;不需要黑客攻击。