This is a repo for reproducing a bug. On an Manjaro system (Arch-based), this setup creates a shared library and an executable. Xmake links both of them with 2 system Lua libraries: liblua and liblua++. This causes a segfault when luaL_error function is used. Presumably, because the longjmp returns to the wrong address space.
The repro works as follows:
- test app calls luaL_dofile on a luapp.lua script
- luapp.lua calls require("xmake-luapp") effectively loading a simple Lua library
- luapp.lua uses pcall to call a dummy(arg) function inside that library
- dummy(arg) function calls luaL_error
- the execution causes a segfault instead of gracefully catching raised error with the pcall
In case where both libxmake-luapp.so and luapp-test are built manually without linking liblua++, everything works correctly.
- test app calls luaL_dofile on a luapp.lua script
- luapp.lua calls require("xmake-luapp") effectively loading a simple Lua library
- luapp.lua uses pcall to call a dummy(arg) function inside that library
- dummy(arg) function calls luaL_error
- luapp.lua catches the raised error with pcall and prints "false"