Open2x Makefile


that could be anything. did you compile as -static?

can you usb network in / a telnet session and run it from the console or that and see any output?
 
YakumoFuji said:
that could be anything. did you compile as -static?
Aha! That was my mistake. Added -static to my libs line and it works! The game runs! Thanks so much everyone for all the help.

The gpe is huge compared to the one created by Dev-C++. I guess this is because everything is hardlinked in the Open2x version?

Also, the Open2x compiled version seems to perform quite poorly. For example when my player shoots, the bullets do not appear though collisions take effect. When all the enemies are gone the bullets start appearing if you shoot :blink: This is exactly the same source code which works perfectly when compiled in Dev-C++.
 
Last edited by a moderator:
motorollin said:
Also, the Open2x compiled version seems to perform quite poorly. For example when my player shoots, the bullets do not appear though collisions take effect. When all the enemies are gone the bullets start appearing if you shoot :blink: This is exactly the same source code which works perfectly when compiled in Dev-C++.
That sounds more like your code than the toolchain. The Open2x libraries are significantly more advanced than GPH's.
 
Last edited by a moderator:
And? No need for the patronising ':rolleyes:', it still doesn't sound like a problem with the libraries (unless maybe you installed the experimental 1.2.11 builds).
 
The rolling eyes was a reference to the over-complicated process of getting this working only to find that it's not working properly. I didn't intend to patronise anyone. Apologies for any offence.

AFAIK I didn't install any experimental libraries. I used these instructions:

http://wiki.gp2x.org/wiki/Installing_the_O...ing_from_source

When I started getting weird errors from the SDL includes I found a LIB line elsewhere which was not specific to the GP2X. I think tomorrow (when I'm less tired and more sober) I'll experiment with putting back the line from YakumoFuji's experimental makefile and see what happens.
 
motorollin said:
The gpe is huge compared to the one created by Dev-C++. I guess this is because everything is hardlinked in the Open2x version?

Sounds like you haven't stripped the executable.

Are you using MP3 for music playback? If you are, bare in mind that Open2x doesn't use libmad for playback due to GPL issues.
 
Last edited by a moderator:
Well this is weird. I have just included mikmod.h and added the sample code from the MikMod documentation and all the problems with the game when compiled in Open2x have gone away. My WAV sound effects, played through SDL_Mixer, play at an increased pitch and speed now, so I guess MikMod is messing with the sample rate of SDL_Mixer, but that's not a problem I can just convert the samples.

So here's where I'm at. My game now compiles under Open2x and runs as efficiently as the Dev-C++ version. I can now compile in MikMod with no errors, which is further than I got with Dev-C++. However, I can't actually here the music playing. Here's my MikMod code:

CODE

#include <mikmod.h>
MODULE *module;

int main( int argc, char* args[] )
{
MikMod_RegisterAllDrivers();
MikMod_RegisterLoader(&load_mod);
md_mode |= DMODE_SOFT_MUSIC;
MikMod_Init("");
module = Player_Load("snd/game.mod", 4, 0 );
if (module) {
Player_Start(module);
}
else
{
printf("impossible de lire le module\n");
}

while( loop )
{
MikMod_Update();
//Game's main loop here
}
}



Can anyone see what's wrong here?
 
Well it looks like I didn't need to do any of this after all. I was reading the SDL_Mixer documentation and noticed that Mix_LoadMUS() can take a .mod as its file. I tested this in Dev-C++ and it worked - the MOD file was played! So I don't need to use Open2x after all that.

Thanks anyway to everyone who has helped me in this thread. If nothing else I've learned a lot about how G++ works!

(Next thread coming soon... ;) )
 
I've been reading through this topic to help me get my Linux dev environment setup. I'm posting my makefile that I successfully got to compile a helloworld test app.
Annoyingly, the Open2x toolchain installed in /opt/open2x/gcc-3.4.4-glibc-2.3.6 but the library package (for SDL and others) extracted to /opt/open2x/gcc-4.1.1-glibc-2.3.6 -- you can see that the version numbers are different. I had to make 2 different variables to get all the directories included.
If there is a more efficient way of doing this by all means clear it up. Thanks.

CODE

# Makefile by YakumoFuji
# Modifications by StatiK EffecK
# http://www.gp32x.de/board/index.php?showtopic=38470

# Most of the Binaries and core toolchain
OPEN2X344 = /opt/open2x/gcc-3.4.4-glibc-2.3.6/arm-open2x-linux

# Libraries like SDL, JPG, PNG, MPEG, etc...
OPEN2X411 = /opt/open2x/gcc-4.1.1-glibc-2.3.6

CPP = arm-open2x-linux-g++
CC = arm-open2x-linux-gcc
OBJ = main.o

# Whole motherload of Libraries, you don't need all of them. add them as you go along.
# LIBS = -L$(OPEN2X411)/lib -L$(OPEN2X344)/arm-open2x-linux/lib -static -lSDL_image -lSDL_mixer -lSDL_ttf -lSDL_inifile -lSDL -lpng -ljpeg -lvorbisidec -lmad -lfreetype -lz -lunicodefont

