Jump to content


Photo

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


  • Please log in to reply
83 replies to this topic

#1 torpor

torpor

    hack hack hack, the little machines fight back

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 2377 posts
  • Gender:Male
  • Location:vienna, austria

Posted 03 June 2010 - 10:30 PM

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:

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 .. :)

Edited by torpor, 08 July 2010 - 08:17 AM.


#2 mindlord

mindlord

    Notices Two Things

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 1346 posts
  • Gender:Male
  • Location:In a cave.
  • Interests:Sharp Pointy Objects, and World Domination

Posted 03 June 2010 - 10:50 PM

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.

#3 torpor

torpor

    hack hack hack, the little machines fight back

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 2377 posts
  • Gender:Male
  • Location:vienna, austria

Posted 03 June 2010 - 10:54 PM

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!

#4 Aethix

Aethix

    GP Mania

  • GP32 Hardcore
  • PipPipPipPipPip
  • 312 posts
  • Gender:Male
  • Interests:Video games, programming, math, and cooking.

Posted 03 June 2010 - 11:06 PM

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.

#5 skeezix

skeezix

    Mega GP Mania

  • GP Guru
  • 5088 posts
  • Gender:Male
  • Interests:Blog: http://www.rjmitchell.ca/~jeff/blog2009/

Posted 04 June 2010 - 12:42 AM

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

#6 darien

darien

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 234 posts
  • Gender:Male

Posted 04 June 2010 - 01:03 AM

*single pelvic thrust*




*walks away

#7 skeezix

skeezix

    Mega GP Mania

  • GP Guru
  • 5088 posts
  • Gender:Male
  • Interests:Blog: http://www.rjmitchell.ca/~jeff/blog2009/

Posted 04 June 2010 - 01:38 AM

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

#8 Aethix

Aethix

    GP Mania

  • GP32 Hardcore
  • PipPipPipPipPip
  • 312 posts
  • Gender:Male
  • Interests:Video games, programming, math, and cooking.

Posted 04 June 2010 - 02:41 AM

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.

#9 torpor

torpor

    hack hack hack, the little machines fight back

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 2377 posts
  • Gender:Male
  • Location:vienna, austria

Posted 04 June 2010 - 07:43 AM

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:

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!

#10 torpor

torpor

    hack hack hack, the little machines fight back

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 2377 posts
  • Gender:Male
  • Location:vienna, austria

Posted 04 June 2010 - 07:55 AM

Question: is there an opkg install command for the qt libraries?


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! :)

#11 kmob

kmob

    GP32 User

  • Member
  • PipPipPip
  • 51 posts

Posted 04 June 2010 - 10:45 AM

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.

#12 CodeTwister

CodeTwister

    GP32 User

  • Member
  • PipPipPip
  • 39 posts

Posted 04 June 2010 - 10:59 AM

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

#13 torpor

torpor

    hack hack hack, the little machines fight back

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 2377 posts
  • Gender:Male
  • Location:vienna, austria

Posted 04 June 2010 - 11:02 AM

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! :)

Edited by torpor, 04 June 2010 - 11:04 AM.


#14 Philly

Philly

    GP32 User

  • Member
  • PipPipPip
  • 70 posts
  • Gender:Male
  • Location:Englandcestershire!!!
  • Interests:booze, chicks, cars, tech, DIY, Amiga, MAME, Oldschool games, Thumbwrestling etc.

Posted 04 June 2010 - 11:03 AM

:) 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!

Edited by Philly, 04 June 2010 - 11:06 AM.


#15 kmob

kmob

    GP32 User

  • Member
  • PipPipPip
  • 51 posts

Posted 04 June 2010 - 11:06 AM

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.