Open2x Toolchain - Compilation Problems


noldor73

Still Fresh
Joined
Jul 19, 2007
Messages
49
Location
Italy
Website
Visit site
Hi guys :)
Some weaks ago I have started to build my own enchanched version of uae4allgp2x. I'have tried many (unstable) sdk solution on my win xp pc desktop then finally, someday ago, I have installed the open2x toolchain and extra libraries. Apparently no problem to compile the emulator with my work(added keys remapping, choose from 512k 1 mega chip ram, autofire, optimized the gui code, config file for every game, fast folders scan browser, emulating 4 drives) but now has come the problems:
1) I'm now to changing the gui appearence and when I try to use boxRGBA from SDL_gfxPrimitives this error appears when linking:SDL_gfxPrimitives.c: undefined reference to 'cos' and other errors like this. (same error if I try to use ttf library... undefined reference to 'pow'). I think it is a trouble with the math library. I have checked on google then searched the libm.a on my toolchain and it is placed on C:\cygwin\opt\open2x\gcc-4.1.1-glibc-2.3.6\lib. So what is my fault?

2) I'm trying to integrate some picodrive routines: I have copied the 2 files (asmutils.h and asmutils.s) in the uae4all emu folder... added the asmutis.o to the makefile project then tried to call, for example, spend_cycles(defined in asmutils.h). When trying to compiling the uae I will get the same error like 1) point: undefined reference to spenc_cycles(int) ^___^.

What I need to compile it?
I'm sorry ... I'm a newbie whit make and c related :)
I hope you can help me because when I fix this issues I can share my unofficial uae4allgp2x version :)
Thanks.

Here the makefile from original notaz version (I have changed few things)
CODE


CROSS = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-
SDL_BASE = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/
MORE_CFLAGS += -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/

NAME = uae4all.gpe
O = o
RM = rm -f
CC = $(CROSS)gcc
CXX = $(CROSS)g++
STRIP = $(CROSS)strip
AS = $(CROSS)as

PROG = $(NAME)

all: $(PROG)

CYCLONE_CORE=1
ifndef CYCLONE_CORE
FAME_CORE=1
FAME_CORE_C=1
endif

DEFAULT_CFLAGS = `$(SDL_BASE)sdl-config --cflags`
#LDFLAGS = `$(SDL_BASE)sdl-config --libs` -lSDL_mixer -lsmpeg -lstdc++ -lSDL -lmikmod -lm -lz -static
LDFLAGS = `$(SDL_BASE)sdl-config --libs` -lSDL -lz -static -lSDL_gfx

MORE_CFLAGS += -DGP2X
#-Wall -fprofile-use

MORE_CFLAGS += -Isrc -Isrc/gp2x -Isrc/menu -Isrc/include -Isrc/gp2x/menu -Isrc/vkbd -fomit-frame-pointer -Wno-unused -Wno-format -DUSE_SDL -DGCCCONSTFUNC="__attribute__((const))" -DUSE_UNDERSCORE -fno-exceptions -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS -DSHM_SUPPORT_LINKS=0 -DOS_WITHOUT_MEMORY_MANAGEMENT -DVKBD_ALWAYS
#-DMENU_MUSIC

MORE_CFLAGS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\"

MORE_CFLAGS += -mcpu=arm920 -mtune=arm920t -msoft-float -ffast-math
ifndef DEBUG
MORE_CFLAGS += -O3
MORE_CFLAGS += -fstrict-aliasing -mstructure-size-boundary=32 -fexpensive-optimizations
MORE_CFLAGS += -fweb -frename-registers -fomit-frame-pointer
MORE_CFLAGS += -falign-functions=32 -falign-loops -falign-labels -falign-jumps
MORE_CFLAGS += -finline -finline-functions -fno-builtin
else
MORE_CFLAGS += -ggdb
endif

ASFLAGS += -mfloat-abi=soft -mcpu=arm920t

#MORE_CFLAGS+= -DUSE_AUTOCONFIG
#MORE_CFLAGS+= -DUAE_CONSOLE

MORE_CFLAGS+= -DUSE_ZFILE

#MORE_CFLAGS+= -DUAE4ALL_NO_USE_RESTRICT

#MORE_CFLAGS+= -DNO_SOUND
#MORE_CFLAGS+= -DNO_THREADS

#MORE_CFLAGS+= -DDEBUG_TIMESLICE

MORE_CFLAGS+= -DFAME_INTERRUPTS_PATCH
#MORE_CFLAGS+= -DFAME_INTERRUPTS_SECURE_PATCH

# Turrican3 becomes unstable if this is not enabled
MORE_CFLAGS+= -DSAFE_MEMORY_ACCESS

#MORE_CFLAGS+= -DUAE_MEMORY_ACCESS
#MORE_CFLAGS+= -DERROR_WHEN_MEMORY_OVERRUN

