<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pandorawiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Klaxon</id>
	<title>Pandora Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://pandorawiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Klaxon"/>
	<link rel="alternate" type="text/html" href="https://pandorawiki.org/Special:Contributions/Klaxon"/>
	<updated>2026-05-03T01:06:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.32.0-alpha</generator>
	<entry>
		<id>https://pandorawiki.org/index.php?title=Cross-compiler&amp;diff=9622</id>
		<title>Cross-compiler</title>
		<link rel="alternate" type="text/html" href="https://pandorawiki.org/index.php?title=Cross-compiler&amp;diff=9622"/>
		<updated>2012-01-23T22:47:09Z</updated>

		<summary type="html">&lt;p&gt;Klaxon: /* Instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;One of the ways to compile your applications to the [[ARM]] architecture is through a cross-compiler.  This will allow you to compile applications for the [[ARM]] architecture on a different system.  This is good if you want to develop for the Pandora but are still waiting to receive it, or if you have an application that takes too much memory or drive-space to effectively compile on the Pandora itself.  At the moment, there are 4 different ways you can set up a cross compiling environment.&lt;br /&gt;
&lt;br /&gt;
These options are sorted in '''order of preference'''.  Option two is preferred over three, etc.&lt;br /&gt;
&lt;br /&gt;
== Ivanovic's CodeSourcery-Based Cross Compiler ==&lt;br /&gt;
&lt;br /&gt;
{{warning|This toolchain won't work on a pure 64bit system.}}&lt;br /&gt;
http://www.gp32x.com/board/index.php?/topic/58443-crosscompiler-toolchain-based-on-openpandora-org-ipks/page__view__findpost__p__936553&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sebt3's Yactfeau ==&lt;br /&gt;
&lt;br /&gt;
http://www.gp32x.com/board/index.php?/topic/58490-yactfeau/&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
* This toolchain works on a 64-bit system, assuming 32-bit compatibility libraries are installed.  On Debian, they can be installed with:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;aptitude install ia32-libs-dev&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the Toolchain ===&lt;br /&gt;
&lt;br /&gt;
# If you don't already have a Linux-based system you want to use, download and run the [http://sebt3.openpandora.org/buildtools/?f=pandora-virtualbox-image.7z Pandora VirtualBox Image].&lt;br /&gt;
# Remove your previous installation by running:&lt;br /&gt;
#:&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sudo rm -rf /usr/local/angstrom/arm/*&amp;lt;/source&amp;gt;&lt;br /&gt;
# Download the [http://sebt3.openpandora.org/buildtools/?f=pandora-toolchain-20110313.tar.bz2 toolchain] ([http://sebt3.openpandora.org/buildtools/pandora-toolchain-20110313.torrent torrent]).&lt;br /&gt;
# Unpack the toolchain:&lt;br /&gt;
#: &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sudo tar -C /usr/local/angstrom/arm -xjf pandora-toolchain-20110313.tar.bz2&amp;lt;/source&amp;gt;&lt;br /&gt;
# Fix file permissions:&lt;br /&gt;
#: &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sudo chown -R &amp;lt;your-name&amp;gt;.&amp;lt;your-name&amp;gt; /usr/local/angstrom/arm&amp;lt;/source&amp;gt;&lt;br /&gt;
# Install the toolchain:&lt;br /&gt;
#: &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;$ bash /usr/local/angstrom/arm/scripts/installer.sh&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Common Errors ===&lt;br /&gt;
&lt;br /&gt;
==== No such libmpfr.so.1 ====&lt;br /&gt;
&lt;br /&gt;
If you get the following error message while trying to compile projects:&lt;br /&gt;
 error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory&lt;br /&gt;
You can fix that by commenting out the following lines of the &amp;quot;environment-setup&amp;quot; file:&lt;br /&gt;
 # if [ ! -e &amp;quot;/usr/lib/libgmp.so.3&amp;quot; ] || [ ! -e &amp;quot;/usr/lib/libmpfr.so.1&amp;quot; ];then&lt;br /&gt;
 (...and 7 lines later...)&lt;br /&gt;
 #fi&lt;br /&gt;
&lt;br /&gt;
== DJWillis's Cross Compiler ==&lt;br /&gt;
&lt;br /&gt;
You could try the easy-to-setup environment described on [http://blogs.distant-earth.com/wp/?p=109 DJWillis' blog] which is suitable for 32bit Linux.  However, the process is also expanded further below.&lt;br /&gt;
&lt;br /&gt;
DJ-Willis's cross-compiling [[toolchain]] page is really awesome, but it has a few holes I'd like to patch up in this guide.  Here, we'll be creating a chroot jail to install the toolchain on with a Debian Squeeze system.  This will allow you to use DJ Willis's toolchain without mucking with your normal system at all.  Of course, it's obviously overkill, but, hey, what's technical insight without it?&lt;br /&gt;
&lt;br /&gt;
The commands are detailed exactly as you'll need to enter them, from start to finish, to compile Pandora native apps on your host system. They'll run really well on the Pandora, but they won't run on your host.  To do that, you'll need to compile them for the host system, which is a different, but much simpler, process.&lt;br /&gt;
&lt;br /&gt;
=== Resources ===&lt;br /&gt;
&lt;br /&gt;
The following are generic resources you might want to read up on to make better sense of the instructions that follow.&lt;br /&gt;
&lt;br /&gt;
* http://blogs.distant-earth.com/wp/?p=109&lt;br /&gt;
* http://wiki.debian.org/chroot&lt;br /&gt;
* http://wiki.debian.org/Debootstrap&lt;br /&gt;
* http://pandorapress.net/2009/03/11/so-you-want-to-try-angstrom/&lt;br /&gt;
&lt;br /&gt;
=== Instructions ===&lt;br /&gt;
&lt;br /&gt;
The following instructions are for a (Debian) host system that you have root access to.  The system-inside-a-system you're building will probably take about 1 GiB of hard-drive space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~ &lt;br /&gt;
mkdir pandora_cross_compiler&lt;br /&gt;
su -c &amp;quot;apt-get install debootstrap chroot&amp;quot; # get the dependencies&lt;br /&gt;
su -c &amp;quot;debootstrap --arch=i386 squeeze pandora_cross_compiler&amp;quot; # see the debootstrap wiki&lt;br /&gt;
su -c &amp;quot;LANG=C chroot pandora_cross_compiler /bin/bash&amp;quot; # see the chroot wiki&lt;br /&gt;
apt-get install bzip2 unzip curl libmpfr-dev&lt;br /&gt;
ln -s /usr/lib/libmpfr.so /usr/lib/libmpfr.so.1&lt;br /&gt;
cd ~&lt;br /&gt;
wget http://djwillis.openpandora.org/toolchains/20100611-i686-linux-armv7a-linux-gnueabi-toolchain-openpandora.tar.bz2 http://djwillis.openpandora.org/toolchains/DisplayImage.zip&lt;br /&gt;
tar -C / -xjf 20100611-i686-linux-armv7a-linux-gnueabi-toolchain-openpandora.tar.bz2&lt;br /&gt;
unzip DisplayImage.zip&lt;br /&gt;
. /usr/local/angstrom/arm/environment-setup&lt;br /&gt;
arm-angstrom-linux-gnueabi-gcc -Wall DisplayImage.c -o DisplayImage -l SDL&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations!  You just compiled an ARM-based executable!  It won't run on the Intel 32-bit system you're testing it on!  To see it not run on your normal system, run:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
su -c &amp;quot;cp pandora_cross_compiler/root/DisplayImage .; cp pandora_cross_compiler/root/test.bmp .&amp;quot;&lt;br /&gt;
su -c &amp;quot;chown (your user):(your group) DisplayImage test.bmp&amp;quot;&lt;br /&gt;
./DisplayImage&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You compiled it for the Pandora.  If you have a Pandora, copy it to the Pandora and it should work.&lt;br /&gt;
&lt;br /&gt;
To get back into your [[chroot]] jail to compile more programs that you can copy then back into your normal system and your Pandora, you'll just need to run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;su -c &amp;quot;LANG=C chroot pandora_cross_compiler /bin/bash&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Bam!  You're back in the [[chroot]].&lt;br /&gt;
&lt;br /&gt;
Consider using QEmu to create an [[ARM]] VM for testing the programs.  See the Pandora Press link for those instructions.  Also see the comments for getting the QEmu image to run in Linux.&lt;br /&gt;
&lt;br /&gt;
== Using the SDK-Installer ==&lt;br /&gt;
&lt;br /&gt;
Cpasjuste on the [[GP32X]] forums has made a nice script to get a build environment and libraries installed on Ubuntu/Debian systems. Download links and a brief explanation can be found in [http://www.gp32x.com/board/index.php?/topic/52343-pandora-sdk-installer/ this thread].&lt;br /&gt;
&lt;br /&gt;
A new approach at creating a crosscompiler toolchain was done by Ivanovic. It is based previous codesourcery toolchain attempts but uses the packages that openpandora relies on, too. It should work for every Linux system that can make use of x86 binaries (meaning x86 systems as well as amd64 systems with multilib support). A more detailed explanation of the SDK as well as the scripts required to install it are available in [http://www.gp32x.com/board/index.php?/topic/58443-crosscompiler-toolchain-based-on-openpandora-org-ipks/ this thread].&lt;br /&gt;
&lt;br /&gt;
== Manual Installation ==&lt;br /&gt;
&lt;br /&gt;
If you want a bit more control, Code-Sourcery hosts a bunch of cross-compiling suites for various platforms on their site, some editions have to be paid for, but they do have &amp;quot;lite&amp;quot; editions without support that are completely free.&lt;br /&gt;
&lt;br /&gt;
Head up onto [http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3057 here]. The recommended release at time of writing is [http://www.codesourcery.com/sgpp/lite/arm/portal/release1039 2009q3].&lt;br /&gt;
&lt;br /&gt;
Installers are available for Linux and Windows. Alternatively, download and unpack the tarball, then add the bin directory to your path.&lt;br /&gt;
&lt;br /&gt;
=== Example: Setting up a cross compiler using Code Sourcery, and doing so inside a VM ===&lt;br /&gt;
&lt;br /&gt;
Skeezix makes some notes in [http://www.rjmitchell.ca/~jeff/blog2009/2010/06/02/getting-up-and-going-with-a-crosscompiler-for-pandora-arm-in-5-minutes/ his blog] about setting up CodeSourcery's prebuilt toolchain in a VM very quickly.&lt;br /&gt;
&lt;br /&gt;
== Possible Problems ==&lt;br /&gt;
&lt;br /&gt;
If you get an error when compiling along of the lines of &amp;quot;error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory&amp;quot;, run &lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;apt-get install libmpfr1ldbl&amp;lt;/source&amp;gt; and attempt to compile again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Klaxon</name></author>
		
	</entry>
</feed>