bebbo / gcc

Bebbo's gcc-6-branch for m68k-amigaos
GNU General Public License v2.0
33 stars 11 forks source link

Issues linking with GCC 13.1 #201

Open AJenbo opened 1 year ago

AJenbo commented 1 year ago

After switching from the latest GCC 13.1 branch everything compile, but we get a few linker errors at the end (see below).

PR for switching DevilutionX from GCC 6 to 13.1 for Amiga builds: https://github.com/diasurgical/devilutionX/pull/6056

Full buildlog: https://app.circleci.com/pipelines/github/diasurgical/devilutionX/17565/workflows/dde45506-b193-477c-93c3-c02ecfbebe9b/jobs/111298

Linker error:

_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/init.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_17LoadMPQERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EESt17basic_string_viewIcS5_E+0x1cc): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/init.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution8gbActiveE':
Source/CMakeFiles/libdevilutionx.dir/init.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_17LoadMPQERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EESt17basic_string_viewIcS5_E+0x2f8): undefined reference to `devilution::MpqArchive::ErrorMessage(int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/menu.cpp.obj:(.text._ZN10devilution27mainmenu_select_hero_dialogEPNS_8GameDataE+0xd6): undefined reference to `devilution::UiSelHeroMultDialog(bool (*)(bool (*)(devilution::_uiheroinfo*)), bool (*)(devilution::_uiheroinfo*), bool (*)(devilution::_uiheroinfo*), void (*)(unsigned int, devilution::_uidefaultstats*), devilution::_selhero_selections*, unsigned int*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/menu.cpp.obj:(.text._ZN10devilution27mainmenu_select_hero_dialogEPNS_8GameDataE+0x1b2): undefined reference to `devilution::UiSelHeroMultDialog(bool (*)(bool (*)(devilution::_uiheroinfo*)), bool (*)(devilution::_uiheroinfo*), bool (*)(devilution::_uiheroinfo*), void (*)(unsigned int, devilution::_uidefaultstats*), devilution::_selhero_selections*, unsigned int*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/menu.cpp.obj:(.text._ZN10devilution27mainmenu_select_hero_dialogEPNS_8GameDataE+0x64): undefined reference to `devilution::UiSelHeroSingDialog(bool (*)(bool (*)(devilution::_uiheroinfo*)), bool (*)(devilution::_uiheroinfo*), bool (*)(devilution::_uiheroinfo*), void (*)(unsigned int, devilution::_uidefaultstats*), devilution::_selhero_selections*, unsigned int*, devilution::_difficulty*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/menu.cpp.obj:(.text._ZN10devilution27mainmenu_select_hero_dialogEPNS_8GameDataE+0x15a): undefined reference to `devilution::UiSelHeroSingDialog(bool (*)(bool (*)(devilution::_uiheroinfo*)), bool (*)(devilution::_uiheroinfo*), bool (*)(devilution::_uiheroinfo*), void (*)(unsigned int, devilution::_uidefaultstats*), devilution::_selhero_selections*, unsigned int*, devilution::_difficulty*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/menu.cpp.obj:(.text._ZN10devilution27mainmenu_select_hero_dialogEPNS_8GameDataE+0xec): undefined reference to `devilution::SErrSetLastError(unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_121UpdateMissileVelocityERNS_7MissileENS_7PointOfIiEEi+0x4e): undefined reference to `hypot'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution8MissilesB5cxx11E':
Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_121UpdateMissileVelocityERNS_7MissileENS_7PointOfIiEEi+0xe8): undefined reference to `hypot'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/msg.cpp.obj:(.text._ZN10devilution16NetSendCmdStringEmPKc+0x4e): undefined reference to `devilution::multi_send_msg_packet(unsigned long, std::byte const*, unsigned long)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution12NetSendHiPriEiPKSt4bytem.part.0+0x44): undefined reference to `devilution::sync_all_monsters(std::byte*, unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution12NetSendHiPriEiPKSt4bytem.part.0+0x98): undefined reference to `devilution::sync_all_monsters(std::byte*, unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution18multi_handle_deltaEv+0x5c): undefined reference to `devilution::nthread_send_and_recv_turn(unsigned int, int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution23gbSomebodyWonGameKludgeE':
Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution18multi_handle_deltaEv+0x1c2): undefined reference to `devilution::SNetDropPlayer(int, unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution29multi_process_network_packetsEv+0x9c): undefined reference to `devilution::SNetReceiveMessage(unsigned char*, void**, unsigned int*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution23gbSomebodyWonGameKludgeE':
Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution29multi_process_network_packetsEv+0x39c): undefined reference to `devilution::SNetDropPlayer(int, unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x20): undefined reference to `devilution::SetRndSeed(unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution23gbSomebodyWonGameKludgeE':
Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x600): undefined reference to `devilution::SetRndSeed(unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x2ac): undefined reference to `devilution::nthread_send_and_recv_turn(unsigned int, int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x550): undefined reference to `devilution::nthread_send_and_recv_turn(unsigned int, int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x1b4): undefined reference to `devilution::SNetInitializeProvider(unsigned int, devilution::GameData*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution23gbSomebodyWonGameKludgeE':
Source/CMakeFiles/libdevilutionx.dir/multi.cpp.obj:(.text._ZN10devilution7NetInitEb+0x73a): undefined reference to `devilution::SNetInitializeProvider(unsigned int, devilution::GameData*)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution15OpenSaveArchiveEj+0x26): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution16OpenStashArchiveEv+0x1e): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution11ReadArchiveERNS_10MpqArchiveEPKcPm+0x1e): undefined reference to `devilution::MpqArchive::ReadFile(char const*, unsigned long&, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution23pfile_ui_set_hero_infosEPFbPNS_11_uiheroinfoEE+0x66): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution27pfile_read_player_from_saveEjRNS_6PlayerE+0x78): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/pfile.cpp.obj:(.text._ZN10devilution23pfile_compare_hero_demoEib+0x612): undefined reference to `devilution::MpqArchive::Open(char const*, int&)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/engine/demomode.cpp.obj:(.text._ZN10devilution4demo13RecordMessageERK9SDL_Eventt+0x124): undefined reference to `devilution::IsCustomEvent(unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/engine/demomode.cpp.obj:(.text._ZN10devilution4demo13RecordMessageERK9SDL_Eventt+0x138): undefined reference to `devilution::GetCustomEvent(unsigned int)'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/libm020/libm881/libstdc++.a(c++locale.o):(.text._ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi+0x28): undefined reference to `strtold'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/devilutionx.dir/build.make:424: devilutionx] Error 1
make[1]: *** [CMakeFiles/Makefile2:358: CMakeFiles/devilutionx.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Exited with code exit status 2
bebbo commented 1 year ago

that's related to the exception tables

bebbo commented 1 year ago

please retry

AJenbo commented 1 year ago

Looks like i'm still getting the issue

bebbo commented 1 year ago

then I'm doing something wrong:

... uhm yes. cmake is still using gcc 6.5.0b....

bebbo commented 1 year ago

some headers differ in the definition of the types. Thus uint32_t get sometimes resolved to unsigned int and sometimes to unsigned long.

e.g.:

> m68k-amigaos-c++filt __ZN10devilution13IsCustomEventEj
devilution::IsCustomEvent(unsigned int)
> m68k-amigaos-c++filt __ZN10devilution13IsCustomEventEm
devilution::IsCustomEvent(unsigned long)

Those functions can't be found, since they are different.

=> fix your includes!

glebm commented 1 year ago

@bebbo We do not do anything custom with the includes, we simply use the Amiga GCC container as-is. Sounds like the issue is with the container.

bebbo commented 1 year ago

@glebm but some files include cstdint and some don't

/**
 * @file interfac.cpp
 *
 * Implementation of load screens.
 */

#include <cstdint>
glebm commented 1 year ago

I've sent https://github.com/diasurgical/devilutionX/pull/6095 adding the missing <cstdint> includes to our own code (don't know if all of our dependencies do it correctly though).

However, it seems to me like there is a deeper issue here, like why are there different definitions of uint32_t in the default system headers in the container.

bebbo commented 1 year ago

some hints diff.txt

bebbo commented 1 year ago

it links here, still complains a bit:

_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail11utf8_decodeEPKcPmPi' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail16write_escaped_cpINS0_8appenderEcEET_S4_RKNS1_18find_escape_resultIT0_EE' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail11utf8_decodeEPKcPmPi' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail16write_escaped_cpINS0_8appenderEcEET_S4_RKNS1_18find_escape_resultIT0_EE' has different contents

but links... ... starts and gurus... an older version here seemed to work

glebm commented 1 year ago

Yeah that's what I thought would happen. We're not in control of libfmt code. The root cause of this should be fixed in the container.

bebbo commented 1 year ago

Well, the remaining messages are just an info. I checked one and it differs because each references the same string constant at different addresses,,,

glebm commented 1 year ago

We're down to the following errors on CI:

_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
_deps/libfmt-build/libfmt.a(format.cc.obj): duplicate section `.text._ZN3fmt2v96detail15write_codepointILm2EcNS0_8appenderEEET1_S4_cm' has different contents
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_121UpdateMissileVelocityERNS_7MissileENS_7PointOfIiEEi+0x4e): undefined reference to `hypot'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj: in function `_GLOBAL__sub_D__ZN10devilution8MissilesB5cxx11E':
Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.obj:(.text._ZN10devilution12_GLOBAL__N_121UpdateMissileVelocityERNS_7MissileENS_7PointOfIiEEi+0xe8): undefined reference to `hypot'
/opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos-gcc10/lib/gcc/m68k-amigaos/13.1.1/libm020/libm881/libstdc++.a(c++locale.o):(.text._ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi+0x28): undefined reference to `strtold'
bebbo commented 1 year ago

your https://github.com/bebbo/libnix/ library is not uptodate

glebm commented 1 year ago

Yep, that was it! Now green on CI 🎉 https://app.circleci.com/pipelines/github/diasurgical/devilutionX/17638/workflows/c243890a-ec5d-48d8-9eb2-c7ec45758d6f/jobs/111614/artifacts

Thanks for debugging this with us!

AJenbo commented 1 year ago

Dose it still stall on boot?

bebbo commented 1 year ago

yup - but meanwhile I get a black screen with a nice cursor... maybe I need some support files?

AJenbo commented 1 year ago

here is the shareware data: https://github.com/diasurgical/devilutionx-assets/releases/download/v2/spawn.mpq

The asserts/devilutionx.mpq should be populated when you build, but just in case that is an issue then you can also just grab it from one of the other builds: https://github.com/diasurgical/devilutionX/suites/12836963140/artifacts/691621110

AJenbo commented 1 year ago

@bebbo did you have an luck running the game? Have you tried comparing it with a build using GCC6 and see if that one starts on the system?

bebbo commented 1 year ago

it starts if compiled with gcc6.5 It crashes if compiled with gcc13.1

AJenbo commented 1 year ago

Hmm how can we figure out what could be the issues

AJenbo commented 1 year ago

Looks like the app actually runs, but it fails when doing file operations:

image

bebbo commented 11 months ago

guess we need a simpler case where it fails to hunt that problem down.