Zal0 / ZGB

Game Boy / Color engine with lots of features
MIT License
708 stars 50 forks source link

Issue linking gbt_player when running makefile on macOS #37

Open martzgb opened 2 years ago

martzgb commented 2 years ago

I've been successfully building/running on macOS for a while now using changes very similar to this pull request: https://github.com/Zal0/ZGB/pull/32/files

However I've recently added music to my game, and I'm noticing this issue:

creating zgb.lib
Linking
?ASlink-Warning-Cannot open library module ../DebugColor/zgb/-e gbt_player.o

?ASlink-Warning-Undefined Global '_gbt_stop' referenced by module 'main'

?ASlink-Warning-Undefined Global '_gbt_enable_channels' referenced by module 'main'

?ASlink-Warning-Undefined Global '_gbt_play' referenced by module 'Music'

?ASlink-Warning-Undefined Global '_gbt_loop' referenced by module 'Music'

?ASlink-Warning-Undefined Global '_gbt_update' referenced by module 'Music'

The culprit seems to be some bad string concatenation with macOS make, where -e is in the wrong place: /zgb/-e gbt_player.o

I was able to work around this by removing the link to $(ZGB_PATH_UNIX)/lib/hUGEDriver.obj.o, and adding an explicitly linking $(OBJDIR_ZGB)/gbt_player.o instead. I can keep my copy of ZGB patched and rebase as new changes come out, since I already do this for gbm2c, gbr2c, and gbr2png binaries... But it would be nice if a fix were incorporated upstream since the makefile seems like fertile ground for merge conflicts.

Screen Shot 2021-12-01 at 4 08 56 PM
Zal0 commented 2 years ago

Hmm... Did you set MUSIC_PLAYER = GBT_PLAYER in your project Makefile? You can use either GBT_PLAYER or HUGETRACKER and that should do it

martzgb commented 2 years ago

I do set that. My current makefile:

PROJECT_NAME = ZGB_TEMPLATE

all: build_gb

N_BANKS = A

DEFAULT_SPRITES_SIZE = SPRITES_8x8

MUSIC_PLAYER = GBT_PLAYER

include $(ZGB_PATH)/src/MakefileCommon
asturur commented 9 months ago

The way i got rid of The culprit seems to be some bad string concatenation with macOS make, where -e is in the wrong place: /zgb/-e gbt_player.o was to delete the -e in front of the echo command.