LIBS = -L$(OPEN2X411)/lib -L$(OPEN2X344)/lib -static -lSDL_image -lSDL -lpthread
INCS = -I$(OPEN2X411)/include -I$(OPEN2X411)/include/SDL -I$(OPEN2X344)/include
CXXINCS = -I$(OPEN2X411)/include/c++/4.1.1/backward -I$(OPEN2X411)/include/c++/4.1.1 -I$(OPEN2X344)/include/c++/3.4.4/backward -I$(OPEN2X344)/include/c++/3.4.4 $(INCS)
CXXFLAGS = $(CXXINCS) -DGP2X
CFLAGS = $(INCS) -D_REENTRANT -DGP2X

all: test.gpe

clean:
rm -rf test.gpe $(OBJ)

test.gpe: $(OBJ)
$(CPP) $(OBJ) -o $@ $(LIBS)


.c.o: .autodepend
$(CC) -c $(CFLAGS) $*.c

.cc.o:
$(CC) -c $(CXXFLAGS) $*.cc

.cpp.o:
$(CC) -c $(CXXFLAGS) $*.cpp




Remember: add the appropriate /bin paths to your $PATH variable .
 
Last edited by a moderator:
if your open2x toolchain is in /opt/open2x/gcc-3.4.4-glibc-2.3.6 then its the wrong toolchain if your just wanting to use the libs.

did you build the toolchain for the kernel or libs? I tihnk its the kernel version that builds the gcc3.44 version.
 
YakumoFuji said:
if your open2x toolchain is in /opt/open2x/gcc-3.4.4-glibc-2.3.6 then its the wrong toolchain if your just wanting to use the libs.

did you build the toolchain for the kernel or libs? I tihnk its the kernel version that builds the gcc3.44 version.
I'm just getting back into GP2X again, and I must be missing something here.
I have Ubuntu, I installed the gcc ubuntu package in case I want to dev for my x86 PC.

Then, I went to http://wiki.gp2x.org/wiki/Installing_the_Open2x_toolchain and followed the instructions. I clicked the link for "i have glibc 2.3" -- I'm assuming that means glibc for x86.
I extracted those files -- they look to me like the gcc and g++ compilers for ARM chips. it extracted to gcc-3.4.4 NOT gcc-4.1.1. The archive contents show that structure.

I proceeded to download the 'libraries' archive, which I assumed was for SDL, png, jpg, and all those other libraries. I extracted that as instructed and it went into gcc-4.1.1.

I only want to make executables, I do not want to work on the GP2x linux kernel. So far, I've been downloading archives of bins, and not any sources. I have not compiled or make'd anything except my GP2X test app, which by the way, worked using my weird Makefile.
 
Last edited by a moderator:
YakumoFuji said:
well, check out the actual open2x site here;
http://wiki.open2x.org/open2x/wiki/index.php?title=Toolchain

* GCC 3.4.4/gLibC 2.3.6 Open2x Kernel Toolchain here.
* GCC 4.1.1/gLibC 2.3.6 Open2x Applications Toolchain here.

download the 4.1.1 toolchain from the open2x page instead of the one linked from the gp2x.org wiki



I do see that now. I believe I looked there before, but may have been discourage by 'requiring glibc 2.4'. i'll try again tomorrow using that link and see what comes about. if i'm successful, i'll update the gp2x wiki myself with a more in depth break down.
 
Last edited by a moderator:
Updated Makefile proven to work. This is useful for newbies who are lost on linux.
I had to upgrade to glibc 2.6 to get the pre-made toolchain gcc and g++ to work on my system, without using the archive that YakumoFuji claims is for working on the GP2X kernel.
The specific debian package I upgraded called libc6-dev.

CODE

# Makefile by YakumoFuji
# Modifications by StatiK EffecK
# http://www.gp32x.de/board/index.php?showtopic=38470

# Custom Directory Links
OPEN2X = /opt/open2x/gcc-4.1.1-glibc-2.3.6
OPEN2XARM = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux

CPP = arm-open2x-linux-g++
CC = arm-open2x-linux-gcc
OBJ = main.o

# All Libraries on next line
# LIBS = -L$(OPEN2X411)/lib -L$(OPEN2X344)/arm-open2x-linux/lib -static -lSDL_image -lSDL_mixer -lSDL_ttf -lSDL_inifile -lSDL -lpng -ljpeg -lvorbisidec -lmad -lfreetype -lz -lunicodefont

LIBS = -L$(OPEN2X)/lib -L$(OPEN2XARM)/lib -static -lSDL_image -lSDL -lpthread
INCS = -I$(OPEN2X)/include -I$(OPEN2X)/include/SDL
CXXINCS = -I$(OPEN2X)/include/c++/4.1.1/backward -I$(OOPEN2X)/include/c++/4.1.1 $(INCS)
CXXFLAGS = $(CXXINCS) -DGP2X
CFLAGS = $(INCS) -D_REENTRANT -DGP2X

all: test.gpe

clean:
rm -rf test.gpe $(OBJ)

test.gpe: $(OBJ)
$(CPP) $(OBJ) -o $@ $(LIBS)


.c.o: .autodepend
$(CC) -c $(CFLAGS) $*.c

.cc.o:
$(CC) -c $(CXXFLAGS) $*.cc

.cpp.o:
$(CC) -c $(CXXFLAGS) $*.cpp
 
Last edited by a moderator:
Back
Top