Re: Android Arm issues

  • From: Mike Pall <mike-1205@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 10 May 2012 15:14:50 +0200

Fredrik Ehnbom wrote:
> I'm having an issue with LuaJit on ARM android. Large parts of my scripts
> work great, but for some reason lua_tointeger doesn't return what I'm
> expecting.

lua_tointeger() returns an lua_Integer. This is a signed 64 bit
integer on 64 bit platforms (probably the default you get on OSX).
But it's a signed 32 bit integer on 32 bit platforms (e.g. ARM).

> Any idea why tointeger would differ so much? The right number is clearly
> there as shown by the tonumber call... Any number up to and
> including 7fffffff will be correct on android, but 80000000 and above gets
> "clamped" to 7fffffff.

Of course. If the input is out of range for 32 bit signed
integers, you won't get a valid result.

> Also, any idea why it's segfaulting at the end?

Umm, no. Your program doesn't crash on Android, when I try.

> BTW, I had to set TARGET_SYS=Linux when cross compiling for arm android on
> my MAC, otherwise lj_vm.s wouldn't assemble.

That's mentioned in the install docs at the end of this section:
  http://luajit.org/install.html#cross

--Mike

Other related posts: