gba-toolchain
gba-toolchain copied to clipboard
Butano Toolchain does not appear to set necessary definitions.
I am building from main with the following CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(my_project LANGUAGES C CXX)
add_executable(my_executable src/main.c)
# gba-toolchain sets `CMAKE_SYSTEM_NAME` to `AdvancedGameBoy`
if(CMAKE_SYSTEM_NAME STREQUAL AdvancedGameBoy)
find_package(butano REQUIRED)
find_package(librom REQUIRED)
find_package(agbabi REQUIRED)
target_compile_options(my_executable PRIVATE -mthumb -fconserve-stack -fomit-frame-pointer)
target_link_libraries(my_executable PRIVATE butano librom)
# ROM header info
set_target_properties(my_executable PROPERTIES
ROM_TITLE "My Game"
ROM_ID AABE
ROM_MAKER CD
ROM_VERSION 1
)
# install to .gba
install_rom(my_executable)
endif()
In response, I get the following output:
[proc] Executing command: /usr/bin/cmake --build /workspaces/butano-test/out/build/gba-toolchain-release --parallel 34 --target all
[build] Scanning dependencies of target librom
[build] Scanning dependencies of target butano
[build] [ 1%] Building ASM object lib/rom/CMakeFiles/librom.dir/rom.header.s.obj
[build] [ 2%] Building ASM object lib/rom/CMakeFiles/librom.dir/crt0.s.obj
[build] [ 4%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_audio_manager.cpp.obj
[build] [ 4%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_affine_bg_animate_actions.cpp.obj
[build] [ 6%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_best_fit_allocator.cpp.obj
[build] [ 7%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_bg_blocks_manager.cpp.obj
[build] [ 9%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_color_effect.cpp.obj
[build] [ 9%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_cameras_manager.cpp.obj
[build] [ 10%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_core.cpp.obj
[build] [ 10%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_bgs_manager.cpp.obj
[build] [ 12%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_display_manager.cpp.obj
[build] [ 14%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_hblank_effects_manager.cpp.obj
[build] [ 14%] Linking ASM static library librom.a
[build] [ 15%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_format.cpp.obj
[build] [ 15%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_generic_pool.cpp.obj
[build] [ 17%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_gpio_manager.cpp.obj
[build] [ 18%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_keypad_manager.cpp.obj
[build] [ 19%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_memory_manager.cpp.obj
[build] [ 20%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_math.cpp.obj
[build] [ 21%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_palettes_manager.cpp.obj
[build] [ 23%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_hdma_manager.cpp.obj
[build] [ 24%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_log.cpp.obj
[build] [ 24%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_link_manager.cpp.obj
[build] [ 25%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_profiler.cpp.obj
[build] [ 28%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sin_lut.cpp.obj
[build] [ 28%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprite_affine_mats_manager.cpp.obj
[build] [ 29%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_regular_bg_animate_actions.cpp.obj
[build] [ 28%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_reciprocal_lut.cpp.obj
[build] [ 30%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprites_manager.bn_iwram.cpp.obj
[build] [ 31%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprite_tiles_manager.cpp.obj
[build] [ 31%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprite_text_generator.cpp.obj
[build] [ 32%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprite_animate_actions.cpp.obj
[build] [ 34%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sprites_manager.cpp.obj
[build] [ 34%] Built target librom
[build] [ 35%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sstream.cpp.obj
[build] [ 36%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_sram.cpp.obj
[build] [ 37%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_audio.cpp.obj
[build] [ 37%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/src/bn_timer.cpp.obj
[build] [ 39%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_common.bn_noflto.cpp.obj
[build] [ 40%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_cstdlib.cpp.obj
[build] [ 41%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_cstring.cpp.obj
[build] [ 42%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_game_pak.bn_ewram.cpp.obj
[build] [ 42%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_irq.cpp.obj
[build] [ 43%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_link.cpp.obj
[build] [ 45%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_memory.cpp.obj
[build] [ 46%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_palettes.cpp.obj
[build] [ 47%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_palettes.bn_iwram.cpp.obj
[build] [ 47%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_show.cpp.obj
[build] [ 48%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_sprite_tiles.bn_iwram.cpp.obj
[build] [ 52%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_text.cpp.obj
[build] [ 52%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_system_font.cpp.obj
[build] [ 52%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_sram.cpp.obj
[build] [ 53%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_sram.bn_ewram.cpp.obj
[build] [ 53%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_bg_blocks.s.obj
[build] [ 54%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_palettes_asm.s.obj
[build] [ 56%] Building CXX object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/vgm-player/src/vgm.cpp.obj
[build] [ 57%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_hblank_effects.s.obj
[build] [ 58%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_core.s.obj
[build] [ 58%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/rtc.c.obj
[build] [ 59%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/gbt-player/src/gbt_player.c.obj
[build] [ 60%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tonc_sbmp16.c.obj
[build] [ 62%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tonc_color.c.obj
[build] [ 63%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tonc_schr4c.c.obj
[build] [ 64%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tonc_schr4r.c.obj
[build] [ 65%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tte/bmp16_drawg_b1cs.c.obj
[build] [ 65%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tonc_surface.c.obj
[build] [ 67%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tte/tte_init_bmp.c.obj
[build] [ 68%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/tte/tte_main.c.obj
[build] [ 68%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/atan2.s.obj
[build] [ 69%] Building C object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libugba/src/interrupts_gba.c.obj
[build] [ 70%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/fiq_memcpy.s.obj
[build] [ 71%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/memmove.s.obj
[build] [ 73%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/memcpy.s.obj
[build] [ 74%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/memset.s.obj
[build] [ 75%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/lmul.s.obj
[build] [ 75%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/agbabi/src/rmemcpy.s.obj
[build] [ 76%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/cult-of-gba-bios/src/huffman.s.obj
[build] [ 78%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/cult-of-gba-bios/src/lz77.s.obj
[build] [ 79%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/cult-of-gba-bios/src/running_length.s.obj
[build] [ 79%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/gba-modern/src/sdiv32.s.obj
[build] [ 80%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/gba-modern/src/clz.s.obj
[build] [ 81%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/gba-modern/src/sqrt32.s.obj
[build] [ 84%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/asm/clr_fade_fast.s.obj
[build] [ 84%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/gba-modern/src/udiv32.s.obj
[build] [ 84%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/asm/tonc_memset.s.obj
[build] [ 85%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/asm/clr_blend_fast.s.obj
[build] [ 86%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/asm/tonc_bios.s.obj
[build] [ 87%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/asm/tonc_nocash.s.obj
[build] [ 89%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libugba/src/irq_handler.s.obj
[build] [ 91%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source/mm_mas.s.obj
[build] [ 92%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source/mm_effect.s.obj
[build] [ 93%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source/mm_main.s.obj
[build] [ 93%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/libtonc/src/font/verdana9.s.obj
[build] [ 95%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source_gba/mm_mixer_gba.s.obj
[build] [ 95%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source/mm_mas_arm.s.obj
[build] [ 96%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source_gba/mm_init_default.s.obj
[build] [ 96%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/posprintf/src/posprintf.s.obj
[build] [ 97%] Building ASM object lib/butano/CMakeFiles/butano.dir/butano/hw/3rd_party/maxmod/source_gba/mm_main_gba.s.obj
[build] [ 97%] Built target butano
[build] [ 98%] Building C object CMakeFiles/my_executable.dir/src/main.c.obj
[build] [100%] Linking CXX executable my_executable.elf
[build] Title = "My Game"
[build] ID = "AABE" [E] USA/English
[build] Maker = "CD"
[build] Version = 0x01
[build] Complement = 0x60
[build] /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: lib/rom/librom.a(crt0.s.obj): warning: _getpid is not implemented and will always fail
[build] /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: lib/butano/CMakeFiles/butano.dir/butano/src/bn_memory_manager.cpp.obj: in function `bn::memory::used_rom()':
[build] /workspaces/butano-test/third-party/gba-toolchain/lib/butano/source/butano/src/bn_memory.cpp.h:143:(.text._ZN2bn6memory8used_romEv+0x8): undefined reference to `BN_ROM_END'
[build] /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: /workspaces/butano-test/third-party/gba-toolchain/lib/butano/source/butano/src/bn_memory.cpp.h:143:(.text._ZN2bn6memory8used_romEv+0xc): undefined reference to `BN_ROM_START'
[build] /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld: lib/butano/CMakeFiles/butano.dir/butano/hw/src/bn_hw_audio.cpp.obj: in function `bn::hw::audio::init()':
[build] /workspaces/butano-test/third-party/gba-toolchain/lib/butano/source/butano/hw/src/bn_hw_audio.cpp:220:(.text._ZN2bn2hw5audio4initEv+0x94): undefined reference to `_bn_audio_soundbank_bin'
[build] collect2: error: ld returned 1 exit status
[build] make[2]: *** [CMakeFiles/my_executable.dir/build.make:287: my_executable.elf] Error 1
[build] make[1]: *** [CMakeFiles/Makefile2:132: CMakeFiles/my_executable.dir/all] Error 2
[build] make: *** [Makefile:136: all] Error 2
[proc] The command: /usr/bin/cmake --build /workspaces/butano-test/out/build/gba-toolchain-release --parallel 34 --target all exited with code: 2
[driver] Build completed: 00:00:02.557
[build] Build finished with exit code 2
Looking at the butano-dka.make file at https://github.com/GValiente/butano/blob/master/butano/butano_dka.mak, it appears that BN_ROM_START and BN_ROM_END should be set to __text_start and rom_end respectively.
Using add_definitions or add_compile_definitions to add in those values does not appear to fix the issue:
add_definitions(
-DBN_ROM_START=__text_start
-DBN_ROM_END=__rom_end__
)
I suspect that this might be because I'm missing an add_butano_assets call (I dont have any assets yet, I'm just now setting up my build system), but I don't think a lack of assets should prevent a build (if that is the issue).