mmitch / gbsplay

gameboy sound player

Home Page:https://mmitch.github.io/gbsplay/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build: LDFLAGS are not honored in test build

mmitch opened this issue · comments

Currently the tests are disabled for MINGW_32/MINGW64 in configure because activating them gives errors like this:

TEST util.c
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.text+0x51): undefined reference to `libintl_fprintf'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.text+0x92): undefined reference to `__printf__'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.text+0xc1): undefined reference to `__printf__'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.text+0xe5): undefined reference to `__printf__'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.test+0xb3): undefined reference to `__printf__'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.test+0xd3): undefined reference to `__printf__'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.test+0xeb): more undefined references to `__printf__' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccKTOltY.o:util.c:(.test+0x153): undefined reference to `libintl_fprintf'
collect2.exe: error: ld returned 1 exit status

The reason seems to be that the LDFLAGS are not honored in the %.test build recipe (which runs the test embedded in util.c):

gbsplay/Makefile

Lines 489 to 493 in 5e83317

%.test: %.c
@echo TEST $<
$(Q)$(HOSTCC) -DENABLE_TEST=1 -o $@$(binsuffix) $< -lm
$(Q)./$@$(binsuffix)
$(Q)rm ./$@$(binsuffix)

Simply adding $(GBSLDFLAGS) and/or $(GBSPLAYLDFLAGS) (plus -fpie and -fpic) does not work: While this will make the build pass under MINGW*, it will break the build on Linux configured with --enable-sharedlibgbs.

Can we have a seperate LDFLAGS for the host-only builds like the %.test and impulse.h targets?
This might also help with issue #47.