can't make luajit in 3.6

lhmwzy lhmwzy at gmail.com
Thu Feb 13 23:17:06 PST 2014


OK,here is the ktrace result

# ktrace ./luajit
./luajit: cannot create state: not enough memory
# kdump
762 ktrace RET ktrace 0
762 ktrace CALL execve(0x7ffffffff987,0x7ffffffff738,0x7ffffffff748)
762 ktrace NAMI "./luajit"
762 ktrace NAMI "/usr/libexec/ld-elf.so.2"
762 luajit RET execve 0
762 luajit CALL __sysctl(0x7fffffffeed0,0x2,0x8008bdb60,0x7fffffffeec8,0,0)
762 luajit RET __sysctl 0
762 luajit CALL
mmap(0,0x8000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0)
762 luajit RET mmap 7057408/0x6bb000
762 luajit CALL issetugid
762 luajit RET issetugid 0
762 luajit CALL lstat(0x8006c0000,0x7fffffffede0)
762 luajit NAMI "/etc"
762 luajit RET lstat 0
762 luajit CALL lstat(0x8006c0000,0x7fffffffede0)
762 luajit NAMI "/etc/libmap.conf"
762 luajit RET lstat -1 errno 2 No such file or directory
762 luajit CALL open(0x8006c0000,O_CLOEXEC,<unused>0)
762 luajit NAMI "/etc/libmap.conf"
762 luajit RET open -1 errno 2 No such file or directory
762 luajit CALL access(0x8006c0000,F_OK)
762 luajit NAMI "/usr/lib/gcc47/libm.so.4"
762 luajit RET access -1 errno 2 No such file or directory
762 luajit CALL open(0x8006b2906,O_CLOEXEC,<unused>0x8)
762 luajit NAMI "/var/run/ld-elf.so.hints"
762 luajit RET open 3
762 luajit CALL read(0x3,0x7fffffffec50,0x80)
762 luajit GIO fd 3 read 128 bytes
"Ehnt\^A\0\0\0\M^@\0\0\0(\0\0\0\0\0\0\0'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
762 luajit RET read 128/0x80
762 luajit CALL lseek(0x3,0,0x80,SEEK_SET)
762 luajit RET lseek 128/0x80
762 luajit CALL read(0x3,0x8006bc040,0x28)
762 luajit GIO fd 3 read 40 bytes
"/usr/lib:/usr/lib/compat:/usr/local/lib\0"
762 luajit RET read 40/0x28
762 luajit CALL close(0x3)
762 luajit RET close 0
762 luajit CALL access(0x8006c0000,F_OK)
762 luajit NAMI "/usr/lib/libm.so.4"
762 luajit RET access 0
762 luajit CALL open(0x8006bf040,O_CLOEXEC,<unused>0x8)
762 luajit NAMI "/usr/lib/libm.so.4"
762 luajit RET open 3
762 luajit CALL fstat(0x3,0x7fffffffee60)
762 luajit RET fstat 0
762 luajit CALL mmap(0,0x1000,PROT_READ,MAP_PRIVATE,0x3,0,0)
762 luajit RET mmap 7090176/0x6c3000
762 luajit CALL
mmap(0,0x22a000,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,0xffffffff,0,0)
762 luajit RET mmap 9183232/0x8c2000
762 luajit CALL
mmap(0x8008c2000,0x2a000,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE,0x3,0,0)
762 luajit RET mmap 9183232/0x8c2000
762 luajit CALL
mmap(0x800aeb000,0x1000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,0x3,0,0x29000)
762 luajit RET mmap 11448320/0xaeb000
762 luajit CALL munmap(0x8006c3000,0x1000)
762 luajit RET munmap 0
762 luajit CALL close(0x3)
762 luajit RET close 0
762 luajit CALL access(0x8006c0000,F_OK)
762 luajit NAMI "/usr/lib/gcc47/libc.so.8"
762 luajit RET access -1 errno 2 No such file or directory
762 luajit CALL access(0x8006c0000,F_OK)
762 luajit NAMI "/usr/lib/libc.so.8"
762 luajit RET access 0
762 luajit CALL open(0x8006bf080,O_CLOEXEC,<unused>0x8)
762 luajit NAMI "/usr/lib/libc.so.8"
762 luajit RET open 3
762 luajit CALL fstat(0x3,0x7fffffffee60)
762 luajit RET fstat 0
762 luajit CALL mmap(0,0x1000,PROT_READ,MAP_PRIVATE,0x3,0,0)
762 luajit RET mmap 7090176/0x6c3000
762 luajit CALL
mmap(0,0x34e000,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,0xffffffff,0,0)
762 luajit RET mmap 11452416/0xaec000
762 luajit CALL
mmap(0x800aec000,0x123000,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE,0x3,0,0)
762 luajit RET mmap 11452416/0xaec000
762 luajit CALL
mmap(0x800e0f000,0xc000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,0x3,0,0x123000)
762 luajit RET mmap 14741504/0xe0f000
762 luajit CALL
mmap(0x800e1b000,0x1f000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,0xffffffff,0,0)
762 luajit RET mmap 14790656/0xe1b000
762 luajit CALL munmap(0x8006c3000,0x1000)
762 luajit RET munmap 0
762 luajit CALL close(0x3)
762 luajit RET close 0
762 luajit CALL
mmap(0,0x19000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0x800000000,0)
762 luajit RET mmap 7090176/0x6c3000
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff770)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL set_tls_area(0,0x7ffffffff850,0x10)
762 luajit RET set_tls_area 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff7a0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL issetugid
762 luajit RET issetugid 0
762 luajit CALL open(0x800be5388,O_RDONLY,<unused>0xfffffffffffffff7)
762 luajit NAMI "/dev/urandom"
762 luajit RET open 3
762 luajit CALL read(0x3,0x800e1bea0,0x40)
762 luajit GIO fd 3 read 64 bytes
"EuI\M^Q\M-FN\M^A\M-t\M-oII_\M-5K\M^NmK\M-B\M-~i{\M-7\^V\M-;\M-7K\M-{
\M^?\M^EL\
\M-:\M^S\M^@j$\M-o\M-|\M-/s9s$\M-`I\v+\^U\M-X\M-"\M^I\M^^\M-F\M^S\M^_\M-P\M-A\M^G\
\M-@\M^LB\M-o\M^K\M^F"
762 luajit RET read 64/0x40
762 luajit CALL close(0x3)
762 luajit RET close 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff760)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff760)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff760)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL setrlimit(RLIMIT_DATA,0x7ffffffff800)
762 luajit RET setrlimit 0
762 luajit CALL
mmap(0x10000000,0x20000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0)
762 luajit RET mmap 7192576/0x6dc000
762 luajit CALL munmap(0x8006dc000,0x20000)
762 luajit RET munmap 0
762 luajit CALL
mmap(0x10000000,0x20000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0)
762 luajit RET mmap 7192576/0x6dc000
762 luajit CALL munmap(0x8006dc000,0x20000)
762 luajit RET munmap 0
762 luajit CALL write(0x2,0x7ffffffff120,0xa)
762 luajit GIO fd 2 wrote 10 bytes
"./luajit: "
762 luajit RET write 10/0xa
762 luajit CALL write(0x2,0x7ffffffff120,0x27)
762 luajit GIO fd 2 wrote 39 bytes
"cannot create state: not enough memory
"
762 luajit RET write 39/0x27
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff710)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff6b0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff6b0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_BLOCK,0x8008bda10,0x7ffffffff6b0)
762 luajit RET sigprocmask 0
762 luajit CALL sigprocmask(SIG_SETMASK,0x8008bda30,0)
762 luajit RET sigprocmask 0
762 luajit CALL exit(0x1)
#


2014-02-14 15:13 GMT+08:00 lhmwzy <lhmwzy at gmail.com>:

> OK,I find the reason.
> ktrace must be config in kernel
> I will build the custom kernel and try again.
>
>
> 2014-02-14 15:06 GMT+08:00 lhmwzy <lhmwzy at gmail.com>:
>
> I'd like to provide,but how to
>>
>> #cd cd LuaJIT-2.0.2.patch/src
>> #ktrace luajit
>> ktrace: ktrace.out: Function not implemented
>>
>>
>>
>>
>> 2014-02-14 14:50 GMT+08:00 Alex Hornung <alex at alexhornung.com>:
>>
>>  Can you provide a ktrace(1) output? Just ktrace luajit, and then kdump
>>> and get the output.
>>>
>>> Cheers,
>>> Alex
>>>
>>>
>>> On 14/02/14 01:22, lhmwzy wrote:
>>>
>>> I have tried as fllowing
>>>
>>> diff -Nur LuaJIT-2.0.2/src/lj_alloc.c LuaJIT-2.0.2.patch/src/lj_alloc.c
>>> --- LuaJIT-2.0.2/src/lj_alloc.c 2013-06-03 19:00:00.000000000 +0000
>>> +++ LuaJIT-2.0.2.patch/src/lj_alloc.c 2014-02-14 07:19:53.948397000 +0000
>>> @@ -188,7 +188,7 @@
>>> return ptr;
>>> }
>>>
>>> -#elif LJ_TARGET_OSX || defined(__FreeBSD__) ||
>>> defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__sun__)
>>> +#elif LJ_TARGET_OSX || defined(__FreeBSD__) ||
>>> defined(__FreeBSD_kernel__) || defined(__OpenBSD__) ||
>>> defined(__sun__)||defined(__DragonFly__)
>>>
>>> /* 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,
>>> @@ -202,7 +202,7 @@
>>> #endif
>>> #define MMAP_REGION_END ((uintptr_t)0x80000000)
>>>
>>> -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>>> +#if defined(__FreeBSD__) ||
>>> defined(__FreeBSD_kernel__)||defined(__DragonFly__)
>>> #include <sys/resource.h>
>>> #endif
>>>
>>> @@ -212,7 +212,7 @@
>>> /* Hint for next allocation. Doesn't need to be thread-safe. */
>>> static uintptr_t alloc_hint = MMAP_REGION_START;
>>> int retry = 0;
>>> -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>>> +#if defined(__FreeBSD__) ||
>>> defined(__FreeBSD_kernel__)||defined(__DragonFly__)
>>> static int rlimit_modified = 0;
>>> if (LJ_UNLIKELY(rlimit_modified == 0)) {
>>> struct rlimit rlim;
>>> diff -Nur LuaJIT-2.0.2/src/lj_arch.h LuaJIT-2.0.2.patch/src/lj_arch.h
>>> --- LuaJIT-2.0.2/src/lj_arch.h 2013-06-03 19:00:00.000000000 +0000
>>> +++ LuaJIT-2.0.2.patch/src/lj_arch.h 2014-02-14 07:21:18.628483000 +0000
>>> @@ -67,7 +67,7 @@
>>> #elif defined(__MACH__) && defined(__APPLE__)
>>> #define LUAJIT_OS LUAJIT_OS_OSX
>>> #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
>>> - defined(__NetBSD__) || defined(__OpenBSD__)
>>> + defined(__NetBSD__) || defined(__OpenBSD__)||defined(__DragonFly__)
>>> #define LUAJIT_OS LUAJIT_OS_BSD
>>> #elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
>>> #define LUAJIT_OS LUAJIT_OS_POSIX
>>>
>>> >cd LuaJIT-2.0.2.patch/
>>> > cd src
>>> > /usr/local/bin/make
>>> HOSTCC host/minilua.o
>>> HOSTLINK host/minilua
>>> DYNASM host/buildvm_arch.h
>>> HOSTCC host/buildvm.o
>>> HOSTCC host/buildvm_asm.o
>>> HOSTCC host/buildvm_peobj.o
>>> HOSTCC host/buildvm_lib.o
>>> HOSTCC host/buildvm_fold.o
>>> HOSTLINK host/buildvm
>>> BUILDVM lj_vm.s
>>> ASM lj_vm.o
>>> CC lj_gc.o
>>> BUILDVM lj_ffdef.h
>>> CC lj_err.o
>>> CC lj_char.o
>>> BUILDVM lj_bcdef.h
>>> CC lj_bc.o
>>> CC lj_obj.o
>>> CC lj_str.o
>>> CC lj_tab.o
>>> CC lj_func.o
>>> CC lj_udata.o
>>> CC lj_meta.o
>>> CC lj_debug.o
>>> CC lj_state.o
>>> CC lj_dispatch.o
>>> CC lj_vmevent.o
>>> CC lj_vmmath.o
>>> CC lj_strscan.o
>>> CC lj_api.o
>>> CC lj_lex.o
>>> CC lj_parse.o
>>> CC lj_bcread.o
>>> CC lj_bcwrite.o
>>> CC lj_load.o
>>> CC lj_ir.o
>>> CC lj_opt_mem.o
>>> BUILDVM lj_folddef.h
>>> CC lj_opt_fold.o
>>> CC lj_opt_narrow.o
>>> CC lj_opt_dce.o
>>> CC lj_opt_loop.o
>>> CC lj_opt_split.o
>>> CC lj_opt_sink.o
>>> CC lj_mcode.o
>>> CC lj_snap.o
>>> CC lj_record.o
>>> CC lj_crecord.o
>>> BUILDVM lj_recdef.h
>>> CC lj_ffrecord.o
>>> CC lj_asm.o
>>> CC lj_trace.o
>>> CC lj_gdbjit.o
>>> CC lj_ctype.o
>>> CC lj_cdata.o
>>> CC lj_cconv.o
>>> CC lj_ccall.o
>>> CC lj_ccallback.o
>>> CC lj_carith.o
>>> CC lj_clib.o
>>> CC lj_cparse.o
>>> CC lj_lib.o
>>> CC lj_alloc.o
>>> CC lib_aux.o
>>> BUILDVM lj_libdef.h
>>> CC lib_base.o
>>> CC lib_math.o
>>> CC lib_bit.o
>>> CC lib_string.o
>>> CC lib_table.o
>>> CC lib_io.o
>>> CC lib_os.o
>>> CC lib_package.o
>>> CC lib_debug.o
>>> CC lib_jit.o
>>> CC lib_ffi.o
>>> CC lib_init.o
>>> AR libluajit.a
>>> CC luajit.o
>>> BUILDVM jit/vmdef.lua
>>> DYNLINK libluajit.so
>>> LINK luajit
>>> OK Successfully built LuaJIT
>>>
>>> All seems good,but when run
>>> > ./luajit
>>> ./luajit: cannot create state: not enough memory
>>>
>>>
>>> 2014-02-14 9:19 GMT+08:00 Justin Sherrill <justin at shiningsilence.com>:
>>>
>>>> It looks like it's trying something specific; assuming it's really not
>>>> supported on DragonFly, you could look in the file and see if it has a
>>>> fallback for other operating systems that don't support this feature and
>>>> add DragonFly to that fallback.
>>>>
>>>>
>>>> On Thu, Feb 13, 2014 at 4:01 AM, lhmwzy <lhmwzy at gmail.com> wrote:
>>>>
>>>>>
>>>>> LuaJIT-2.1-20140109
>>>>>
>>>>> use GNU make to make
>>>>>
>>>>> the error info:
>>>>> lj_mcode.c:123:2: error: #error "Missing OS support for explicit
>>>>> placement of executable memory"
>>>>> lj_mcode.c: In function 'mcode_protect':
>>>>> lj_mcode.c:197:5: warning: implicit declaration of function
>>>>> 'mcode_setprot' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c: In function 'mcode_alloc':
>>>>> lj_mcode.c:235:7: warning: implicit declaration of function
>>>>> 'mcode_alloc_at' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c:235:45: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c:235:45: note: each undeclared identifier is reported only
>>>>> once for each function it appears in
>>>>> lj_mcode.c:240:7: warning: implicit declaration of function
>>>>> 'mcode_free' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c: In function 'mcode_allocarea':
>>>>> lj_mcode.c:275:15: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_reserve':
>>>>> lj_mcode.c:304:22: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_commit':
>>>>> lj_mcode.c:313:20: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_abort':
>>>>> lj_mcode.c:320:22: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_patch':
>>>>> lj_mcode.c:332:24: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c:340:24: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> Makefile:642: recipe for target 'lj_mcode.o' failed
>>>>>
>>>>> try LuaJIT-2.0.2
>>>>> the error info :
>>>>> lj_mcode.c:122:2: error: #error "Missing OS support for explicit
>>>>> placement of executable memory"
>>>>> lj_mcode.c: In function 'mcode_protect':
>>>>> lj_mcode.c:187:5: warning: implicit declaration of function
>>>>> 'mcode_setprot' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c: In function 'mcode_alloc':
>>>>> lj_mcode.c:224:7: warning: implicit declaration of function
>>>>> 'mcode_alloc_at' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c:224:45: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c:224:45: note: each undeclared identifier is reported only
>>>>> once for each function it appears in
>>>>> lj_mcode.c:229:7: warning: implicit declaration of function
>>>>> 'mcode_free' [-Wimplicit-function-declaration]
>>>>> lj_mcode.c: In function 'mcode_allocarea':
>>>>> lj_mcode.c:264:15: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_reserve':
>>>>> lj_mcode.c:293:22: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_commit':
>>>>> lj_mcode.c:302:20: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_abort':
>>>>> lj_mcode.c:308:20: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c: In function 'lj_mcode_patch':
>>>>> lj_mcode.c:320:24: error: 'MCPROT_RX' undeclared (first use in this
>>>>> function)
>>>>> lj_mcode.c:328:24: error: 'MCPROT_RW' undeclared (first use in this
>>>>> function)
>>>>>
>>>>> My os:
>>>>> uname -a:
>>>>> DragonFly . 3.6-RELEASE DragonFly v3.6.0.24.gf2d5f-RELEASE #4: Tue Feb
>>>>> 11 14:22:27 UTC 2014 lhm at .:/usr/obj/usr/src/sys/
>>>>>  lhmwzy x86_64
>>>>>
>>>>>  Any suggestion?
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20140214/cfd4b47e/attachment-0013.html>


More information about the Users mailing list