Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua is problematic when built from source #662

Open
Krush206 opened this issue Feb 13, 2025 · 5 comments
Open

Lua is problematic when built from source #662

Krush206 opened this issue Feb 13, 2025 · 5 comments

Comments

@Krush206
Copy link

I found out the issue regarded there happens from Linux, too. Building Lua and linking against sm64coopdx raises the same issue as in FreeBSD.

Assertion failed: ((idx <= 255 + 1) && "upvalue index too large"), function index2addr, file lapi.c, line 76.
Abort (core dumped)

Any advice or suggestion on how to properly build Lua for sm64coopdx?

@Isaac0-dev
Copy link
Collaborator

I also use Linux but i have never had that issue before, may I ask what your linux distro you're using?

@Krush206
Copy link
Author

I've built from Linux using the Linux binary compatibility layer from FreeBSD, which runs Linux 5.15. The distribution I'm running is Debian. The game runs fine with the upstream library, but fails with SIGABRT

Assertion failed: ((idx <= 255 + 1) && "upvalue index too large"), function index2addr, file lapi.c, line 76.
Abort (core dumped)

if Lua is built from source. There might be a bit somewhere among the forks mentioning how to build Lua, and, unfortunately, isn't documented here.

@Isaac0-dev
Copy link
Collaborator

the Lua binary that is in this repository is built from source, and you can build it yourself by downloading it from the Lua official website: https://www.lua.org/ftp/lua-5.3.6.tar.gz

@Krush206
Copy link
Author

lldb) bt
* thread #1, name = 'sm64coopdx', stop reason = signal SIGABRT
  * frame #0: 0x0000000829e1b1ba libc.so.7`__sys_thr_kill + 10
    frame #1: 0x0000000829d945d4 libc.so.7`__raise + 52
    frame #2: 0x0000000829e47b59 libc.so.7`abort + 73
    frame #3: 0x0000000829d777c1 libc.so.7`__assert + 81
    frame #4: 0x0000000002af72da sm64coopdx`index2addr(L=0x000032b01db37b10, idx=<unavailable>) at lapi.c:78:5
    frame #5: 0x0000000002af92a8 sm64coopdx`lua_rawgeti(L=<unavailable>, idx=<unavailable>, n=0) at lapi.c:663:7
    frame #6: 0x0000000002b170de sm64coopdx`luaL_ref(L=0x000032b01db37b10, t=-1001000) at lauxlib.c:602:3
    frame #7: 0x00000000028eb245 sm64coopdx`smlua_cobject_init_globals at smlua_cobject.c:540:22
    frame #8: 0x00000000028e982d sm64coopdx`smlua_init at smlua.c:311:5
    frame #9: 0x000000000289e7cb sm64coopdx`network_init(inNetworkType=NT_SERVER, reconnecting=false) at network.c:165:9
    frame #10: 0x00000000028df6b6 sm64coopdx`djui_panel_do_host(reconnecting=false, playSound=true) at djui_panel_host_message.c:31:5
    frame #11: 0x00000000028db8a8 sm64coopdx`djui_interactable_update [inlined] djui_interactable_on_click(base=0x000032b01e991600) at djui_interactable.c:46:5
    frame #12: 0x00000000028db879 sm64coopdx`djui_interactable_update [inlined] djui_interactable_on_cursor_down_end(base=0x000032b01e991600) at djui_interactable.c:99:9
    frame #13: 0x00000000028db82a sm64coopdx`djui_interactable_update at djui_interactable.c:453:13
    frame #14: 0x00000000028d13c9 sm64coopdx`djui_render at djui.c:183:5
    frame #15: 0x000000000279ed72 sm64coopdx`end_master_display_list at game_init.c:256:5
    frame #16: 0x000000000274c189 sm64coopdx`level_script_execute(cmd=<unavailable>) at level_script.c:1157:5
    frame #17: 0x000000000279f8c6 sm64coopdx`game_loop_one_iteration at game_init.c:603:24
    frame #18: 0x00000000028774d7 sm64coopdx`produce_one_frame at pc_main.c:312:5
    frame #19: 0x0000000002877bca sm64coopdx`main(argc=<unavailable>, argv=<unavailable>) at pc_main.c:538:9
    frame #20: 0x0000000829d68c3a libc.so.7`__libc_start1 + 298
    frame #21: 0x0000000002747650 sm64coopdx`_start at crt1_s.S:83

UB happens at frame 5.

Krush206 added a commit to Krush206/sm64coopdx that referenced this issue Feb 13, 2025
@Krush206
Copy link
Author

Solved. Updating Lua solves the issue. Guess the problem lies on luaconf.h, but I didn't spend much time setting. The owners and collaborators might want consider the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants