Cross-Compiling Is Bollocks! Toolchains Are Bollocks! Use Yo


torpor

hack hack hack, the little machines fight back
Joined
Oct 21, 2005
Messages
2,475
Location
vienna, austria
Website
w1xer.at
In preparation for future development, I spent some time this evening getting my Pandora set up to support my efforts.

No, you do *not* need a cross-compiler environment, or separate external toolchain, or a copy of the PandoraOS Angstrom environment, to build fast, 3D apps for the Pandora, in C/C++. All you need is the Pandora ITSELF! :)

Introducing PandoraWakeBreaker, a demonstration project for developers to use to evaluate the ability of the Pandora OS to natively host its own development tools!

Here is the README:

Code:
This is a port of WakeBreaker to the Pandora Game console OS (Zaxxon),
by Jay Vaughan.  The purpose of this package is to give budding
developers a leg-up with getting something running for the Pandora,
by using the Pandora itself!

http://w1xer.at/pandora/

Based on the Original WakeBreaker code by Peter Angstadt
http://pete.nextraztus.com/projects.html

(Peter, if you're out there, contact me please!)

Introduction:
----------------

WakeBreaker is a very simple game - see the description.txt and
license.txt files for info.  Its not going to make any gamer
happy, but it *does* provide an excellent resource for programmers
who want to get started and understand how to get all this
stuff working.

I ported this very nice little GL ES 1.1 demo, WakeBreaker, to the 
Pandora OS.  Rather than fool around with cross-compilers and
toolchains and other bloaty baggage, I opted to go the other non-
popular way, and simply use the tools available in Angstrom for
the Pandora OS itself. 

Yes, kids, you *can* use your Pandora to write software for the
Pandora!  It works, its not slow (well, its acceptable to this
old grey-beard), and its quite fun not to have to deal with
libaries and paths and so on ..

No cross-compiler required!  The Pandora is more than enough
machine for the job of building software!  Far greater
software has been built on lesser machines than your
average over-spec'ed PC!


How to use this source package:
----------------------------------

If you haven't already done so, you'll need to install
some developer tools on your Pandora.  This is the order in which
I did it:

#to get root rights to do the rest .. you could prefix 'sudo' on all the following cmds instead if you wish, though .. 
sudo bash 
opkg update
opkg install gcc_4.3.3 gcc-symlinks gcc-doc make_3.81 make-dev binutils-dev vim_7.2 vim-syntax
opkg install cpp cpp-symlinks
opkg install g++_4.3.3 g++-symlinks
opkg install libstdc++-dev
opkg install libgles-omap3-dev libgles-omap3-demos
opkg install libsdl-1.2-dev libsdl-gfx-dev libsdl-image-1.2-dev libsdl-mixer-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev 

(vim and omap3-demos packages not required, but you might
be interested in those demos, and you might be a vim user too!)

Simply unpack this tarball somewhere on your Pandora/, cd to the 
PandoraWakeBreaker directory, and type 'make'.  This will build
the "PandoraWakeBreaker" executable, which you can then run
directly either from the shell, or from the file manager GUI.

PND not necessary - this is a developer demo, not for release
to users.

Note:
-------

This is a bit buggy right now - to get things started, I borrowed
a lot of code from the GLES2D package, which is sorta messy,
and there are for sure things that can be done to make the 
code in main.cpp (primary Pandora-specific stuff) a lot 
cleaner.  I want to get this out there now though, for those
who are in despair about how much work it takes to get the
cross-compiler/toolchain setup for their Pandora - you 
don't need to go through the hassle, folks!  

Just Use Your Pandora!

How to play:
--------------
See description.txt - its a racing game, get all the balls 
before the enemy player!  Use the arrow keys to move.

Questions?
------------

For questions about this port, contact Jay Vaughan (ibisum @
gmail . com  **or** PM 'torpor' on the #openpandora IRC
channel, or in the GP32X forums)


NOTE: I intentionally did not make a PND of the PandoraWakeBreaker executable because this project is for *developers only* right now (its got some bugs left to be fixed), but if someone else wants to do it and put it up and out there, please be my guest. Note that it wouldn't be bad if you fixed a few bugs first, however .. :)
 
Torpor, you are my hero. Thanks so much for outlining this. I feel that it will help the community greatly by making it easy for people to jump right in.
 
You're welcome mindlord, and I hope it really does help people get started .. I think WakeBreaker is a pretty good set of sources for people to derive new games from, and being able to use the Pandora to build this project itself should prevent a lot of headaches. Its nice that it just works! :)

I'll return to WakeBreaker in a couple of days (this weekend I will be working on my music apps a bit), but in the meantime if anyone wants to fixup/cleanup the additions I hacked up to main.cpp to get it all Pandora-specific, that would be really helpful. Things build cleanly now, and they run .. but there was quite some stuffing around to get the GLES context and Pandora control input side of things working .. I borrowed code from GLES2D for all this, but in my opinion it was a quick hack and could be refined down to a couple of very specific light-weight functions if anyone has the interest .. please post followups on this thread if you do anything interesting with this package, I would love to know that this has helped people produce a new game, for example!
 
mindlord said:
Torpor, you are my hero. Thanks so much for outlining this. I feel that it will help the community greatly by making it easy for people to jump right in.
I concur.
 
Last edited by a moderator:
How much space does it eat up on NAND? I built mine to live on SD when I was fiddling with this. Surprised it actualyl fits into NAND, but I guess we yoined out a lot of stuff over the last few months. Woot :)

