I'm working on porting bochs, but I'm running across a problem when it comes to building with SDL. My error is as follows
Error
Code: Select all
/bin/sh ./libtool --mode=link psp-g++ -o bochs -g -Wall -G0 -O2 -I/usr/local/pspdev/psp/sdk/include -D_PSP_FW_VERSION=371 -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx -L/usr/local/pspdev/psp/sdk/lib -export-dynamic logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o \
iodev/libiodev.a cpu/libcpu.a memory/libmemory.a gui/libgui.a \
disasm/libdisasm.a \
fpu/libfpu.a \
`/usr/local/pspdev/psp/bin/sdl-config --cflags --libs` \
-lc -lpspuser -lm -lSDLmain -lSDL -lc -lg -lGL -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspvfpu -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspnet_resolver
psp-g++ -o bochs -g -Wall -G0 -O2 -I/usr/local/pspdev/psp/sdk/include -D_PSP_FW_VERSION=371 -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q -Wl,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -Wl,--export-dynamic -L/usr/local/pspdev/psp/sdk/lib iodev/libiodev.a cpu/libcpu.a memory/libmemory.a gui/libgui.a disasm/libdisasm.a fpu/libfpu.a -L/usr/local/pspdev/psp/lib -lSDLmain /usr/local/pspdev/psp/lib/libSDL.a /usr/local/pspdev/psp/lib/libstdc++.a -lm -lg -lGL -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspvfpu -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspnet_resolver
/usr/local/pspdev/psp/lib/libSDLmain.a(SDL_psp_main.o): In function `main':
psp/SDL_psp_main.c:76: undefined reference to `SDL_main'
collect2: ld returned 1 exit status
make: *** [bochs] Error 1
I believe it may be a problem with my makefile (seen below). I've had a look and tried many things to rectify the problem but nothing I have tried seems to have worked.
Any help at all will be appreciated.
Makefile
Code: Select all
prefix = /usr/local/pspdev/psp
exec_prefix = ${prefix}
srcdir = .
#PSP stuff to compile it
TARGET = bochs
BUILD_PRX=1
PSP_FW_VERSION=371
PSP_LARGE_MEMORY=1
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Bochs
PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
plugdir = ${exec_prefix}/lib/bochs/plugins
datarootdir = ${prefix}/share
mandir = ${datarootdir}/man
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
docdir = $(datarootdir)/doc/bochs
sharedir = $(datarootdir)/bochs
top_builddir = .
top_srcdir = $(srcdir)
DESTDIR =/home/angus
VERSION=2.4.2
VER_STRING=2.4.2-PSP
REL_STRING=Build from CVS snapshot on November 12, 2009
MAN_PAGE_1_LIST=bochs bximage bxcommit bochs-dlx
MAN_PAGE_5_LIST=bochsrc
INSTALL_LIST_SHARE=bios/BIOS-bochs-* bios/VGABIOS*
INSTALL_LIST_BIN=bochs
INSTALL_LIST_BIN_OPTIONAL=bochsdbg
CP=cp
CAT=cat
RM=rm
MV=mv
LN_S=ln -sf
#DLXLINUX_TAR=dlxlinux4.tar.gz
#DLXLINUX_TAR_URL=http://bochs.sourceforge.net/guestos/$(DLXLINUX_TAR)
#DLXLINUX_ROMFILE=BIOS-bochs-latest
GUNZIP=gunzip
WGET=wget
SED=sed
MKDIR=mkdir
RMDIR=rmdir
TAR=tar
CHMOD=chmod
GZIP_BIN=gzip -9
GUNZIP=gunzip
ZIP=zip
UNIX2DOS=unix2dos
LIBTOOL=$(SHELL) $(top_builddir)/libtool
DLLTOOL=dlltool
RC_CMD=
.SUFFIXES: .cc
srcdir = .
SHELL = /bin/sh
CC = psp-gcc
CXX = psp-g++
AS = psp-gcc
LD = psp-gcc
AR = psp-ar
RANLIB = psp-ranlib
STRIP = psp-strip
MKSFO = mksfo
PACK_PBP = pack-pbp
FIXUP = psp-fixup-imports
PSPSDK_LIBC_LIB = -lc
INCDIR =$(PSPSDK)/include
CFLAGS = -g -Wall -G0 -O2 -I$(INCDIR)
CXXFLAGS = -g -Wall -G0 -O2 -I$(INCDIR)
#Check for slim memory flag
ifeq ($(PSP_LARGE_MEMORY),1)
MKSFO = mksfoex -d MEMSIZE=1
endif
#Set firmware version(apparantly?)
CFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION) $(SHELL $(PSPBIN)/sdl-config --cflags)
CXXFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION) $(SHELL $(PSPBIN)/sdl-config --cflags)
#must be above the prx check
LDFLAGS = -L/usr/local/pspdev/psp/sdk/lib
#Check if we want PRX (yarp)
ifeq ($(BUILD_PRX),1)
LDFLAGS := $(addprefix -L,$(LIBDIR)) -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS)
EXTRA_CLEAN += $(TARGET).elf
# Setup default exports if needed
ifdef PRX_EXPORTS
EXPORT_OBJ=$(patsubst %.exp,%.o,$(PRX_EXPORTS))
EXTRA_CLEAN += $(EXPORT_OBJ)
else
EXPORT_OBJ=$(PSPSDK)/lib/prxexports.o
endif
else
LDFLAGS := $(addprefix -L,$(LIBDIR)) $(LDFLAGS)
endif
LIBS = -lc -lpspuser -lm -lSDLmain -lSDL -lc -lg -lGL -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspvfpu -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpspnet_resolver $(SHELL $(PSPBIN)/sdl-config --libs)
GUI_LINK_OPTS_SDL = `/usr/local/pspdev/psp/bin/sdl-config --cflags --libs`
GUI_LINK_OPTS = $(GUI_LINK_OPTS_SDL)
#Start eboot flags
PSP_EBOOT_TITLE = $(TARGET)
PSP_EBOOT_SFO = PARAM.SFO
PSP_EBOOT = EBOOT.PBP
#more snazzy prx stuff
ifeq ($(BUILD_PRX),1)
ifneq ($(TARGET_LIB),)
$(error TARGET_LIB should not be defined when building a prx)
else
FINAL_TARGET = $(TARGET).prx
endif
else
ifneq ($(TARGET_LIB),)
FINAL_TARGET = $(TARGET_LIB)
else
FINAL_TARGET = $(TARGET).elf
endif
endif
#end eboot flags
CFLAGS_CONSOLE = -g -G0 -O2 $(MCH_CFLAGS) $(FLA_FLAGS) -test
CXXFLAGS_CONSOLE = -g -G0 -O2 $(MCH_CFLAGS) $(FLA_FLAGS) -test
BXIMAGE_LINK_OPTS =
BX_INCDIRS = -I. -I$(srcdir)/. -Iinstrument/stubs -I$(srcdir)/instrument/stubs -I,$(INCDIR)
NONINLINE_OBJS = \
logio.o \
main.o \
config.o \
load32bitOShack.o \
pc_system.o \
osdep.o \
plugin.o \
crc.o
EXTERN_ENVIRONMENT_OBJS = \
main.o \
config.o \
load32bitOShack.o \
pc_system.o
DEBUGGER_LIB = bx_debug/libdebug.a
DISASM_LIB = disasm/libdisasm.a
INSTRUMENT_LIB = instrument/stubs/libinstrument.a
FPU_LIB = fpu/libfpu.a
READLINE_LIB =
EXTRA_LINK_OPTS =
GDBSTUB_OBJS = gdbstub.o
BX_OBJS = $(NONINLINE_OBJS)
BX_INCLUDES = bochs.h config.h osdep.h
.cc.o:
$(CXX) -c $(BX_INCDIRS) $(CXXFLAGS) $< -o $@
.c.o:
$(CC) -c $(BX_INCDIRS) $(CFLAGS) $(FPU_FLAGS) $< -o $@
all: bochs
bochs: iodev/libiodev.a \
cpu/libcpu.a memory/libmemory.a gui/libgui.a \
$(DISASM_LIB) $(BX_OBJS) \
$(SIMX86_OBJS) $(FPU_LIB)
$(LIBTOOL) --mode=link $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -export-dynamic $(BX_OBJS) $(SIMX86_OBJS) \
iodev/libiodev.a cpu/libcpu.a memory/libmemory.a gui/libgui.a \
$(DISASM_LIB) \
$(FPU_LIB) \
$(GUI_LINK_OPTS) \
$(MCH_LINK_FLAGS) \
$(SIMX86_LINK_FLAGS) \
$(READLINE_LIB) \
$(EXTRA_LINK_OPTS) \
$(LIBS)
bochs_plugins:
cd gui && \
$(MAKE) plugins
echo done
cd iodev && \
$(MAKE) plugins
echo done
bxcommit: misc/bxcommit.o
$(LIBTOOL) --mode=link $(CXX) -o $@ $(CXXFLAGS_CONSOLE) $(LDFLAGS) misc/bxcommit.o
niclist: misc/niclist.o
$(LIBTOOL) --mode=link $(CXX) -o $@ $(CXXFLAGS_CONSOLE) $(LDFLAGS) misc/niclist.o
misc/bxcommit.o: $(srcdir)/misc/bxcommit.c $(srcdir)/iodev/hdimage.h
$(CC) -c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/bxcommit.c -o $@
misc/niclist.o: $(srcdir)/misc/niclist.c
$(CC) -c $(BX_INCDIRS) $(CFLAGS_CONSOLE) $(srcdir)/misc/niclist.c -o $@
$(BX_OBJS): $(BX_INCLUDES)
# cannot use -C option to be compatible with Microsoft nmake
iodev/libiodev.a::
cd iodev && \
$(MAKE) $(MDEFINES) libiodev.a
echo done
bx_debug/libdebug.a::
cd bx_debug && \
$(MAKE) $(MDEFINES) libdebug.a
echo done
cpu/libcpu.a::
cd cpu && \
$(MAKE) $(MDEFINES) libcpu.a
echo done
memory/libmemory.a::
cd memory && \
$(MAKE) $(MDEFINES) libmemory.a
echo done
gui/libgui.a::
cd gui && \
$(MAKE) $(MDEFINES) libgui.a
echo done
disasm/libdisasm.a::
cd disasm && \
$(MAKE) $(MDEFINES) libdisasm.a
echo done
instrument/stubs/libinstrument.a::
cd instrument/stubs && \
$(MAKE) $(MDEFINES) libinstrument.a
echo done
fpu/libfpu.a::
cd fpu && \
$(MAKE) $(MDEFINES) libfpu.a
echo done
libbochs.a:
-rm -f libbochs.a
ar rv libbochs.a $(EXTERN_ENVIRONMENT_OBJS)
$(RANLIB) libbochs.a
libbochs_cpu.a: $(BX_OBJS)
-rm -f libbochs_cpu.a
ar rv libbochs_cpu.a $(BX_OBJS)
$(RANLIB) libbochs_cpu.a
tar:
NAME=`pwd|$(SED) 's/.*\///'`; (cd ..; $(RM) -f $$NAME.zip; tar cf - $$NAME | $(GZIP_BIN) > $$NAME.tar.gz); ls -l ../$$NAME.tar.gz
zip:
NAME=`pwd|$(SED) 's/.*\///'`; (cd ..; $(RM) -f $$NAME-msvc-src.zip; $(ZIP) $$NAME-msvc-src.zip -r $$NAME -x \*CVS\* -x \*.cvsignore ); ls -l ../$$NAME-msvc-src.zip
clean:
rm -f *.o
rm -f *.a
rm -f bochs
rm -f bochs.exe
rm -f bximage
rm -f bximage.exe
rm -f bxcommit
rm -f bxcommit.exe
rm -f niclist
rm -f niclist.exe
rm -f bochs.out
rm -f bochsout.txt
rm -f bochs.exp
rm -f bochs.def
rm -f bochs.scpt
rm -f -rf bochs.app
rm -f -rf .libs
rm -f .win32_dll_plugin_target
all-clean: clean
cd iodev && \
$(MAKE) clean
echo done
cd bx_debug && \
$(MAKE) clean
echo done
cd cpu && \
$(MAKE) clean
echo done
cd memory && \
$(MAKE) clean
echo done
cd gui && \
$(MAKE) clean
echo done
cd disasm && \
$(MAKE) clean
echo done
cd instrument/stubs && \
$(MAKE) clean
echo done
cd misc && \
$(MAKE) clean
echo done
cd fpu && \
$(MAKE) clean
echo done
cd doc/docbook && \
$(MAKE) clean
echo done
cd host/linux/pcidev && \
$(MAKE) clean
echo done
###########################################
# dependencies generated by
# gcc -MM -I. -Iinstrument/stubs *.cc | sed -e 's/\.cc/.cc/g' -e 's,cpu/,cpu/,g'
###########################################
config.o: config.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h \
iodev/iodev.h bochs.h iodev/vga.h
crc.o: crc.cc config.h
gdbstub.o: gdbstub.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h \
cpu/cpu.h cpu/crregs.h cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h \
cpu/icache.h cpu/apic.h cpu/i387.h fpu/softfloat.h fpu/tag_w.h \
fpu/status_w.h fpu/control_w.h cpu/xmm.h cpu/stack.h iodev/iodev.h \
bochs.h iodev/vga.h
load32bitOShack.o: load32bitOShack.cc bochs.h config.h osdep.h \
bx_debug/debug.h config.h osdep.h bxversion.h gui/siminterface.h \
memory/memory.h pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h \
instrument/stubs/instrument.h cpu/cpu.h cpu/crregs.h cpu/descriptor.h \
cpu/instr.h cpu/lazy_flags.h cpu/icache.h cpu/apic.h cpu/i387.h \
fpu/softfloat.h fpu/tag_w.h fpu/status_w.h fpu/control_w.h cpu/xmm.h \
iodev/iodev.h bochs.h iodev/vga.h
logio.o: logio.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h \
cpu/cpu.h cpu/crregs.h cpu/descriptor.h cpu/instr.h cpu/lazy_flags.h \
cpu/icache.h cpu/apic.h cpu/i387.h fpu/softfloat.h fpu/tag_w.h \
fpu/status_w.h fpu/control_w.h cpu/xmm.h iodev/iodev.h bochs.h \
iodev/vga.h
main.o: main.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h \
gui/textconfig.h cpu/cpu.h cpu/crregs.h cpu/descriptor.h cpu/instr.h \
cpu/lazy_flags.h cpu/icache.h cpu/apic.h cpu/i387.h fpu/softfloat.h \
fpu/tag_w.h fpu/status_w.h fpu/control_w.h cpu/xmm.h iodev/iodev.h \
bochs.h iodev/vga.h
osdep.o: osdep.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h
pc_system.o: pc_system.cc bochs.h config.h osdep.h bx_debug/debug.h \
config.h osdep.h bxversion.h gui/siminterface.h memory/memory.h \
pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h \
instrument/stubs/instrument.h cpu/cpu.h cpu/crregs.h cpu/descriptor.h \
cpu/instr.h cpu/lazy_flags.h cpu/icache.h cpu/apic.h cpu/i387.h \
fpu/softfloat.h fpu/tag_w.h fpu/status_w.h fpu/control_w.h cpu/xmm.h \
iodev/iodev.h bochs.h iodev/vga.h
plex86-interface.o: plex86-interface.cc bochs.h config.h osdep.h \
bx_debug/debug.h config.h osdep.h bxversion.h gui/siminterface.h \
memory/memory.h pc_system.h plugin.h extplugin.h ltdl.h gui/gui.h \
instrument/stubs/instrument.h plex86-interface.h plex86/plex86.h \
plex86/descriptor.h
plugin.o: plugin.cc bochs.h config.h osdep.h bx_debug/debug.h config.h \
osdep.h bxversion.h gui/siminterface.h memory/memory.h pc_system.h \
plugin.h extplugin.h ltdl.h gui/gui.h instrument/stubs/instrument.h \
iodev/iodev.h bochs.h iodev/vga.h
#psp stuff
kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
mkdir -p "$(TARGET)"
$(STRIP) $(TARGET).elf -o $(TARGET)/$(PSP_EBOOT)
mkdir -p "$(TARGET)%"
$(PACK_PBP) "$(TARGET)%/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
SCEkxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
mkdir -p "__SCE__$(TARGET)"
$(STRIP) $(TARGET).elf -o __SCE__$(TARGET)/$(PSP_EBOOT)
mkdir -p "%__SCE__$(TARGET)"
$(PACK_PBP) "%__SCE__$(TARGET)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
$(LINK.c) $^ $(LIBS) -o $@
$(FIXUP) $@
$(TARGET_LIB): $(OBJS)
$(AR) cru $@ $(OBJS)
$(RANLIB) $@
$(PSP_EBOOT_SFO):
$(MKSFO) '$(PSP_EBOOT_TITLE)' $@
ifeq ($(BUILD_PRX),1)
$(PSP_EBOOT): $(TARGET).prx $(PSP_EBOOT_SFO)
$(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) $(TARGET).prx $(PSP_EBOOT_PSAR)
else
$(PSP_EBOOT): $(TARGET).elf $(PSP_EBOOT_SFO)
$(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf
$(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) $(TARGET)_strip.elf $(PSP_EBOOT_PSAR)
-rm -f $(TARGET)_strip.elf
endif
%.prx: %.elf
psp-prxgen $< $@
%.c: %.exp
psp-build-exports -b $< > $@
##end psp stuff