ValleyBell / SMPSPlay

A player for SMPS files, a format commonly used in Sega MegaDrive games.
37 stars 6 forks source link

Linker error #10

Closed kargaroc closed 3 years ago

kargaroc commented 4 years ago

When building on Linux, I get this

Linking smpsplay ...
gcc obj/Engine/dac.o obj/Engine/necpcm.o obj/Engine/smps.o obj/Engine/smps_commands.o obj/Engine/smps_drums.o obj/Engine/smps_extra.o obj/ini_lib.o obj/loader_data.o obj/loader_def.o obj/loader_ini.o obj/loader_smps.o obj/main.o obj/Sound.o obj/vgmwrite.o libs/install/lib/libvgm-audio.a libs/install/lib/libvgm-emu.a -lm -lrt -pthread -lasound -lao -o smpsplay
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `DoDataForwarding':
AudioStream.c:(.text+0x18): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0x6f): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_Init':
AudioStream.c:(.text+0x4e5): undefined reference to `OSMutex_Init'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_Deinit':
AudioStream.c:(.text+0x5ce): undefined reference to `OSMutex_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_SetCallback':
AudioStream.c:(.text+0x6ec): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0x72f): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_DataForward_Add':
AudioStream.c:(.text+0x764): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0x7b5): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_DataForward_Remove':
AudioStream.c:(.text+0x83a): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0x87e): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: AudioStream.c:(.text+0x8d5): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_DataForward_RemoveAll':
AudioStream.c:(.text+0x8fe): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0x946): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudioStream.c.o): in function `AudioDrv_WriteData':
AudioStream.c:(.text+0x9c6): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudioStream.c:(.text+0xa06): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OSS_Start':
AudDrv_OSS.c:(.text+0x2ec): undefined reference to `OSSignal_Reset'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x2ff): undefined reference to `OSThread_Init'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x327): undefined reference to `OSSignal_Signal'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OSS_SetCallback':
AudDrv_OSS.c:(.text+0x43c): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x457): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OssThread':
AudDrv_OSS.c:(.text+0x479): undefined reference to `OSSignal_Wait'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x491): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x4c9): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x4f5): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OSS_Stop':
AudDrv_OSS.c:(.text+0x5dd): undefined reference to `OSThread_Join'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x5e6): undefined reference to `OSThread_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OSS_Destroy':
AudDrv_OSS.c:(.text+0x646): undefined reference to `OSThread_Cancel'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x64f): undefined reference to `OSThread_Deinit'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x65d): undefined reference to `OSSignal_Deinit'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x66b): undefined reference to `OSMutex_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_OSS.c.o): in function `OSS_Create':
AudDrv_OSS.c:(.text+0x6dd): undefined reference to `OSSignal_Init'
/usr/bin/ld: AudDrv_OSS.c:(.text+0x6ea): undefined reference to `OSMutex_Init'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_Start':
AudDrv_ALSA.c:(.text+0x2ba): undefined reference to `OSSignal_Reset'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x2cd): undefined reference to `OSThread_Init'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x2f9): undefined reference to `OSSignal_Signal'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_SetCallback':
AudDrv_ALSA.c:(.text+0x38c): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x3a7): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `AlsaThread':
AudDrv_ALSA.c:(.text+0x3cc): undefined reference to `OSSignal_Wait'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x3f9): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x465): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_Stop':
AudDrv_ALSA.c:(.text+0x67d): undefined reference to `OSThread_Join'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x686): undefined reference to `OSThread_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_Destroy':
AudDrv_ALSA.c:(.text+0x706): undefined reference to `OSThread_Cancel'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x70f): undefined reference to `OSThread_Deinit'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x71d): undefined reference to `OSSignal_Deinit'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x72b): undefined reference to `OSMutex_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_Create':
AudDrv_ALSA.c:(.text+0x792): undefined reference to `OSSignal_Init'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x79f): undefined reference to `OSMutex_Init'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_ALSA.c.o): in function `ALSA_WriteData':
AudDrv_ALSA.c:(.text+0x81a): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x84d): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: AudDrv_ALSA.c:(.text+0x88a): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Start':
AudDrv_Pulse.c:(.text+0x18e): undefined reference to `pa_simple_new'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x1a4): undefined reference to `OSSignal_Reset'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x1b7): undefined reference to `OSThread_Init'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x1db): undefined reference to `OSSignal_Signal'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x223): undefined reference to `pa_simple_free'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_SetCallback':
AudDrv_Pulse.c:(.text+0x26c): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x287): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `PulseThread':
AudDrv_Pulse.c:(.text+0x2a9): undefined reference to `OSSignal_Wait'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x2c1): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x2f3): undefined reference to `pa_simple_write'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x2fc): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x325): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_GetLatency':
AudDrv_Pulse.c:(.text+0x34b): undefined reference to `pa_simple_get_latency'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_WriteData':
AudDrv_Pulse.c:(.text+0x3f8): undefined reference to `pa_simple_write'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Stop':
AudDrv_Pulse.c:(.text+0x43d): undefined reference to `OSThread_Join'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x446): undefined reference to `OSThread_Deinit'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x468): undefined reference to `pa_simple_free'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Destroy':
AudDrv_Pulse.c:(.text+0x496): undefined reference to `OSThread_Cancel'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x49f): undefined reference to `OSThread_Deinit'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x4ad): undefined reference to `OSSignal_Deinit'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x4bb): undefined reference to `OSMutex_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Create':
AudDrv_Pulse.c:(.text+0x542): undefined reference to `OSSignal_Init'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x54f): undefined reference to `OSMutex_Init'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `LibAO_Start':
AudDrv_libao.c:(.text+0x182): undefined reference to `OSSignal_Reset'
/usr/bin/ld: AudDrv_libao.c:(.text+0x195): undefined reference to `OSThread_Init'
/usr/bin/ld: AudDrv_libao.c:(.text+0x1b9): undefined reference to `OSSignal_Signal'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `LibAO_SetCallback':
AudDrv_libao.c:(.text+0x22c): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_libao.c:(.text+0x247): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `AoThread':
AudDrv_libao.c:(.text+0x269): undefined reference to `OSSignal_Wait'
/usr/bin/ld: AudDrv_libao.c:(.text+0x281): undefined reference to `OSMutex_Lock'
/usr/bin/ld: AudDrv_libao.c:(.text+0x2ba): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: AudDrv_libao.c:(.text+0x2e5): undefined reference to `OSMutex_Unlock'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `LibAO_Stop':
AudDrv_libao.c:(.text+0x42d): undefined reference to `OSThread_Join'
/usr/bin/ld: AudDrv_libao.c:(.text+0x436): undefined reference to `OSThread_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `LibAO_Destroy':
AudDrv_libao.c:(.text+0x496): undefined reference to `OSThread_Cancel'
/usr/bin/ld: AudDrv_libao.c:(.text+0x49f): undefined reference to `OSThread_Deinit'
/usr/bin/ld: AudDrv_libao.c:(.text+0x4ad): undefined reference to `OSSignal_Deinit'
/usr/bin/ld: AudDrv_libao.c:(.text+0x4bb): undefined reference to `OSMutex_Deinit'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_libao.c.o): in function `LibAO_Create':
AudDrv_libao.c:(.text+0x522): undefined reference to `OSSignal_Init'
/usr/bin/ld: AudDrv_libao.c:(.text+0x52f): undefined reference to `OSMutex_Init'
collect2: error: ld returned 1 exit status
make: *** [Makefile:121: smpsplay] Error 1
ValleyBell commented 4 years ago