It will be interesting to see how many people attempt it, versus needing a USB keyb etc..

New competition -- only accepting entries 100% done on Pandora :) (Gimp runs fine on Pandora, but Blender migbht be rough :)

jeff
 
torpor - why don't you enable PMs? send me an email to skeezix skeleton org I've got somethign stupid to note for you :)

jeff
 
Question: is there an opkg install command for the qt libraries? I have a vague idea of a lightweight IDE (and by that I mean a text editor with a build button and a run button and not much else; I'm a beginner) that I might be able to write using a qt program and some shell scripts to interface with the dev environment when I get my Pandora. Unless somebody else does something first, in which case my idea is moot.
 
skeezix said:
How much space does it eat up on NAND?

Well, I didn't think to do a "before df -k", but the "after df -k" looks like this:

Code:
ubi0:rootfs             454.7M    382.1M     72.6M  84% /

So 84% used after installing the compiler and so on .. I think it was 75% used before, at factory default? Perhaps someone with a factory filesystem can do "df -k" and we can compare the numbers exactly? The only thing I've done is the opkg cmd list as above, so a comparison with someone elses factory Pandora should give us the precise numbers .. or I could unbox my second Pandora, but hey .. saving that for a rainy day. Oh, its raining like mad here in Vienna, okay I'll do it later in case someone else doesn't get the stats in the meantime.

Regardless, since there's not much else to be added to the NAND now, I think that 84% usage is quite acceptable .. especially considering you don't need much else to get some real coding done now, no fuss with cross-compiling, copying libs over, making sure you have the headers and so on ..

BTW, skeezix, sent you private mail and I turned my PM option on also, in case people want to contact me about things like this.

I think tonight I might port one more of the GL ES demo's over, its actually quite fun .. Jelly Invaders is a usable game and quite interesting from the perspective of learning how to do things for action-packed 3D gaming!
 
Last edited by a moderator:
[quote name=']Question: is there an opkg install command for the qt libraries?[/quote]

Yes, there are quite a lot of -dev packages in the repository which can be used to add a usable development environment for the relevant libraries, and I did note that there was one for libQt, although I don't use Qt much myself.

If you want to investigate it yourself, I found that there seems to be a problem with "opkg search" not returning proper results (perhaps its been disabled by the Base OS build for some reason), so the best thing to do is issue an "opkg update", then "opkg list" (to see whats already installed) and then go to the repo's themselves with your web browser to find packages .. when you do an "opkg update" you'll see the URL's for the repo's - these can be opened in your browser, and you can find packages yourself that way .. to find out what is in the package, do "opkg files <packagename>" and it will show you what will get installed .. I had to hunt and peck a bit to find the right combination of packages to use to get a working compiler environment for WakeBreaker, which is a C++ project and thus needed not only the base gcc and cpp packages, but also g++, libstdc++ and so on .. as you can see in the list of packages quoted in the README above.

Anyway, I think an onboard IDE for the Pandora would be sweet, but in all honesty I'm a vim+make user, and both of these work wonderfully on the Pandora already, so I wouldn't put too much into it - I think you can also use nano and call out to an external 'make' command if you like .. 20 years of vi usage, however, has given me the chops I need to use it as my primary IDE, and you can enable things like syntax highlighting, keyword completion (its control-N in vim, then select from the list) and tags to jump around with - I'll also probably do a quick port of cscope too, since this is an excellent way of navigating sources, and with headers onboard it gives you everything you need to navigate through your sources and find identifiers and so on .. vim+cscope+make+gcc == all the IDE you need, really, if you can handle vim .. either way though I'll be quite happy to see someone else put some toys into the Pandora-as-development-environment box!

Also, I should explain that you don't *need* to use the Pandora to edit code, just to build it - so you could mount your Pandora home drive on your main PC and edit files with your proper editor, USB keyboard/mouse and 26" screen, then just execute a make command on the Pandora to build and test the project .. its even possible to set up vim so that you can just execute make in the PC vim environment, call out (over ssh) the Pandora build script, and get error messages and navigation on your host vim in return .. this is very slick actually and if it weren't for the speed of compiles, you wouldn't even know your Pandora is involved. Well, that can be solved with a bit of overclocking in the Makefile too, I suppose .. haven't tried that yet, but as I go on I'll try to refine things and produce a Makefile that does all these tricks for you, so you don't have to figure it out.

Although, I imagine that overclocking the Pandora for each build is *quite* an acceptable way of getting things done quicker .. will try that as well a bit later, I suppose.

Anyway, hope this gives people some motivation to get some cracking software built, and I hope you guys will follow up in this thread with any ideas/tricks/tips you come up with in the meantime .. it'd be nice to keep this thread active so that other users/newcomers can see that in fact is *quite* easy to get started developing software for the Pandora. I think that the Pandora is the first hand-held gaming platform that is entirely self-enclosed, development-wise, and that is definitely a bonus.

Imagine if the WIZ and GP2X had compilers onboard too! :)
 
Last edited by a moderator:
Seriously, thanks for this. The approach is exactly how I wanted to do my Pandora developing. I’m really looking forward to getting my Pandora.

I figure if I was able to put up with SAS/C compile times on my Amiga “back in the day” then the Pandora will be fine 

I’ve not used VIM before so I’ll check it out.
 
Would ccache on SD be an option to speed up the build? Don't know if its overkill or worth a try.
 
I figure if I was able to put up with SAS/C compile times on my Amiga “back in the day” then the Pandora will be fine

If you organize your project properly, putting code in modules and separate files in such a way that you can do "incremental compiles", it will hardly be an issue, seriously. Plus, you can always overclock to 850mhz and just forget the problem entirely .. in my experience, compiling onboard is just fine and if you're doing builds quite often (like good programmers should) then you shouldn't have to wait very long, indeed ..

Would ccache on SD be an option to speed up the build? Don't know if its overkill or worth a try.

Could definitely work, but I think its overkill. I would suggest you try it .. you might be surprised that its not actually that bad a wait. Plus, there is distcc in the repo's too, and we could easily exploit that in interesting ways .. well I've got two Pandoras, so maybe I will play with this some time soon.

I know an N900 hacker, for example, who borrowed everyones N900 for a few hours to build a Linux kernel using distcc on about 10 N900's .. was wonderfully acceptable, speed-wise! :)
 
:) Now this is the kinda thing i was hoping would come along... I dont program in c/c++ but this kind of thinking will drag other (simpler) languages directly onto our Pandoras.

