Segemtation fault
comfix opened this issue · 2 comments
comfix commented
I'm on ArchLinux with Lua 5.2.4 and when I try to run the emulator as you've described in the readme I get the segmentation fault.
Had a LuaSec problem as of today (now its fixed) and therefor I recloned the repo and got this error.
gamax92 commented
What gcc version are you on? you can check with gcc --version
If it's GCC 7, then it turns out luaffi has alignment issues with GCC 7. You can apply a patch to luaffifb's repo
clone luaffifb: git clone https://github.com/facebook/luaffifb; cd luaffifb
apply the following patch: patch -p1 < gcc7.patch
then run sudo luarocks-5.2 make
--- a/ctype.c
+++ b/ctype.c 2017-05-31 13:08:25.421741873 +0000
@@ -245,6 +245,10 @@ void* to_cdata(lua_State* L, int idx, st
lua_pop(L, 1); /* mt */
cd = (struct cdata*) lua_touserdata(L, idx);
+ if (!cd) {
+ lua_pushnil(L);
+ return NULL;
+ }
*ct = cd->type;
lua_getuservalue(L, idx);
--- a/ffi.h
+++ b/ffi.h 2017-06-01 09:12:45.128442092 +0000
@@ -351,9 +351,6 @@ __declspec(align(16))
#endif
struct cdata {
const struct ctype type
-#ifdef __GNUC__
- __attribute__ ((aligned(16)))
-#endif
;
};
gamax92 commented
Since I believe that this is a GCC 7 issue, given that arch linux has gcc 7 in its repositories, closing.