Help Compiling With Open2x


OrganicPanda

Still Fresh
Joined
Jan 6, 2008
Messages
1
Hey all,

I've tried so hard, on and off, over the past couple of weeks to get a development environment set up on Linux for my shiny new f200. Every avenue seems blocked for one reason or another so I'm asking for help. I stumbled across the open2x toolchain which i've heard is pretty good, although that was from blogs dated 2006.

right anyway so I got open2x in place at: /opt/open2x/gcc-4.1.1-glibc-2.3.6/ and I've got demo.c stolen from the wiki. how exactly do I go about compiling it? I know this may sound crazy but I cannot find a single source of information that can help me.

I've also tried using the gph compiler which seemed to work fine with no errors but i can't for the life of me figure out where it put the .gpe, if anywhere.

any help thrown my way would be great,

cheers
 
OrganicPanda said:
right anyway so I got open2x in place at: /opt/open2x/gcc-4.1.1-glibc-2.3.6/ and I've got demo.c stolen from the wiki. how exactly do I go about compiling it?
Short answer:

CODE

/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -D_REENTRANT -O2 -funroll-loops -c -o demo.o demo.c
/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -static -o demo.gpe demo.o -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -Wl,-rpath,/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -lSDL -lpthread -lm -ldl



Long answer. Use a Makefile like this:

CODE

#######Your application: change in each project#########
# The name of your application
PROG_NAME = demo
# if your project have several file1.c, file2.c, file3.c files, use OBJS = file1.o file2.o file3.o
OBJS = demo.o

######Your environment: change in each computer#########
CROSS_COMPILE =/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-
# output from /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config
SDL_FLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -D_REENTRANT
SDL_LIBS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -Wl,-rpath,/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -lSDL -lpthread -lm -ldl

######## Change nothing below this line ###########
LDFLAGS = -static
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip

CFLAGS = -DGP2X $(SDL_FLAGS) -O2 -funroll-loops -Wextra -Werror
CXXFLAGS = -DGP2X $(SDL_FLAGS) -O2 -funroll-loops -Wall
LIBS = $(SDL_LIBS)

TARGET = $(PROG_NAME).gpe

all : $(TARGET)

$(TARGET) : $(OBJS)
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
$(STRIP) $(TARGET)

clean:
/bin/rm -rf *~ *.o $(TARGET)



And run make (note that the initial spaces of the last rows are not spaces, but tabs)
 
Last edited by a moderator:
Back
Top