Superb stuff (even better for you superDevs)!!!


I wish I would be able to use GLBasic (or equivelent) from my Pand/for my Pand... When it arrives!
 
In all honesty build times are such a small proportion of my dev time that I don't really mind too much how long they take. There's always something else to do :)

The ability to test builds on the actual target device is also something I'm looknig forward to. I'm doing SDL/OGLES builds in Windows right now.
 
kmob said:
In all honesty build times are such a small proportion of my dev time that I don't really mind too much how long they take. There's always something else to do :)
compiling.png
 
Last edited by a moderator:
Thank you, torpor. Now I can compile some music related stuff (milkytracker, schism, both SDL based) while SDK is being done.

I prefer cross compiling SDK for the big projects with a more visual IDE in a bigger screen, but this tip can be cool to compile everywhere some stuff. The NAND free space is limited and those libs go there, but SDL is smaller in this case.

Greets and good luck!
 
I've been wondering about this for a while. Can't wait until I get my Pandora!
 
skeezix said:
torpor - why don't you enable PMs? send me an email to skeezix skeleton org I've got somethign stupid to note for you :)

jeff

Oh, come one share with us!

To get things right: the development stuff can fit on a SD? Is it slower on SD than on the NAND? All the compiling creates temporary files. Are those in memory or are they wearing down the NAND life time? How is typing on the pandora like? Especially curly braces and the like.
 
Last edited by a moderator:
synkro said:
To get things right: the development stuff can fit on a SD? Is it slower on SD than on the NAND? All the compiling creates temporary files. Are those in memory or are they wearing down the NAND life time? How is typing on the pandora like? Especially curly braces and the like.

SD will be a smidge slower than NAND, but probably not all that noticable depending on the card. I've compiled stuff on SD cards before, and it wasn't horrificly slow or nothing.

Object files and the like appear in the same place as the g++ command was invoked, so you are burning your NAND if you're compiling there, or your SD if you're source code is there.

I wouldn't want to code directly on the Pandora's keypad, but I will in a pinch. I have 2 USB keyboards, one full size, and one mini-on-the-go sized.
 
Last edited by a moderator:
Back
Top