SDL link error

Post Reply
nebiun
Posts: 91
Joined: Sat Dec 28, 2013 2:42 pm

SDL link error

Post by nebiun » Sun Mar 20, 2022 5:14 pm

Hi,
I try compile OpenXcom for Wii. It uses SDL lib.

I have these errors:

c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_init':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:12: undefined reference to `ModPlug_GetSettings'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:62: undefined reference to `ModPlug_SetSettings'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_setvolume':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:74: undefined reference to `ModPlug_SetMasterVolume'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_new_RW':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:97: undefined reference to `ModPlug_Load'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_play':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:124: undefined reference to `ModPlug_Seek'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_playAudio':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:142: undefined reference to `ModPlug_Read'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:189: undefined reference to `ModPlug_Read'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_delete':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:229: undefined reference to `ModPlug_Unload'
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/11.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/wii/lib\libSDL_mixer.a(music_modplug.o): in function `modplug_jump_to_time':
/home/davem/projects/devkitpro/pacman-packages/wii/SDL_mixer/src/SDL_mixer-1.2.12/music_modplug.c:236: undefined reference to `ModPlug_Seek'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitPPC/wii_rules:30: /e/WIIdev/OpenXcom-master/OpenXcom-master.elf] Errore 1
make: *** [Makefile:108: build] Errore 2


Can someone help me?
Thanks.

User avatar
HudsonBr
Posts: 29
Joined: Wed May 05, 2021 8:15 pm

Re: SDL link error

Post by HudsonBr » Wed Mar 30, 2022 10:37 pm

Hello,
as you said OpenXcom uses SDL, but uses also other modules of SDL
SDL (libsdl1.2)
SDL_mixer (libsdl-mixer1.2)
SDL_gfx (libsdl-gfx1.2), version 2.0.22 or later
SDL_image (libsdl-image1.2)

Do you have all of them in your env?
..::Game Developer::..

nebiun
Posts: 91
Joined: Sat Dec 28, 2013 2:42 pm

Re: SDL link error

Post by nebiun » Sun Apr 03, 2022 2:07 pm

HudsonBr wrote: Wed Mar 30, 2022 10:37 pm Hello,
as you said OpenXcom uses SDL, but uses also other modules of SDL
SDL (libsdl1.2)
SDL_mixer (libsdl-mixer1.2)
SDL_gfx (libsdl-gfx1.2), version 2.0.22 or later
SDL_image (libsdl-image1.2)

Do you have all of them in your env?
Hi, HudsonBr.
Yes, I added all libraries to makefile.
But I think that errors are due to wrong SDL_mixer archive: ModPlug_* functions seem added in SDL2, not in SDL1.2 but SDL_mixer.a (1.2.12) referred them.
As you can see, errors is related to undefined functions required by source music_modplug.c, in libSDL_mixer.a and not related to OpenXcom sources.

However, this is my Makefile. Can someone help me to found the error?
Thanks in advance.

Code: Select all

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/wii_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET		:=	$(notdir $(CURDIR))
BUILD		:=	build
SOURCES		:=	src src/Basescape src/Geoscape src/Mod src/Battlescape src/Interface src/Savegame src/Engine src/Menu src/Ufopaedia src/Engine/Adlib src/Engine/Scalers
DATA		:=	data  
INCLUDES	:=	include

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

CFLAGS	= -g -O2 -Wall $(MACHDEP) $(INCLUDE) `$(PREFIX)pkg-config --cflags sdl` `freetype-config --cflags`
CXXFLAGS	=	$(CFLAGS) -D__NO_OPENGL -D__WII__

LDFLAGS	=	-g $(MACHDEP) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lSDL_mixer -lSDL_image -lSDL_gfx `$(PREFIX)pkg-config --libs sdl` \
				-lmad -lmpg123 -lyaml-cpp -ljpeg -lpng `freetype-config --libs` \
				-lvorbisidec -logg -lz -lfat -lwiiuse -lbte -lwiikeyboard -logc -lm
				
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:= $(PORTLIBS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT	:=	$(CURDIR)/$(TARGET)

export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
					$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR	:=	$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
	export LD	:=	$(CC)
else
	export LD	:=	$(CXX)
endif

export OFILES_BIN	:=	$(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)

export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
INCLUDEDIR := $(foreach dir,$(LIBDIRS),$(dir $(wildcard $(dir)/include/*/)))
export INCLUDE	:=	$(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
					$(foreach dir,$(INCLUDEDIR),-I$(dir)) \
					-I$(CURDIR)/include \
					-I$(CURDIR)/$(BUILD) \
					-I$(LIBOGC_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
                    $(foreach dir,$(PORTLIBS),-L$(dir)/lib) \
					-L$(LIBOGC_LIB)

export OUTPUT	:=	$(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
	@[ -d $@ ] || mkdir -p $@
	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo clean ...
	@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
	wiiload $(TARGET).dol


#---------------------------------------------------------------------------------
else

DEPENDS	:=	$(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o	:	%.jpg
#---------------------------------------------------------------------------------
	@echo $(notdir $<)
	$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o	:	%.png
#---------------------------------------------------------------------------------
	@echo $(notdir $<)
	$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .ttf extension
#---------------------------------------------------------------------------------
%.ttf.o	:	%.ttf
#---------------------------------------------------------------------------------
	@echo $(notdir $<)
	$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

User avatar
HudsonBr
Posts: 29
Joined: Wed May 05, 2021 8:15 pm

Re: SDL link error

Post by HudsonBr » Mon Sep 05, 2022 9:48 pm

Hello
were you able to solve the problem?
i am now with a link SDL problem too

Code: Select all

../lib/gcc/powerpc-eabi/12.1.0/../../../../powerpc-eabi/lib/crtmain.o: in function `__crtmain':
crtmain.c:(.text.__crtmain+0x3c): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitPPC/gamecube_rules:30: /c/projects/Ngc-sdl-template/ngc.elf] Error 1
make: *** [Makefile:103: build] Error 2
any clue ?
regards.
..::Game Developer::..

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest