A Fresh New Toolchain+libs - Compiled On Demand!


ooPo

Still Fresh
Joined
Jan 29, 2006
Messages
35
Since picking up my gp2x, I've been annoyed at the lack of a standard set of compilers and libraries. There's a complete lack of consensus. So, instead of complaining about it I've decided to do something about it:

http://www.oopo.net/consoledev - Look for the 'newtoolchain' package.

This is a perl script that will download, patch, and compile binutils-2.16.1, gcc-4.0.2, glibc-2.3.5, zlib-1.2.3, jpeg-6b, libpng-1.2.8, freetype-2.1.10, mikmod-3.1.11, tremor-svn (ogg support), SDL-1.2.9-paeryn, SDL_image-1.2.4, SDL_ttf-2.0.7, smpeg-0.4.4, SDL_mixer-1.2.6, SDL_gfx-2.0.13, libxml2-2-6.23 and SDL_svg-1.1.9.

Each package is compiled for a gp2x target - this means you can use gp2x-gcc to compile. It also puts everything into $GP2XDEV, which defaults to /usr/local/gp2xdev. This lets you do stuff like give configure a --with-sdl-prefix=$GP2XDEV. If you're familiar with my ps2dev and pspdev toolchains this works very similar. In fact, the same script will build those toolchains for you as well.

It should build fine under any unix-like environment. This includes cygwin and osx.

Take a look at the included README and README.GP2X files for more information.

[EDIT: Updated package.]
 
Code:
luteijn@dollar:~/devel/gp2x/tmp/newtoolchain$ export GP2XDEV=/home/luteijn/devel/gp2x/tmp
luteijn@dollar:~/devel/gp2x/tmp/newtoolchain$ export PATH="$PATH:$GP2XDEV/bin"
luteijn@dollar:~/devel/gp2x/tmp/newtoolchain$ ./toolchain.pl GP2X

Dependencies:
 gcc:           Found!
 make:          Found!
 wget:          Found!
 patch:         Found!
 $GP2XDEV:      Found!
 path:          Error!

=====================
== ERROR DETECTED! ==
=====================


This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

written by Larry Wall and Paul Eggert

##
## Executing the following command:
##
## { export | grep ' GP2XDEV='; }
##
export GP2XDEV="/home/luteijn/devel/gp2x/tmp"

##
## Executing the following command:
##
## { export | grep ' PATH=' | grep '/usr/local/gp2xdev'; }
##


ERROR: Please read README.GP2X for information.

looks like something is gong wrong with your setting of the default even if there is a different one set... Anyway, just put in my preference instead of the default at the start of the script and it's happily purring along now...
 
Ahh yes, I see what you mean. I'll fix up the script to grab the pre-set $GP2XDEV instead of forcing the default. Thanks!
 
Marvelous work, ooPo. A nice clean toolchain that will help my development immensely.

Only one thing I had to change to get it to build the libs -- to build SDL_ttf, I had to add the following to the ./configure args:

--with-freetype-prefix=$GP2XDEV

... otherwise, it looks in /usr/include for the freetype headers.

Thanks!
 
Alrighty. I'll add '--with-freetype-prefix=$GP2XDEV' for the next release.

Thanks!
 
I noticed that too, but I'm far too new to the gp2x to really have enough ability to say that for sure. Thanks for the confirmation. I'm wondering if its a problem with the accelerated SDL. I'm going to try out the normal SDL later tonight when I get home.

BTW, the package has been updated with full shared and static versions of all the libs, as well as the suggestions already made in this thread.
 
I've updated the 20060131 package with patches to allow sound to work in Paeryn's accelerated SDL in both the static and the shared libaries. As it involved a patch to glibc to build libpthread.so properly, I'm currently testing a complete build from scratch.

However, you should be ok if you just do the change to $GP2XDEV/gp2x/lib/libpthread.so as indicated in that thread and rebuild SDL using './toolchain.pl GP2X-LIBS 8'.
 
Script has been updated to include SDL_gfx-2.0.13, a very nice library for scaling and rotating images as well as drawing a wide variety of primitives.
 
I quickly tried to compile PrBoom with it. ./configure fails for SDL_mixer and SDL_net. For SDL_mixer, configure complains about missing functions that seems to be part of mikmod or other libs. It may be resolved adding CFLAGS=-I$GP2XDEV/include. I din't try. I didn't look for SDL_net, but I guess the script compiles SDL withtout SDL_net because the GP2X has no network stack.
 
