SDL: Linker Errors when using SDL_mixer
Posted: Tue Apr 14, 2020 4:26 am
Hello, I'm trying my hand at porting to the 3ds, specifically Chocolate Doom, and I've gotten a great deal through it when I came across an issue while trying to link the code. Any functions related to SDL_mixer result in an "undefined reference to x" error. I have attatched the relevant parts of my makefile and here is the log below (cut down since I've been marked as spam when trying to post this), along with some unrelated linker errors I have yet to fix. Thank you for any help!
Code: Select all
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := src opl src/doom src/SDL2
DATA := data
INCLUDES := src textscreen pcsound opl codeblocks src/SDL2
GRAPHICS := gfx
GFXBUILD := $(BUILD)
ROMFS := romfs
#GFXBUILD := $(ROMFS)/gfx
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Wall -O2 -mword-relocations \
-fomit-frame-pointer -ffunction-sections \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL_mixer -lSDL -lcitro3d -lctru -lm
Code: Select all
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: C:/devkitPro/portlibs/3ds/lib\libSDL_mixer.a(mixer.o): in function `mix_channels':
mixer.c:(.text.mix_channels+0x18c): undefined reference to `SDL_MixAudio'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: mixer.c:(.text.mix_channels+0x250): undefined reference to `SDL_MixAudio'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: C:/devkitPro/portlibs/3ds/lib\libSDL_mixer.a(music.o): in function `Mix_LoadMUS':
music.c:(.text.Mix_LoadMUS+0xc): undefined reference to `SDL_RWFromFile'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: music.c:(.text.Mix_LoadMUS+0x160): undefined reference to `SDL_FreeRW'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: C:/devkitPro/portlibs/3ds/lib\libSDL_mixer.a(wavestream.o): in function `WAVStream_LoadSong_RW':
wavestream.c:(.text.WAVStream_LoadSong_RW+0x6c): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x78): undefined reference to `SDL_ReadBE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x80): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0xd8): undefined reference to `SDL_ReadBE16'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0xe4): undefined reference to `SDL_ReadBE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0xf0): undefined reference to `SDL_ReadBE16'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x194): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x1a0): undefined reference to `SDL_ReadBE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x1d8): undefined reference to `SDL_ReadBE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x1e4): undefined reference to `SDL_ReadBE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x264): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x270): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x278): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x2ac): undefined reference to `SDL_ReadLE32'
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/9.1.0/../../../../arm-none-eabi/bin/ld.exe: wavestream.c:(.text.WAVStream_LoadSong_RW+0x2b8): undefined reference to `SDL_ReadLE32'