Closed ykhuang closed 9 years ago
Hi, yes MIPS is so far untested. I'm guessing it could work, but you would need to make sure that there are correct constant defs for Linux MIPS...
The error message is kind of misleading, what is actually happening is that the tail call in syscall.lua:
return tm(flags, cmds)
does a table merge of a non existing table. There are no section for "mips" in that file as you see. So feel free to add one and do a pull request. E.g:
elseif ffi.arch == "mips" then
I do not have a system to test mips. There could be other things, but I think that was the effort someone which used this on a ppc had to go through... https://github.com/kernelsauce/turbo/blob/master/turbo/syscall.lua
Ask me if there is something you do not understand.
Yes, you are correct.
I made some fix to syscall.lua & socket_ffi.lua and the helloworld example works. I'll check if the rest of the examples work well.
Please put the changes in a pull request if you can. :)
Hi I'm testing static.lua and met some problem that might be platform dependent because it does not happen on x86. In fs.lua, ffi.typeof is called to get ctype of "struct stat" and I got below result. It looks like error from LuaJIT. Is there any way to fix it without making any change to LuaJIT? If we use a complete struct like "struct point { int a; int b }" and the call is fine. I think LuaJIT jsut can't find the definition of "struct stat".
.# luajit LuaJIT 2.0.3 -- Copyright (C) 2005-2014 Mike Pall. http://luajit.org/ JIT: ON MIPS32R2 fold cse dce fwd dse narrow loop abc sink fuse
ffi = require "ffi" stat_t = ffi.typeof("struct stat") stdin:1: undeclared or implicit tag 'stat' stack traceback: [C]: in function 'typeof' stdin:1: in main chunk [C]: at 0x00403e7c
Look at line 343 in cdef.lua.
struct stat is not declared there for this platform... Just add the correct definition got this platform any you should be good to go.
@YuanPeir-Chen I suppose this is ready to go into v2.0?
Yes, It works for me.
I made a cross build on my MIPS box. Some error happened when including turbo package. This didn't happen on x86 environment.
Looks like it stuck at returning syscall
In syscall, it calls util.mergetable. Seems the error happens while it tries to merge 2 tables in syscall.
Here's how I build turbo lua.
CC=mipsel-linux-gcc SSL=none make
CC=mipsel-linux-gcc SSL=none make install
And I build LuaJIT like
make HOST_CC="gcc -m32" CROSS=mipsel-linux-