Linker error while compiling v7.2 with CMake on Debian 12 / Arch Linux #139

Closed
opened 2024-11-07 19:06:08 +01:00 by Kuborros · 5 comments
Kuborros commented 2024-11-07 19:06:08 +01:00 (Migrated from github.com)

As in the title, compiling Saturn from v7.2 tag on Linux results in linker errors.

  • Tested on freshly cloned repo, on Debian 12.7 and Arch - errors are the same between both of them.
  • No extra compile flags were set.
  • I have also tested the Saturn-Testing and Saturn-Next branches, to the same outcome.

Everything works if i revert back to v7.1 - from my testing last commit where linking works fine is b6e766ee44 (Fix A_Lua not removing error handler from lua stack). The following commit c3dd1755dc (port srb2 software portal refactor) results in the listed issues.

Logs below:

[100%] Linking C executable ../../bin/srb2kart
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: warning: relocation against `portalrender' in read-only section `.text'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_bsp.c.o: in function `R_AddLine':
r_bsp.c:(.text+0xd9d): undefined reference to `g_portal'
/usr/bin/ld: r_bsp.c:(.text+0xf50): undefined reference to `portalrender'
/usr/bin/ld: r_bsp.c:(.text+0x1008): undefined reference to `Portal_Add2Lines'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_bsp.c.o: in function `R_RenderBSPNode':
r_bsp.c:(.text+0x3d0b): undefined reference to `portalcullsector'
/usr/bin/ld: r_bsp.c:(.text+0x3d3b): undefined reference to `portalcullsector'
/usr/bin/ld: r_bsp.c:(.text+0x3d47): undefined reference to `portalcullsector'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_main.c.o: in function `R_PortalFrame':
r_main.c:(.text+0x3f13): undefined reference to `portalclipstart'
/usr/bin/ld: r_main.c:(.text+0x3f20): undefined reference to `portalclipend'
/usr/bin/ld: r_main.c:(.text+0x3f55): undefined reference to `portalclipline'
/usr/bin/ld: r_main.c:(.text+0x3f5c): undefined reference to `portalclipline'
/usr/bin/ld: r_main.c:(.text+0x3f67): undefined reference to `portalcullsector'
/usr/bin/ld: r_main.c:(.text+0x3f6e): undefined reference to `portalclipline'
/usr/bin/ld: r_main.c:(.text+0x3f82): undefined reference to `portalclipline'
/usr/bin/ld: r_main.c:(.text+0x3f8d): undefined reference to `portalcullsector'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_main.c.o: in function `R_RenderPlayerView':
r_main.c:(.text+0x41fd): undefined reference to `Portal_InitList'
/usr/bin/ld: r_main.c:(.text+0x42d0): undefined reference to `portalclipstart'
/usr/bin/ld: r_main.c:(.text+0x42e7): undefined reference to `portalclipend'
/usr/bin/ld: r_main.c:(.text+0x42ed): undefined reference to `portalclipend'
/usr/bin/ld: r_main.c:(.text+0x42f3): undefined reference to `portalclipstart'
/usr/bin/ld: r_main.c:(.text+0x4352): undefined reference to `portalclipstart'
/usr/bin/ld: r_main.c:(.text+0x4362): undefined reference to `portalclipend'
/usr/bin/ld: r_main.c:(.text+0x4417): undefined reference to `portal_base'
/usr/bin/ld: r_main.c:(.text+0x4427): undefined reference to `portal_base'
/usr/bin/ld: r_main.c:(.text+0x443e): undefined reference to `portalrender'
/usr/bin/ld: r_main.c:(.text+0x4472): undefined reference to `Portal_ClipApply'
/usr/bin/ld: r_main.c:(.text+0x4494): undefined reference to `Portal_Remove'
/usr/bin/ld: r_main.c:(.text+0x44ad): undefined reference to `portal_base'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_segs.c.o: in function `R_StoreWallRange':
r_segs.c:(.text+0x9f26): undefined reference to `g_portal'
/usr/bin/ld: r_segs.c:(.text+0x9f32): undefined reference to `portalrender'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ProjectSprite':
r_things.c:(.text+0x51bc): undefined reference to `portalrender'
/usr/bin/ld: r_things.c:(.text+0x51c7): undefined reference to `portalclipline'
/usr/bin/ld: r_things.c:(.text+0x51d2): undefined reference to `portalclipstart'
/usr/bin/ld: r_things.c:(.text+0x51e1): undefined reference to `portalclipend'
/usr/bin/ld: r_things.c:(.text+0x51f1): undefined reference to `portalclipline'
/usr/bin/ld: r_things.c:(.text+0x59ad): undefined reference to `portalclipstart'
/usr/bin/ld: r_things.c:(.text+0x59c5): undefined reference to `portalclipend'
/usr/bin/ld: r_things.c:(.text+0x59d0): undefined reference to `portalclipend'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ProjectPrecipitationSprite':
r_things.c:(.text+0x65b7): undefined reference to `portalrender'
/usr/bin/ld: r_things.c:(.text+0x65c2): undefined reference to `portalclipline'
/usr/bin/ld: r_things.c:(.text+0x65cd): undefined reference to `portalclipstart'
/usr/bin/ld: r_things.c:(.text+0x65dc): undefined reference to `portalclipend'
/usr/bin/ld: r_things.c:(.text+0x65ec): undefined reference to `portalclipline'
/usr/bin/ld: r_things.c:(.text+0x67f1): undefined reference to `portalclipstart'
/usr/bin/ld: r_things.c:(.text+0x6806): undefined reference to `portalclipend'
/usr/bin/ld: r_things.c:(.text+0x6811): undefined reference to `portalclipend'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ClipVisSprite':
r_things.c:(.text+0x8245): undefined reference to `portalrender'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `CheckClip':
hw_main.c:(.text+0x7d29): undefined reference to `portalclipline'
/usr/bin/ld: hw_main.c:(.text+0x7de2): undefined reference to `portalclipline'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_AddLine':
hw_main.c:(.text+0x80a2): undefined reference to `portalclipline'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_RenderBSPNode':
hw_main.c:(.text+0xabe8): undefined reference to `portalclipline'
/usr/bin/ld: hw_main.c:(.text+0xabf4): undefined reference to `portalcullsector'
/usr/bin/ld: hw_main.c:(.text+0xac24): undefined reference to `portalcullsector'
/usr/bin/ld: hw_main.c:(.text+0xac30): undefined reference to `portalcullsector'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_RenderFrame':
hw_main.c:(.text+0x11611): undefined reference to `portalclipline'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_FreePortalList':
hw_portal.c:(.text+0xed): undefined reference to `portalcullsector'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalFrame':
hw_portal.c:(.text+0x46e): undefined reference to `portalclipline'
/usr/bin/ld: hw_portal.c:(.text+0x475): undefined reference to `portalclipline'
/usr/bin/ld: hw_portal.c:(.text+0x480): undefined reference to `portalcullsector'
/usr/bin/ld: hw_portal.c:(.text+0x487): undefined reference to `portalclipline'
/usr/bin/ld: hw_portal.c:(.text+0x49b): undefined reference to `portalclipline'
/usr/bin/ld: hw_portal.c:(.text+0x4a6): undefined reference to `portalcullsector'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_RenderPortal':
hw_portal.c:(.text+0x5f6): undefined reference to `portalclipline'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalCheckPointSide':
hw_portal.c:(.text+0x66f): undefined reference to `portalclipline'
/usr/bin/ld: hw_portal.c:(.text+0x697): undefined reference to `portalclipline'
/usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalCheckBBox':
hw_portal.c:(.text+0x6cc): undefined reference to `portalclipline'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[2]: *** [src/sdl/CMakeFiles/SRB2SDL2.dir/build.make:2441: bin/srb2kart] Error 1
make[1]: *** [CMakeFiles/Makefile2:131: src/sdl/CMakeFiles/SRB2SDL2.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
As in the title, compiling Saturn from v7.2 tag on Linux results in linker errors. - Tested on freshly cloned repo, on Debian 12.7 and Arch - errors are the same between both of them. - No extra compile flags were set. - I have also tested the Saturn-Testing and Saturn-Next branches, to the same outcome. Everything works if i revert back to v7.1 - from my testing last commit where linking works fine is b6e766ee44c7fb006b5ecc6a5eba48fd355323e7 (Fix A_Lua not removing error handler from lua stack). The following commit c3dd1755dc725ae3e365e1641d23c3ff2d1064cb (port srb2 software portal refactor) results in the listed issues. Logs below: ``` [100%] Linking C executable ../../bin/srb2kart /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: warning: relocation against `portalrender' in read-only section `.text' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_bsp.c.o: in function `R_AddLine': r_bsp.c:(.text+0xd9d): undefined reference to `g_portal' /usr/bin/ld: r_bsp.c:(.text+0xf50): undefined reference to `portalrender' /usr/bin/ld: r_bsp.c:(.text+0x1008): undefined reference to `Portal_Add2Lines' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_bsp.c.o: in function `R_RenderBSPNode': r_bsp.c:(.text+0x3d0b): undefined reference to `portalcullsector' /usr/bin/ld: r_bsp.c:(.text+0x3d3b): undefined reference to `portalcullsector' /usr/bin/ld: r_bsp.c:(.text+0x3d47): undefined reference to `portalcullsector' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_main.c.o: in function `R_PortalFrame': r_main.c:(.text+0x3f13): undefined reference to `portalclipstart' /usr/bin/ld: r_main.c:(.text+0x3f20): undefined reference to `portalclipend' /usr/bin/ld: r_main.c:(.text+0x3f55): undefined reference to `portalclipline' /usr/bin/ld: r_main.c:(.text+0x3f5c): undefined reference to `portalclipline' /usr/bin/ld: r_main.c:(.text+0x3f67): undefined reference to `portalcullsector' /usr/bin/ld: r_main.c:(.text+0x3f6e): undefined reference to `portalclipline' /usr/bin/ld: r_main.c:(.text+0x3f82): undefined reference to `portalclipline' /usr/bin/ld: r_main.c:(.text+0x3f8d): undefined reference to `portalcullsector' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_main.c.o: in function `R_RenderPlayerView': r_main.c:(.text+0x41fd): undefined reference to `Portal_InitList' /usr/bin/ld: r_main.c:(.text+0x42d0): undefined reference to `portalclipstart' /usr/bin/ld: r_main.c:(.text+0x42e7): undefined reference to `portalclipend' /usr/bin/ld: r_main.c:(.text+0x42ed): undefined reference to `portalclipend' /usr/bin/ld: r_main.c:(.text+0x42f3): undefined reference to `portalclipstart' /usr/bin/ld: r_main.c:(.text+0x4352): undefined reference to `portalclipstart' /usr/bin/ld: r_main.c:(.text+0x4362): undefined reference to `portalclipend' /usr/bin/ld: r_main.c:(.text+0x4417): undefined reference to `portal_base' /usr/bin/ld: r_main.c:(.text+0x4427): undefined reference to `portal_base' /usr/bin/ld: r_main.c:(.text+0x443e): undefined reference to `portalrender' /usr/bin/ld: r_main.c:(.text+0x4472): undefined reference to `Portal_ClipApply' /usr/bin/ld: r_main.c:(.text+0x4494): undefined reference to `Portal_Remove' /usr/bin/ld: r_main.c:(.text+0x44ad): undefined reference to `portal_base' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_segs.c.o: in function `R_StoreWallRange': r_segs.c:(.text+0x9f26): undefined reference to `g_portal' /usr/bin/ld: r_segs.c:(.text+0x9f32): undefined reference to `portalrender' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ProjectSprite': r_things.c:(.text+0x51bc): undefined reference to `portalrender' /usr/bin/ld: r_things.c:(.text+0x51c7): undefined reference to `portalclipline' /usr/bin/ld: r_things.c:(.text+0x51d2): undefined reference to `portalclipstart' /usr/bin/ld: r_things.c:(.text+0x51e1): undefined reference to `portalclipend' /usr/bin/ld: r_things.c:(.text+0x51f1): undefined reference to `portalclipline' /usr/bin/ld: r_things.c:(.text+0x59ad): undefined reference to `portalclipstart' /usr/bin/ld: r_things.c:(.text+0x59c5): undefined reference to `portalclipend' /usr/bin/ld: r_things.c:(.text+0x59d0): undefined reference to `portalclipend' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ProjectPrecipitationSprite': r_things.c:(.text+0x65b7): undefined reference to `portalrender' /usr/bin/ld: r_things.c:(.text+0x65c2): undefined reference to `portalclipline' /usr/bin/ld: r_things.c:(.text+0x65cd): undefined reference to `portalclipstart' /usr/bin/ld: r_things.c:(.text+0x65dc): undefined reference to `portalclipend' /usr/bin/ld: r_things.c:(.text+0x65ec): undefined reference to `portalclipline' /usr/bin/ld: r_things.c:(.text+0x67f1): undefined reference to `portalclipstart' /usr/bin/ld: r_things.c:(.text+0x6806): undefined reference to `portalclipend' /usr/bin/ld: r_things.c:(.text+0x6811): undefined reference to `portalclipend' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/r_things.c.o: in function `R_ClipVisSprite': r_things.c:(.text+0x8245): undefined reference to `portalrender' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `CheckClip': hw_main.c:(.text+0x7d29): undefined reference to `portalclipline' /usr/bin/ld: hw_main.c:(.text+0x7de2): undefined reference to `portalclipline' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_AddLine': hw_main.c:(.text+0x80a2): undefined reference to `portalclipline' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_RenderBSPNode': hw_main.c:(.text+0xabe8): undefined reference to `portalclipline' /usr/bin/ld: hw_main.c:(.text+0xabf4): undefined reference to `portalcullsector' /usr/bin/ld: hw_main.c:(.text+0xac24): undefined reference to `portalcullsector' /usr/bin/ld: hw_main.c:(.text+0xac30): undefined reference to `portalcullsector' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_main.c.o: in function `HWR_RenderFrame': hw_main.c:(.text+0x11611): undefined reference to `portalclipline' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_FreePortalList': hw_portal.c:(.text+0xed): undefined reference to `portalcullsector' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalFrame': hw_portal.c:(.text+0x46e): undefined reference to `portalclipline' /usr/bin/ld: hw_portal.c:(.text+0x475): undefined reference to `portalclipline' /usr/bin/ld: hw_portal.c:(.text+0x480): undefined reference to `portalcullsector' /usr/bin/ld: hw_portal.c:(.text+0x487): undefined reference to `portalclipline' /usr/bin/ld: hw_portal.c:(.text+0x49b): undefined reference to `portalclipline' /usr/bin/ld: hw_portal.c:(.text+0x4a6): undefined reference to `portalcullsector' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_RenderPortal': hw_portal.c:(.text+0x5f6): undefined reference to `portalclipline' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalCheckPointSide': hw_portal.c:(.text+0x66f): undefined reference to `portalclipline' /usr/bin/ld: hw_portal.c:(.text+0x697): undefined reference to `portalclipline' /usr/bin/ld: CMakeFiles/SRB2SDL2.dir/__/hardware/hw_portal.c.o: in function `HWR_PortalCheckBBox': hw_portal.c:(.text+0x6cc): undefined reference to `portalclipline' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status make[2]: *** [src/sdl/CMakeFiles/SRB2SDL2.dir/build.make:2441: bin/srb2kart] Error 1 make[1]: *** [CMakeFiles/Makefile2:131: src/sdl/CMakeFiles/SRB2SDL2.dir/all] Error 2 make: *** [Makefile:156: all] Error 2 ```
AndreDK7 commented 2024-11-08 00:29:11 +01:00 (Migrated from github.com)

Had the same issue when i was trying to compile on my Raspberry Pi 3 running Debian bullseye.

Had the same issue when i was trying to compile on my Raspberry Pi 3 running Debian bullseye.
Indev450 commented 2024-11-08 09:45:36 +01:00 (Migrated from github.com)

Hmm compilation via make works, so its probably something related to cmake

Hmm compilation via make works, so its probably something related to cmake
Indev450 commented 2024-11-08 09:54:05 +01:00 (Migrated from github.com)

Ah, r_portal.c and r_portal.h were missing from src/CMakeLists, should be fixed in f4703be2c

Ah, r_portal.c and r_portal.h were missing from src/CMakeLists, should be fixed in f4703be2c
AndreDK7 commented 2024-11-08 14:41:46 +01:00 (Migrated from github.com)

Yep, all good on my side. All good there @Kuborros ?

Yep, all good on my side. All good there @Kuborros ?
Kuborros commented 2024-11-08 14:47:08 +01:00 (Migrated from github.com)

Yes, everything works now. Thank you!

Yes, everything works now. Thank you!
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: saturn/SRB2Kart-Saturn#139