3
votes

I am trying to install the latest version of LuaJIT on Windows. I followed the instructions for installing LuaJIT as best I could. I installed cygwin and the make packages, opened cygwin, cded to the unzipped source folder, and typed make. I get this output:

$ 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

Searching for any of these error messages turns up nothing. What did I do wrong?

2

2 Answers

3
votes

If you read the documentation you'll see that cygwin64 is not yet supported, only 32 bit. http://luajit.org/install.html

However it doesn't look hard to add support to it. Just try. e.g. the documentation suggests:

Configuring LuaJIT

The standard configuration should work fine for most installations. Usually there is no need to tweak the settings. The following files hold all user-configurable settings:

src/luaconf.h sets some configuration variables.

Makefile has settings for installing LuaJIT (POSIX only).

src/Makefile has settings for compiling LuaJIT under POSIX, MinGW or Cygwin.

src/msvcbuild.bat has settings for compiling LuaJIT with MSVC or WinSDK.

Please read the instructions given in these files, before changing any settings.


So fixing src/Makefile seems to be the easiest. Unfortunately I'm a bit sick currently and cannot do it right now. I've looked a bit and this patch fixes the CALL_MMAP problem: --- 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,

Add a __CYGWIN__ check.

Now just the lj_err_unwind_win64 unwinder is not linked. This is for Mike Pall now. Not sure if EXT or INT is appropriate and how it is linked.

2
votes

For what it's worth: LuaJIT-2.1.0-beta2 (available now at luajit.org download) builds fine on Cygwin 64; no hacking required.