lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Liz,

Is your PowerPC64 system a big endian system? What OS are you using?

I'm running a POWER8 system on Little Endian mode and Lua5.2 runs as expected. I could install it with apt-get on Ubuntu 17.04 (check the available archs below):
https://packages.ubuntu.com/zesty/lua5.2

Take a look at these flags:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:        17.04
Codename:       zesty
$ uname -m
ppc64le
$ gcc -dM -E - < /dev/null | grep -i ppc
#define _ARCH_PPCGR 1
#define __PPC64__ 1
#define _ARCH_PPCSQ 1
#define _ARCH_PPC 1
#define __PPC__ 1
#define _ARCH_PPC64 1
$ gcc -dM -E - < /dev/null | grep -i powerpc
#define __powerpc64__ 1
#define __powerpc__ 1
$ gcc -dM -E - < /dev/null | grep -i endian
#define __ORDER_LITTLE_ENDIAN__ 1234
#define _LITTLE_ENDIAN 1
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __ORDER_PDP_ENDIAN__ 3412
#define __LITTLE_ENDIAN__ 1
#define __ORDER_BIG_ENDIAN__ 4321
#define __VEC_ELEMENT_REG_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__

Are you running anything unusual? When I read src/luaconf.h it does sound like the code is not configured as it should, but I didn't run into problems when running Lua.

src/luaconf.h:
<snip>
@@ LUA_IEEEENDIAN is the endianness of doubles in your machine
** (0 for little endian, 1 for big endian); if not defined, Lua will
** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK).
</snip>

<snip>
#elif defined(__POWERPC__) || defined(__ppc__)      /* }{ */

#define LUA_IEEE754TRICK
#define LUA_IEEEENDIAN    1
</snip>

So Lua is assuming that every PowerPC is a big endian system, which is wrong

> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> On Behalf Of Elizabeth Kammer
> Sent: quarta-feira, 31 de maio de 2017 14:17
> To: lua-l@lists.lua.org
> Subject: [BUG] Lua 5.2 on PowerPC64
> 
> Hi, I've run into issues attempting to run Lua on PowerPC64, resulting
> in a the following ERROR:
> 
> 
> PANIC: unprotected error in call to Lua API (bad conversion number->int;
> must recompile Lua with proper settings)
> 
> 
> 
> PowerPC64 can now be Little Endian, so I believe the issue can be
> resolved by updating luaconf.h to check for endianness as follows:
> 
> 
> <code>
> /* pentium 64 bits? */
> #elif defined(__x86_64)                                         /* }{ */
> 
> 
> 
> #define LUA_IEEE754TRICK
> #define LUA_IEEEENDIAN 0
> 
> 
> + #elif defined(__powerpc64__) || defined(__PPC64__)            /* }{ */
> +
> + #define LUA_IEEE754TRICK
> +
> + #if defined(__LITTLE_ENDIAN__)
> + #define LUA_IEEEENDIAN                0
> + #else
> + #define LUA_IEEEENDIAN                1
> + #endif
> +
> #elif defined(__POWERPC__) || defined(__ppc__)                  /* }{ */
> 
> </code>
> 
> 
> Thanks,
> Liz