Ah, yeah. Sorry, I forgot to update the Makefile when updating the libvgm reference.

https://github.com/ValleyBell/SMPSPlay/blob/9e002e743c8a1bf077437fc684b7f7b12b6d95c2/Makefile#L92 There it needs to link against $(LIBPATH)/libvgm-utils.a as well. I'll push a fix later.

kargaroc commented 4 years ago

That doesn't actually help out when I do that

ValleyBell commented 4 years ago

I finally found time to try it out on Linux ... and the solution above worked just fine. Can you elaborate on what's going when after adding libvgm-utils.a to the LIBS variable?

kargaroc commented 4 years ago
gcc obj/Engine/dac.o obj/Engine/necpcm.o obj/Engine/smps.o obj/Engine/smps_commands.o obj/Engine/smps_drums.o obj/Engine/smps_extra.o obj/ini_lib.o obj/loader_data.o obj/loader_def.o obj/loader_ini.o obj/loader_smps.o obj/main.o obj/Sound.o obj/vgmwrite.o libs/install/lib/libvgm-audio.a libs/install/lib/libvgm-utils.a libs/install/lib/libvgm-emu.a -lm -lrt -pthread -lasound -lao -o smpsplay
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Start':
AudDrv_Pulse.c:(.text+0x18e): undefined reference to `pa_simple_new'
/usr/bin/ld: AudDrv_Pulse.c:(.text+0x223): undefined reference to `pa_simple_free'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `PulseThread':
AudDrv_Pulse.c:(.text+0x2f3): undefined reference to `pa_simple_write'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_GetLatency':
AudDrv_Pulse.c:(.text+0x34b): undefined reference to `pa_simple_get_latency'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_WriteData':
AudDrv_Pulse.c:(.text+0x3f8): undefined reference to `pa_simple_write'
/usr/bin/ld: libs/install/lib/libvgm-audio.a(AudDrv_Pulse.c.o): in function `Pulse_Stop':
AudDrv_Pulse.c:(.text+0x468): undefined reference to `pa_simple_free'
collect2: error: ld returned 1 exit status
make: *** [Makefile:122: smpsplay] Error 1
ValleyBell commented 4 years ago

Ohh, I see you compiled libvgm with PulseAudio support. I'm afraid the Makefile for SMPSPlay doesn't take that into account. (libvgm didn't support PA when SMPSPlay was written and I don't have PA installed on my system.)

You will have to go into libs/build_GCC/libvgm/, run ccmake and turn the option AUDIODRV_PULSE off. Then regenerate the project and run make install in order to rebuild libvgm without PulseAudio. After that you should be able to build SMPSPlay.

(If you want PulseAudio support, you need to modify the Makefile to link -lpulse -lpulse-simple instead of rebuilding libvgm.)

Sorry for all the hassle. I'm afraid libvgm got a bit too complex for the simple Makefile that SMPSPlay uses currently.

ValleyBell commented 3 years ago

fixed with fc33595a695f880311d3d793f9ac7e12ed7e65cd

ValleyBell commented 3 years ago

As of 27f2a000053a5c4bb9204cd39ce162e1d78dffdb there is now a CMake project file. Thus you now can build libvgm with or without PulseAudio support and use the CMake project to build SMPSPlay and it should link properly.