Platform / OS / Hardware: Nintendo Switch
Github hash: bc3c1ab
Hardware: building on AMD64 Windows + MSYS2 or Ubuntu
Trying to build a libretro core for Nintendo Switch following these steps fails during linking of the RetroArch binary with the core. Flycast core builds correctly, RetroArch builds correctly, but linking fails due to undefined references (notably to CMakeRC resources):
$ make -f Makefile.libnx
linking retroarch_switch.elf
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: DWARF error: can't find .debug_ranges section.
libretro_libnx.a(printer.o): in function `printer::BitmapWriter::BitmapWriter(int)':
printer.cpp:(.text._ZN7printer12BitmapWriterC2Ei[_ZN7printer12BitmapWriterC5Ei]+0x64): undefined reference to `cmrc::flycast::get_filesystem()'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: DWARF error: can't find .debug_ranges section.
libretro_libnx.a(reios.o): in function `reios_reset(unsigned char*)':
reios.cpp:(.text._Z11reios_resetPh+0x9c): undefined reference to `cmrc::flycast::get_filesystem()'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: DWARF error: can't find .debug_ranges section.
libretro_libnx.a(reios_elf.o): in function `reios_loadElf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xa4): undefined reference to `elf_newFile'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xe0): undefined reference to `elf_checkFile'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x104): undefined reference to `elf_getNumProgramHeaders'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x11c): undefined reference to `elf_getProgramHeaderVaddr'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x12c): undefined reference to `elf_getProgramHeaderFileSize'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x140): undefined reference to `elf_getProgramHeaderOffset'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: reios_elf.cpp:(.text._Z13reios_loadElfRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x174): undefined reference to `elf_getProgramHeaderMemorySize'
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld: DWARF error: can't find .debug_ranges section.
libretro_libnx.a(nvmem.o): in function `nvmem::loadFlashResource(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&)':
nvmem.cpp:(.text._ZN5nvmemL17loadFlashResourceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERm+0x20): undefined reference to `cmrc::flycast::get_filesystem()'
collect2: error: ld returned 1 exit status
make: *** [/opt/devkitpro/libnx/switch_rules:81: retroarch_switch.elf] Error 1
Steps to reproduce:
- Flycast built using CMake commands used in GitHub workflows:
$DEVKITPRO/portlibs/switch/bin/aarch64-none-elf-cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=artifact -G Ninja -DLIBRETRO=ON (CMakeLists.txt slightly modified to replace expected *.obj files with the generated *.o files in last build step)
cmake --build build --config Release --target install
- Resulting
flycast_libretro_libnx.a artifact copied to retroarch directory as libretro_libnx.a
- RetroArch built with
make -f Makefile.libnx
Platform / OS / Hardware: Nintendo Switch
Github hash: bc3c1ab
Hardware: building on AMD64 Windows + MSYS2 or Ubuntu
Trying to build a libretro core for Nintendo Switch following these steps fails during linking of the RetroArch binary with the core. Flycast core builds correctly, RetroArch builds correctly, but linking fails due to undefined references (notably to CMakeRC resources):
Steps to reproduce:
$DEVKITPRO/portlibs/switch/bin/aarch64-none-elf-cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=artifact -G Ninja -DLIBRETRO=ON(CMakeLists.txt slightly modified to replace expected*.objfiles with the generated*.ofiles in last build step)cmake --build build --config Release --target installflycast_libretro_libnx.aartifact copied to retroarch directory aslibretro_libnx.amake -f Makefile.libnx