CraftSpider / GCDecompiler

A project to decompile and recompile gamecube games
MIT License
47 stars 7 forks source link

`Linking CXX executable gcd.exe` creates so many errors (Underfined references to logging) #12

Open DarthvaderBn opened 1 year ago

DarthvaderBn commented 1 year ago

OS: Windows 10 Compiler: gcc (wsl for setup.sh) CMake: cmake.exe (cmake -G "MinGW Makefiles") Make: mingw32-make.exe

Problem: When executting mingw32-make.exe everything appears to be okay until Linking CXX executable gcd.exe:

[ 43%] Linking CXX executable gcd.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text+0x22d5): undefined reference to `logging::Logger::warn(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text+0x255b): undefined reference to `logging::get_logger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text$_ZN4util4btolIL6Endian0EEEyPKhy[_ZN4util4btolIL6Endian0EEEyPKhy]+0x24): undefined reference to `unsigned long long util::btol<(Endian)0>(unsigned char const*, unsigned long long, unsigned long long)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text$_ZN4util11write_ulongIL6Endian0EEEvRSoyy[_ZN4util11write_ulongIL6Endian0EEEvRSoyy]+0x20): undefined reference to `unsigned char* util::ltob<(Endian)0>(unsigned long long, unsigned long long)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text$_ZN4util10write_longIL6Endian0EEEvRSoxy[_ZN4util10write_longIL6Endian0EEEvRSoxy]+0x20): undefined reference to `char* util::ltob<(Endian)0>(long long, unsigned long long)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(stageobjects.cpp.obj):stageobjects.c:(.text$_ZN4util4btolIL6Endian0EEExPKcy[_ZN4util4btolIL6Endian0EEExPKcy]+0x24): undefined reference to `long long util::btol<(Endian)0>(char const*, unsigned long long, unsigned long long)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\GCDecompiler.dir/objects.a(dol.cpp.obj):dol.cpp:(.text+0x8a): undefined reference to `logging::Logger::debug(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

...

collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\GCDecompiler.dir\build.make:422: gcd.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:111: CMakeFiles/GCDecompiler.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2
yne commented 9 months ago

It's because libs/alpha_tools.a is not found probably because setup.sh/.bat failed to compile the "alpha_tools" lib.

I got the same issues because the building of the utils failed because of some C++ reflection.h lines.

I simply removed the problematic line from reflection.h then restarted the setup.sh script. Now cmake . && make can link to the lib.