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

Issues linking with GCC 13.1 #201

Open
AJenbo opened this issue Apr 30, 2023 · 23 comments
Open

Issues linking with GCC 13.1 #201

AJenbo opened this issue Apr 30, 2023 · 23 comments
Labels
close pending the ticket will be closed soon, whether fixed or not help wanted

Comments

@AJenbo
Copy link

AJenbo commented Apr 30, 2023

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:
diasurgical/DevilutionX#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
Copy link
Owner

bebbo commented May 4, 2023

that's related to the exception tables

bebbo added a commit that referenced this issue May 4, 2023
@bebbo
Copy link
Owner

bebbo commented May 4, 2023

please retry

@AJenbo
Copy link
Author

AJenbo commented May 9, 2023

Looks like i'm still getting the issue

@bebbo
Copy link
Owner

bebbo commented May 10, 2023

then I'm doing something wrong:

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

@bebbo
Copy link
Owner

bebbo commented May 10, 2023

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
Copy link

glebm commented May 10, 2023

@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
Copy link
Owner

bebbo commented May 10, 2023

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

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

#include <cstdint>

@glebm
Copy link

glebm commented May 10, 2023

I've sent diasurgical/DevilutionX#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
Copy link
Owner

bebbo commented May 10, 2023

some hints
diff.txt

@bebbo
Copy link
Owner

bebbo commented May 10, 2023

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
Copy link

glebm commented May 10, 2023

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
Copy link
Owner

bebbo commented May 10, 2023

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
Copy link

glebm commented May 10, 2023

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
Copy link
Owner

bebbo commented May 10, 2023

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

@glebm
Copy link

glebm commented May 10, 2023

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
Copy link
Author

AJenbo commented May 11, 2023

Dose it still stall on boot?

@bebbo
Copy link
Owner

bebbo commented May 11, 2023

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

@AJenbo
Copy link
Author

AJenbo commented May 11, 2023

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

@bebbo bebbo added the close pending the ticket will be closed soon, whether fixed or not label May 15, 2023
@AJenbo
Copy link
Author

AJenbo commented May 15, 2023

@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
Copy link
Owner

bebbo commented May 29, 2023

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

@AJenbo
Copy link
Author

AJenbo commented May 29, 2023

Hmm how can we figure out what could be the issues

@AJenbo
Copy link
Author

AJenbo commented Aug 1, 2023

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

image

@bebbo
Copy link
Owner

bebbo commented Sep 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close pending the ticket will be closed soon, whether fixed or not help wanted
Projects
None yet
Development

No branches or pull requests

3 participants