Difference between revisions of "Compile on the Pandora"

From Pandora Wiki
Jump to: navigation, search
m (changed libsdl-mixer-dev to libsdl-mixer-1.2-dev)
m (Kingu moved page Compile directly on the Pandora to Compile on the Pandora: too verbose title)
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 +
This page lists various ways to install a compiler and development tools onto a Pandora.
 +
 +
== C Development Tools PND ==
 +
 +
For compiling C/C++ programs that use SDL, GTK+, QT or Allegro, a PND is now available: [http://repo.openpandora.org/?page=detail&app=cdevtools.freamon.40n8e repo].  Running this PND gives your Pandora access to gcc and g++ without changing the root filesystem.
 +
 +
== Code::Blocks PND ==
 +
 +
The [http://repo.openpandora.org/?page=detail&app=codeblocks6022 Code::Blocks PND] is based on infrastructure from the cdevtools package above, plus a set of updated libraries and the Code::Blocks IDE.
 +
Note that when you are building your software against libraries supplied with Code::Blocks that are not included in the Pandora base system, you will need to bundle them into your PND.
 +
 +
== Using a full Linux distribution ==
 +
 +
Slackware for Pandora (SL4P) contains all development stuff the x86 version has: gcc, perl, ruby, python, php, java etc..
 +
Get it [http://pandorawiki.org/Software_projects/OS/Slackware here.]
 +
 +
== Using T4b's prepackaged toolchain ==
 +
 +
'''NOTE: This guide was written in 2011, and the instructions were not recently tested.'''
 +
 +
This is how I, T4b, set up my develepment environment. Of course it is on an SD card, the NAND is way to small. I recommend an 8GB card.
 +
 +
=== Installing the OS to an SD ===
 +
This part was almost only copied from there: http://www.pandorabits.org/index.php?page=sd-installer
 +
#Copy the PND to an SD card in the usual manner. You can get it from [http://www.pandorabits.org/index.php?page=sd-installer-downloads PandoraBits' download page].
 +
#Copy a firmware image to the same card. You can get one from [http://openpandora.org/firmware/ here], the file "pandora-rootfs.tar.bz2" should always be the latest image, older ones are under the "images" directory. I suggest using the newest one, I did it with the (at the moment of writing this) newest one, with HotFix5.
 +
#Ensure that you have both SD cards in Pandora. It doesn't matter which one is in which slot.
 +
#Run the PND. You will probably be asked for your password at this point. This is needed because the installer needs to run as root in order to partition and format the SD card.
 +
#Follow the prompts that appear. You will be asked for the firmware image file, then asked to select the card that you want to use, then asked to choose how much space to allocate to the VFAT (Windows, see below) and swap partitions.
 +
#Once you have gone through all the prompts, the firmware image will be installed to the SD card. This will take upwards of ten minutes. The larger the card, the longer it takes, so be patient.
 +
#Once complete, you will be able to boot your Pandora from the SD card by powering it on with the card in the left slot. Please note that the first boot will take longer than usual, at least ten minutes. Cards of 16 GB or more seem to take a lot longer.
 +
=== Getting the actual development environment ===
 +
No you'll find out why I called it a "lazy" way.
 +
#Download the newest archive from  [http://forum.gp2x.de/viewtopic.php?f=24&t=11865 this] thread in the German gp2x.de forum. Use google translator if necessary (at the time of writing this the newest one was [http://kimu.usenet-verwaltung.de/devel-pandora-native-20110411.tar.bz2 this] [direct download])
 +
#Copy it on an SD which you insert into your Pandora
 +
#<source lang="bash">cd /</source>
 +
#<source lang="bash">sudo tar -xjf path/to/archive.tar.bz2</source>
 +
#Reboot
 +
Done!
 +
 +
== Using Angstrom packages ==
 +
 +
'''NOTE: This guide was written for an older release of the Pandora firmware. Nowadays, opkg should fetch packages from the openpandora feed, and installing packages should not break the system. It is unknown if these instructions still work on a current firmware.'''
 +
 
torpor described how to [http://www.gp32x.com/board/index.php?/topic/53964-cross-compiling-is-bollocks-toolchains-are-bollocks-use-your-pandora-to-build-apps/ build apps directly on the Pandora].
 
torpor described how to [http://www.gp32x.com/board/index.php?/topic/53964-cross-compiling-is-bollocks-toolchains-are-bollocks-use-your-pandora-to-build-apps/ build apps directly on the Pandora].
  
Please note that as of March 2011, you will break your install if you follow those instructions directly! The angstrom "unstable" distribution is well named.
+
{{warning
 +
|Please note that as of March 2011, you will break your install if you follow those instructions directly! The angstrom "unstable" distribution is well named.
 +
}}
  
 
You can try the following:
 
You can try the following:
Line 9: Line 55:
 
2. Enable sshd, and ssh in from another machine.  This helps keep control when things break.  To get root:
 
2. Enable sshd, and ssh in from another machine.  This helps keep control when things break.  To get root:
  
  sudo bash
+
<source lang="bash">sudo bash</source>
  
 
3. Set up a [http://pandorawiki.org/Extend_Utils#Creating_a_Root_or_Home_Overlay_PreMount root overlay] on your SD card.  This gives you a way to try again when things break, and there are other benefits.  I added /home/ to the overlay also, by editing the "premount" script.  To explain the extend terminology a bit, a "root overlay" is a loop mounted filesystem (on an SD) which goes over the top of (most of) your normal root filesystem.  You can still read the files underneath it, but any writes / deletes are recorded only in the overlay filesystem.  Your real root on the NAND is not modified at all.  The "premount" shell script is used to mount your overlay, have a look in it to see how it works.  You can sort of unmount them using umount -l (lazy umount), but I'm not sure if this is safe.  The reliable way to unmount it is to reboot the Pandora!
 
3. Set up a [http://pandorawiki.org/Extend_Utils#Creating_a_Root_or_Home_Overlay_PreMount root overlay] on your SD card.  This gives you a way to try again when things break, and there are other benefits.  I added /home/ to the overlay also, by editing the "premount" script.  To explain the extend terminology a bit, a "root overlay" is a loop mounted filesystem (on an SD) which goes over the top of (most of) your normal root filesystem.  You can still read the files underneath it, but any writes / deletes are recorded only in the overlay filesystem.  Your real root on the NAND is not modified at all.  The "premount" shell script is used to mount your overlay, have a look in it to see how it works.  You can sort of unmount them using umount -l (lazy umount), but I'm not sure if this is safe.  The reliable way to unmount it is to reboot the Pandora!
Line 17: Line 63:
 
5. Get new fresh package lists:
 
5. Get new fresh package lists:
  
  opkg update
+
<source lang="bash">opkg update</source>
  
 
6. ncurses packaging seems to be broken, and ncurses is important!  So, I suggest to do this first (in the overlay), or be prepared for things to start breaking when it gets removed later.  If it does get removed, make sure to install it again!
 
6. ncurses packaging seems to be broken, and ncurses is important!  So, I suggest to do this first (in the overlay), or be prepared for things to start breaking when it gets removed later.  If it does get removed, make sure to install it again!
  
  opkg install libncurses5
+
<source lang="bash">opkg install libncurses5</source>
  
 
7. Install dev packages:
 
7. Install dev packages:
  
  opkg install gcc gcc-symlinks make-dev binutils-dev cpp cpp-symlinks g++ g++-symlinks libstdc++-dev
+
<source lang="bash">opkg install gcc gcc-symlinks make-dev binutils-dev cpp cpp-symlinks libgcc-dev
 +
opkg install g++ g++-symlinks libstdc++-dev</source>
  
8. Try to compile "hello world". Mine didn't find libgcc_s, this fixed it:
+
8. Try to compile "hello world".
 
 
  opkg install libgcc1  # not sure if this was needed
 
  ln -s /lib/libgcc_s.so.1 /usr/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/libgcc_s.so
 
  
 
9. I had trouble with libsdl-image-1.2-dev and libpng / libpng-dev.  libpng-dev from the repo conflicts with 'libpng' on the Pandora.  That latter package is misnamed I guess, it should be called 'libpng-dev', only contains libpng-config and libpng12-config (dev tools, not essential) but task-pandora-core depends on it.  The real libs are in libpng12-0 / libpng3.  So I did this:
 
9. I had trouble with libsdl-image-1.2-dev and libpng / libpng-dev.  libpng-dev from the repo conflicts with 'libpng' on the Pandora.  That latter package is misnamed I guess, it should be called 'libpng-dev', only contains libpng-config and libpng12-config (dev tools, not essential) but task-pandora-core depends on it.  The real libs are in libpng12-0 / libpng3.  So I did this:
 
+
<source lang="bash">
  opkg remove libpng --force-depends
+
opkg remove libpng --force-depends
  opkg install libpng-dev
+
opkg install libpng-dev
 +
</source>
  
 
10. Install extra dev libs:
 
10. Install extra dev libs:
 +
<source lang="bash">
 +
opkg install libgles-omap3-dev
 +
opkg install libsdl-1.2-dev libsdl-gfx-dev libsdl-image-1.2-dev libsdl-mixer-1.2-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev
 +
</source>
  
  opkg install libgles-omap3-dev
+
Hopefully this will go smoothly if you've fixed the png conflict in step 9.
  opkg install libsdl-1.2-dev libsdl-gfx-dev libsdl-image-1.2-dev libsdl-mixer-1.2-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev
 
 
 
  Hopefully this will go smoothly if you've fixed the png conflict in step 9.
 
  
 
11. Install optional extra stuff, if you want them:
 
11. Install optional extra stuff, if you want them:
 
+
<source lang="bash">
  opkg install vim vim-syntax
+
opkg install vim vim-syntax
  opkg install libgles-omap3-demos
+
opkg install libgles-omap3-demos
  opkg install screen git rsync
+
opkg install screen git rsync
 +
</source>
  
  
Line 54: Line 101:
  
 
After all this, I was able to build torpor's suggested dev demo app, [http://w1xer.at/pandora/ WakeBreaker].
 
After all this, I was able to build torpor's suggested dev demo app, [http://w1xer.at/pandora/ WakeBreaker].
 +
 +
 +
 +
[[Category:Development]]
 +
[[Category:Tutorials]]

Latest revision as of 16:46, 10 September 2013

This page lists various ways to install a compiler and development tools onto a Pandora.

C Development Tools PND

For compiling C/C++ programs that use SDL, GTK+, QT or Allegro, a PND is now available: repo. Running this PND gives your Pandora access to gcc and g++ without changing the root filesystem.

Code::Blocks PND

The Code::Blocks PND is based on infrastructure from the cdevtools package above, plus a set of updated libraries and the Code::Blocks IDE. Note that when you are building your software against libraries supplied with Code::Blocks that are not included in the Pandora base system, you will need to bundle them into your PND.

Using a full Linux distribution

Slackware for Pandora (SL4P) contains all development stuff the x86 version has: gcc, perl, ruby, python, php, java etc.. Get it here.

Using T4b's prepackaged toolchain

NOTE: This guide was written in 2011, and the instructions were not recently tested.

This is how I, T4b, set up my develepment environment. Of course it is on an SD card, the NAND is way to small. I recommend an 8GB card.

Installing the OS to an SD

This part was almost only copied from there: http://www.pandorabits.org/index.php?page=sd-installer
  1. Copy the PND to an SD card in the usual manner. You can get it from PandoraBits' download page.
  2. Copy a firmware image to the same card. You can get one from here, the file "pandora-rootfs.tar.bz2" should always be the latest image, older ones are under the "images" directory. I suggest using the newest one, I did it with the (at the moment of writing this) newest one, with HotFix5.
  3. Ensure that you have both SD cards in Pandora. It doesn't matter which one is in which slot.
  4. Run the PND. You will probably be asked for your password at this point. This is needed because the installer needs to run as root in order to partition and format the SD card.
  5. Follow the prompts that appear. You will be asked for the firmware image file, then asked to select the card that you want to use, then asked to choose how much space to allocate to the VFAT (Windows, see below) and swap partitions.
  6. Once you have gone through all the prompts, the firmware image will be installed to the SD card. This will take upwards of ten minutes. The larger the card, the longer it takes, so be patient.
  7. Once complete, you will be able to boot your Pandora from the SD card by powering it on with the card in the left slot. Please note that the first boot will take longer than usual, at least ten minutes. Cards of 16 GB or more seem to take a lot longer.

Getting the actual development environment

No you'll find out why I called it a "lazy" way.

  1. Download the newest archive from this thread in the German gp2x.de forum. Use google translator if necessary (at the time of writing this the newest one was this [direct download])
  2. Copy it on an SD which you insert into your Pandora
  3. cd /
    
  4. sudo tar -xjf path/to/archive.tar.bz2
    
  5. Reboot

Done!

Using Angstrom packages

NOTE: This guide was written for an older release of the Pandora firmware. Nowadays, opkg should fetch packages from the openpandora feed, and installing packages should not break the system. It is unknown if these instructions still work on a current firmware.

torpor described how to build apps directly on the Pandora.



You can try the following:

1. I found that the www.angstrom-distribution.org repo was very slow, so changed the config files in /etc/opkg/ to use us.feeds.angstrom-distribution.org instead.

2. Enable sshd, and ssh in from another machine. This helps keep control when things break. To get root:

sudo bash

3. Set up a root overlay on your SD card. This gives you a way to try again when things break, and there are other benefits. I added /home/ to the overlay also, by editing the "premount" script. To explain the extend terminology a bit, a "root overlay" is a loop mounted filesystem (on an SD) which goes over the top of (most of) your normal root filesystem. You can still read the files underneath it, but any writes / deletes are recorded only in the overlay filesystem. Your real root on the NAND is not modified at all. The "premount" shell script is used to mount your overlay, have a look in it to see how it works. You can sort of unmount them using umount -l (lazy umount), but I'm not sure if this is safe. The reliable way to unmount it is to reboot the Pandora!

4. Mount the overlay. Check this worked, with "mount" or "df".

5. Get new fresh package lists:

opkg update

6. ncurses packaging seems to be broken, and ncurses is important! So, I suggest to do this first (in the overlay), or be prepared for things to start breaking when it gets removed later. If it does get removed, make sure to install it again!

opkg install libncurses5

7. Install dev packages:

opkg install gcc gcc-symlinks make-dev binutils-dev cpp cpp-symlinks libgcc-dev
opkg install g++ g++-symlinks libstdc++-dev

8. Try to compile "hello world".

9. I had trouble with libsdl-image-1.2-dev and libpng / libpng-dev. libpng-dev from the repo conflicts with 'libpng' on the Pandora. That latter package is misnamed I guess, it should be called 'libpng-dev', only contains libpng-config and libpng12-config (dev tools, not essential) but task-pandora-core depends on it. The real libs are in libpng12-0 / libpng3. So I did this:

opkg remove libpng --force-depends
opkg install libpng-dev

10. Install extra dev libs:

opkg install libgles-omap3-dev
opkg install libsdl-1.2-dev libsdl-gfx-dev libsdl-image-1.2-dev libsdl-mixer-1.2-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev

Hopefully this will go smoothly if you've fixed the png conflict in step 9.

11. Install optional extra stuff, if you want them:

opkg install vim vim-syntax
opkg install libgles-omap3-demos
opkg install screen git rsync


The above was from memory, I didn't re-test all of it because it took too long even the first time! If you find other problems or quirks, please correct it.

After all this, I was able to build torpor's suggested dev demo app, WakeBreaker.