When you're porting other software, like PrBoom, you may have to do something like this:

Code:
CFLAGS=-I$GP2XDEV/include CXXFLAGS=-I$GP2XDEV/include LDFLAGS=-L$GP2XDEV/lib ./configure --prefix=$GP2XDEV --build=`uname -m` --host=gp2x --with-sdl-prefix=$GP2XDEV
This is after adding an entry for the gp2x in config.sub, as shown in the README.GP2X included with the toolchain script.

Yes, SDL_net isn't included in the script as there is no network access currently. It is easy enough to include later if a method does turn up.
 
Just a little problem with linux-headers on Mac OS X. The cp command does not support the -a switch on Tiger. I replaced it with RHp and it seems to work now.
 
I've been having some success using this setup. I've already built lrzsz-0.12.20 (I want a Zmodem implementation when connected via 'minicom') and ncurses-5.5. I'm attempting to add gdb-6.4 to the setup now, and 'make' stops at the 'no termcap library found' error.

luteijn, I know you've already done a port of gdb-6.4. What was your approach to the termcap dependency, and how do you think it would best be incorporated into the ooPo toolchain?

Note: for ncurses and gdb, the config.sub patch is a bit different, and looks like this:

Code:
gp2x)
          basic_machine=arm-gp2x
          os=-linux
         ;;

Note the hyphen before 'linux', and the lack of '-gnu'. These config.sub's will automatically attach '-gnu' to linux. (That was probably Stallman's idea. Heh.)
 
Have you looked into why it can't find ncurses? Some configure scripts are poorly written and need an include and lib path specified manually on the command line:

Code:
CFLAGS=-I$GP2XDEV/include LDFLAGS=-L$GP2XDEV/lib ./configure blah blah blah
CFLAGS=-I$GP2XDEV/include LDFLAGS=-L$GP2XDEV/lib make
I've been using arm-gp2x-linux-gnu as a target (with the hyphen, too) for the same reason. You can't always count on it putting things like -gnu automatically. It really doesn't matter as it should only be looking at the arm-*-linux-* parts, but its not much extra effort to be accurate.

If you're feeling fiesty, pass on any additions you want to see in the script to me at peori@oopo.net and I'll put them in for all to use.
 
IIRC, I cheated by having parts of the build done by the native 386 compiler, as it wanted to run some of the programs to generate more 'source' to compile later on. Then if/when linking failed, I'd remove any i386 .o files, and rebuild them with the arm compiler. Because I just wanted a quick result, I didn't bother doing things properly(didn't and don't have time for that), just hacked the generated makefiles a bit to point to e.g. the ncurses I'd just build. the actual terminfo files are not cpu dependant so I just copied them over.

P.
 
luteijn posted on Feb 3 2006 at 02:39 PM said:
IIRC, I cheated by having parts of the build done by the native 386 compiler, as it wanted to run some of the programs to generate more 'source' to compile later on. Then if/when linking failed, I'd remove any i386 .o files, and rebuild them with the arm compiler. Because I just wanted a quick result, I didn't bother doing things properly(didn't and don't have time for that), just hacked the generated makefiles a bit to point to e.g. the ncurses I'd just build. the actual terminfo files are not cpu dependant so I just copied them over.

I was able to solve the "source generation" part by adding --with_build_cc=gcc to the configure args. I'm still trying to debug why configure (in the gdb subdir) can't find tgetent in libncurses.a.
 
Last edited by a moderator:
bjimba posted on Feb 3 2006 at 08:00 PM said:
I was able to solve the "source generation" part by adding --with_build_cc=gcc to the configure args. I'm still trying to debug why configure (in the gdb subdir) can't find tgetent in libncurses.a.

Knowing myself, I might have just ripped the offending part out of configure and jus tplain made the test work... But you can check, I have the directory browsable via the web: http://luteijn.xs4all.nl/html/gp2x/
 
Last edited by a moderator:
i installed cygwin and used your script overnight, it worked near perfectly and had just one problem which is not really your fault but worth a mention.

on paeryns SDL there is a problem when extracting the archive, it gives an error saying OPEN2X already exists, i think this is a Windows/Cygwin problem. to get around it, i extracted the file in windows (ignoring the error) and then rearchived it again. ran your script and it extracted fine.

good work on the script, apart from that it worked perfectly, thanks!
 
Back
Top