#MORE_CFLAGS+= -DDEBUG_UAE4ALL
#MORE_CFLAGS+= -DDEBUG_UAE4ALL_FFLUSH
#MORE_CFLAGS+= -DDEBUG_M68K
#MORE_CFLAGS+= -DDEBUG_INTERRUPTS
#MORE_CFLAGS+= -DDEBUG_CIA
##MORE_CFLAGS+= -DDEBUG_SOUND
#MORE_CFLAGS+= -DDEBUG_MEMORY
##MORE_CFLAGS+= -DDEBUG_MAPPINGS
#MORE_CFLAGS+= -DDEBUG_DISK
#MORE_CFLAGS+= -DDEBUG_CUSTOM
##MORE_CFLAGS+= -DDEBUG_EVENTS
##MORE_CFLAGS+= -DDEBUG_GFX -DDEBUG_BLITTER
##MORE_CFLAGS+= -DDEBUG_FRAMERATE
##MORE_CFLAGS+= -DAUTO_FRAMERATE=1400
##MORE_CFLAGS+= -DMAX_AUTO_FRAMERATE=4400
##MORE_CFLAGS+= -DAUTO_FRAMERATE_SOUND
#MORE_CFLAGS+= -DSTART_DEBUG=11554
#MORE_CFLAGS+= -DMAX_AUTOEVENTS=11560
#MORE_CFLAGS+= -DAUTO_RUN


#MORE_CFLAGS+= -DPROFILER_UAE4ALL

CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)

OBJS = \
src/audio.o \
src/autoconf.o \
src/blitfunc.o \
src/blittable.o \
src/blitter.o \
src/cia.o \
src/savedisk.o \
src/compiler.o \
src/custom.o \
src/disk.o \
src/drawing.o \
src/ersatz.o \
src/gfxutil.o \
src/keybuf.o \
src/main.o \
src/md-support.o \
src/memory.o \
src/missing.o \
src/gui.o \
src/od-joy.o \
src/sound_gp2x.o \
src/sdlgfx.o \
src/writelog.o \
src/zfile.o \
src/menu/fade.o \
src/vkbd/vkbd.o \
src/gp2x/memcpy.o \
src/gp2x/memset.o \
src/gp2x/gp2x.o \
src/gp2x/inputmode.o \
src/gp2x/volumecontrol.o \
src/gp2x/menu/asmutils.o\
src/gp2x/menu/menu.o \
src/gp2x/menu/menu_fileinfo.o \
src/gp2x/menu/menu_load.o \
src/gp2x/menu/menu_main.o \
src/gp2x/menu/menu_overclock.o \
src/gp2x/menu/menu_misc.o \
src/gp2x/cpuspeed/cpu_speed.o



ifdef FAME_CORE
ifdef FAME_CORE_C
CFLAGS+=-DUSE_FAME_CORE -DUSE_FAME_CORE_C
src/m68k/fame/famec.o: src/m68k/fame/famec.cpp
OBJS += src/m68k/fame/famec.o
else
CFLAGS+=-DUSE_FAME_CORE
src/m68k/fame/fame.o: src/m68k/fame/fame.asm
nasm -f elf src/m68k/fame/fame.asm
OBJS += src/m68k/fame/fame.o
endif
OBJS += src/m68k/fame/m68k_intrf.o
OBJS += src/m68k/m68k_cmn_intrf.o
else # FAME_CORE
ifdef CYCLONE_CORE
# use all FAME hacks in uae code for Cyclone too
CFLAGS+=-DUSE_FAME_CORE
CFLAGS+=-DUSE_CYCLONE_CORE
OBJS += src/m68k/cyclone/cyclone.o
OBJS += src/m68k/m68k_cmn_intrf.o
OBJS += src/m68k/cyclone/m68k_intrf.o
# asm memhandlers
CFLAGS+=-DUSE_CYCLONE_MEMHANDLERS
OBJS += src/m68k/cyclone/memhandlers.o
else
OBJS += \
src/m68k/uae/newcpu.o \
src/m68k/uae/readcpu.o \
src/m68k/uae/cpudefs.o \
src/m68k/uae/fpp.o \
src/m68k/uae/cpustbl.o \
src/m68k/uae/cpuemu.o
endif
endif



CPPFLAGS = $(CFLAGS)

$(PROG): $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS)
ifndef DEBUG
$(STRIP) $(PROG)
endif


run: $(PROG)
./$(PROG)

clean:
$(RM) $(PROG) $(OBJS)

up: $(PROG)
cp -v $< /mnt/gp2x/mnt/sd/emus/uae4all/
 

noldor73

Still Fresh
Joined
Jul 19, 2007
Messages
49
Location
Italy
Website
Visit site
Sphinxter said:
Since you're static one would suspect the order of things but what strikes me as odd is I don't even need to add -lm to use sdl_gfx.
The -lm line code is commented.
The makefile it is by notaz. I have added only some .o (the files created by me). I'm not an expert :°°°D. Any idea to how rewrite this makefile? :)
Thanks :)
 
Last edited by a moderator:

senquack

I feel a great disturbance in the source
Joined
Nov 1, 2006
Messages
1,167
Age
42
Location
USA
Website
Visit site
This is what I use for static linking under linux/open2x:

-static -lSDL_gfx -lSDL_image -ljpeg -lpng12 -lz -lSDL_mixer -lmikmod -lvorbisidec -lmad -lSDL \
-lpthread -lgcc -lm -lc -ldl -msoftfloat

I had a heck of a time figuring out exactly what order to place things in. What's worse? I wasted so many hours figuring out that sdl-config wasn't returning a usable order of libraries and eventually the above explicit listing of libraries is what worked.
 
Top