On Thu, Jan 10, 2013 at 12:55 AM, Mojca Miklavec wrote:
On Tue, Dec 25, 2012 at 9:25 PM, luigi scarso wrote:
On Tue, Dec 25, 2012 at 9:17 PM, Patrick Gundlach wrote:
Can't create the Lua state.
Hm what format are you using ?
non, I run luatex --ini --lua xxx.lua myfile.tex
Which platform ?
For me: 64-bit Mac OS X.
gdb luajittex GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
(gdb) r --luaonly "/Users/ConTeXt/tex/texmf-osx-64/bin/mtxrun" --script context a.tex Starting program: /Users/ConTeXt/tex/texmf-osx-64/bin/luajittex --luaonly "/Users/ConTeXt/tex/texmf-osx-64/bin/mtxrun" --script context a.tex Reading symbols for shared libraries ++......................... done Can't create the Lua state.
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018 0x00000001002e8a8d in lua_checkstack (L=0x0, size=9) at lj_api.c:87 87 if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) { (gdb) backtrace #0 0x00000001002e8a8d in lua_checkstack (L=0x0, size=9) at lj_api.c:87 #1 0x00000001002e8b75 in luaL_checkstack (L=0x0, size=9, msg=0x100869811 "too many arguments to script") at lj_api.c:97 #2 0x00000001000b80fd in lua_initialize (ac=6, av=0x7fff5fbffa08) at luainit.w:856 #3 0x00000001000022a0 in main (ac=6, av=0x7fff5fbffa08) at luatex.c:468 (gdb)
The problem seems to be around lj_alloc_create () at lj_alloc.c:1134 1134 tbase = (char *)(CALL_MMAP(tsize)); (gdb) step CALL_MMAP [inlined] () at /Users/ConTeXt/luajittex/buildjit/libs/luajit/luajit-build/src/lj_alloc.c:208 ... 222 void *p = mmap((void *)alloc_hint, size, MMAP_PROT, MMAP_FLAGS, -1, 0); (gdb) p p $13 = (void *) 0x1010af000
This number (p) seems way behind "if ((uintptr_t)p + size < MMAP_REGION_END)" where MMAP_REGION_END points to ((uintptr_t)0x80000000). I have found a partial solution: Following these instructions: #elif LJ_TARGET_OSX || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) /* 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, ** otherwise the lower 4GB are blocked. And the 32GB RLIMIT_DATA needs ** to be reduced to 250MB on FreeBSD. */ export LDFLAGS=" -pagezero_size 10000 -image_base 100000000" ./buildjit.sh --debug The code now initialises properly and only breaks much later on at
luajittex --luaonly "/Users/ConTeXt/tex/texmf-osx-64/bin/mtxrun" --script context a.tex
mtx-context | run 1: luatex --fmt="/Users/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luajittex/cont-en" --jobname="a" --lua="/Users/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luajittex/cont-en.lui" --no-parse-first-line --c:currentrun=1 --c:fulljobname="./a.tex" --c:input="./a.tex" --c:kindofrun=1 "cont-yes.mkiv" This is LuaTeX, Version beta-0.74.0-2012122517 (rev 4541) \write18 enabled. This went wrong: ...0bfe781ce0dde776fb1556f32e/formats/luajittex/cont-en.lui:107: bad bytecode register . <*> cont-yes.mkiv ? That one needs further inspection (which I'm probably not going to do right now). Mojca