Linux Toolchain Help


Enverex

Active Member
Joined
Oct 18, 2005
Messages
530
Age
39
Location
Worcester, UK
Website
robotbutler.org
I thought as I know very little about coding (I've done substantial PHP which amounts to nothing really, but I've done some basic stuff for the Wine project) I thought I'd see what apps port cleanly to ARM so they are near enough ready to roll when the Pandora comes out, or at least with very little effort.

At the moment I'm on an x86_64 Linux machine running Gentoo (laptop is x86_64 running Arch) and I was wondering if anyone knows of an easy way to cross compile to ARM to see if the apps actually compile cleanly. Unfortunately I've not done any work with cross-compiling before, short of x86_64 > i686 for DistCC.
 
Enverex said:
I thought as I know very little about coding (I've done substantial PHP which amounts to nothing really, but I've done some basic stuff for the Wine project) I thought I'd see what apps port cleanly to ARM so they are near enough ready to roll when the Pandora comes out, or at least with very little effort.

At the moment I'm on an x86_64 Linux machine running Gentoo (laptop is x86_64 running Arch) and I was wondering if anyone knows of an easy way to cross compile to ARM to see if the apps actually compile cleanly. Unfortunately I've not done any work with cross-compiling before, short of x86_64 > i686 for DistCC.

Look here: http://pandorawiki.org/Setting_up_a_cross-compiler
 
Last edited by a moderator:
The Gentoo Pandora Project has already done a lot of the work for you, its even easier if you are already using Gentoo on your host machine.

Look here for starting the process:
http://gentoo.openpandora.org/wiki/index.php/Create_Image

Join us in IRC
FreeNode#gentoo-pandora
 
viridior said:
The Gentoo Pandora Project has already done a lot of the work for you, its even easier if you are already using Gentoo on your host machine.

Look here for starting the process:
http://gentoo.openpandora.org/wiki/index.php/Create_Image

Join us in IRC
FreeNode#gentoo-pandora

Just a query on this though, I don't intend to use Gentoo on my Pandora, I intend to use whatever the closest thing to an official distro is (I want to go with max compatability here) so I'm purely looking at compiling for ARM, not installing Gentoo or getting up a Gentoo env for the Pandora, is that what that guide is or am I mixing it up?
 
Last edited by a moderator:
Enverex said:
viridior said:
The Gentoo Pandora Project has already done a lot of the work for you, its even easier if you are already using Gentoo on your host machine.

Look here for starting the process:
http://gentoo.openpa...hp/Create_Image

Join us in IRC
FreeNode#gentoo-pandora

Just a query on this though, I don't intend to use Gentoo on my Pandora, I intend to use whatever the closest thing to an official distro is (I want to go with max compatability here) so I'm purely looking at compiling for ARM, not installing Gentoo or getting up a Gentoo env for the Pandora, is that what that guide is or am I mixing it up?

Personally I dont think it matters, the distro doesnt have any effect that ive ever seen. You know linux is linux, no mater if you run the cross compiler gcc exe's on gentoo or billybob's linux extreme your going to get the same result.
I use opensuse as my distro, but the choice to do so has nothing to do with pandora. Its just the distro Ive gotten used to.
 
Last edited by a moderator:
Well it was more down to packaging and general support, i.e. how easy something is to install without having to wait for someone to re-package it up for my specific distro, etc.

Regarding my cross-compiling distro question: After reading through the docs it explains how to build an ARM toolchain and then how to emerge Gentoo packages, but no mention of cross compiling random apps from source which is what I was looking for.
 
Enverex said:
Well it was more down to packaging and general support, i.e. how easy something is to install without having to wait for someone to re-package it up for my specific distro, etc.
code sourcery's toolchsin is distro neutral, you just tell it where to install

Enverex said:
Regarding my cross-compiling distro question: After reading through the docs it explains how to build an ARM toolchain and then how to emerge Gentoo packages, but no mention of cross compiling random apps from source which is what I was looking for.

Use this script by cpasjuste: http://mydedibox.fr/_stuff/pandora/
It will get the code sourcery toolchain and some basic libs like SDL.

Then try here for setting up an application/makefile
http://wiki.gp2x.org/wiki/Development_Tutorials

Its pretty much the same ideas except you dont want to compile statically. Do you have any experience using makefiles? The real difference is putting the paths to the the gcc/g++ exe's, include path, and library path.
For example your normal x86 build might be:
/usr/local/bin
/usr/local/include
/usr/local/lib

where cross-compiling it might be:
/opt/arm-none-gcc/bin
/usr/arm-none-gcc/include
/usr/arm-none-gcc/lib

Normally i set up my makefiles with an PREFIX variable which has the common path i.e PREFIX=/usr/arm-none-gcc
 
Last edited by a moderator:
Yeah, I have some experience with them. I was downloading Codesorc when it was first suggested, it's just their site is painfully slow it seems. Lets hope it works as it says ia32 (don't they mean x86? ia32 is 32bit Itanium instructions...) and I'm running x86_64. I'll let you know how I get on.
 
Enverex said:
Yeah, I have some experience with them. I was downloading Codesorc when it was first suggested, it's just their site is painfully slow it seems. Lets hope it works as it says ia32 (don't they mean x86? ia32 is 32bit Itanium instructions...) and I'm running x86_64. I'll let you know how I get on.

ia32 is just intel 32 bit instruction set, i dont know why they use that specific identifier. Maybe they only like intel processors.
http://en.wikipedia.org/wiki/IA-32
32 bit apps should still work on 64 bit
 
Last edited by a moderator:
Ah, good to see my link to IA64 was partially wrong then. Normally 32>64bit compat is fine, I was just a little concerned when dealing with cross compiling due to the sensitive nature of compilers but I'll take your word for it :)

I just noticed your sig Pickle:
"Current Project: Pirates Remake using SDL
Current Status:
01/08/08 Things are progressing. Nav. mode is basically done. Working on in-town menu options."

How's that going and any updates since '08? lol
 
Enverex said:
Ah, good to see my link to IA64 was partially wrong then. Normally 32>64bit compat is fine, I was just a little concerned when dealing with cross compiling due to the sensitive nature of compilers but I'll take your word for it :)

How's that going and any updates since '08? lol

Opps that should be an 09. Its does go slowly though :)
 
Last edited by a moderator:
I was thinking that it may be eaisest to work from within an ARM environment to do this. Would it be feasible to use QEmu to create an ARM guest, install an Arm distro in there and build from there?
 
Enverex said:
I was thinking that it may be eaisest to work from within an ARM environment to do this. Would it be feasible to use QEmu to create an ARM guest, install an Arm distro in there and build from there?

Thats the next best solution if your trying to test you application in an ARM environment. But i dont recommend it's not really needed. I know of one person who has done this to help fix arm alignment problems since he didnt have a ARM device. But if i knew what I know now, I could have identified those problems directly from the Gp2X itself.
With all the things ive cross compiled for pandora all of them have worked as is. With the built in keyboard and modern ARM core, if one wasnt cross compiling you might not even know it was a ARM core. What im trying to say is if you are trying to develop an application do it in an x86 environment, your almost guaranteed that it will run on the pandora when you need to do the actual port.
 
Last edited by a moderator:
Well it was more because as it stands I have to reconfigure all the makefiles and such rather than just being able to compile it, seems like it's more effort to start off with but less in the long run, although I may be missing something. I have the toolchain and such installed but I honestly can't remember the easiest way to set ./configure etc to use ARM based details rather than what my system actually is at the moment...
 
Enverex said:
Well it was more because as it stands I have to reconfigure all the makefiles and such rather than just being able to compile it, seems like it's more effort to start off with but less in the long run, although I may be missing something. I have the toolchain and such installed but I honestly can't remember the easiest way to set ./configure etc to use ARM based details rather than what my system actually is at the moment...

Ah so you want to use autotools/automake, I will post some wrapper scripts that I use that make life easier later tonight.
 
Last edited by a moderator:
Well I managed to get a Debian ARM system running in QEmu but it keeps locking up for a minute or so after it's tried to write a small amount of data. Reading is fine but it's almost like once it hits several MB it then freezes for a while and then unlocks again. Anyone encountered this before? Example of what happens - http://xnode.org/i/?p=24 - Which is a shame because if it worked properly it would be excellent.
 
Ok scrap that, looks like there was an issue with the disk image I was using. Created a new one, formatted it and it works fine.

Ok, now that I can compile apps on ARM for ARM, what is the best way of packaging them up for people to test on Pandora machines? Shall I just zip up the compiled source folder for anyone with time to download and run, to see if it works?
 
Pickle is right, it really doesn't matter what your host system is when cross-compiling except maybe to the extent of what tools it may have for you already. For Gentoo that is crossdev & crossdev-wrappers, OE has some tools, Debian/Ubuntu, etc, etc. Some are better then others, but they all are just to make it a bit easier to cross-compile and for the most part many of them are just scripts anyway.

I would say its actually a bit more important to identify what your target client system is, that way you are compiling software with the right filesystem references/libraries and therefore you can just "drop it in" when you get the hardware.
 
Enverex said:
Shall I just zip up the compiled source folder for anyone with time to download and run, to see if it works?
Any zip format would be fine.

Heres an script I use for any project i come across that uses autotools, in this instance its dosbox
My configure script:
Code:
#!/bin/sh

PREFIX=/mythtv/media/devel/toolchains/omap_cs/arm-2007q3
HOST=arm-none-linux-gnueabi
TARGET=arm-none-linux-gnueabi

export PREFIX
export HOST
export TARGET

PATH=$PATH:$PREFIX/bin
export PATH

./configure --prefix=$PREFIX --with-sdl-exec-prefix=$PREFIX \
        --host=$HOST \
        --target=$TARGET \
        --build=`uname -m` \
        CPPFLAGS="-I$PREFIX/include" \
        CXXFLAGS="-O3 -fomit-frame-pointer" \
        LDFLAGS="-L$PREFIX/lib" \
        --disable-core-inline

My make script:
Code:
#!/bin/sh

PREFIX=/mythtv/media/devel/toolchains/omap_cs/arm-2007q3

PATH=$PATH:$PREFIX/bin
export PATH

make
 
Last edited by a moderator:
I was trying to use CodeSorcerery and such but honestly couldn't get my head around it (I'm probably missing something obvious but I learn best by example). Does anyone have any laymen's guides for this? I'm sure i'll pick it up quickly but getting started is always the hard part.

I got ARM Debian working in QEMU well, but compiling was so painfully slow that a basic app (a tiny little thing) took over an hour to compile which isn't good and has put me off compiling anything larger via that method (which is a shame because it was ideal really, no cross-compiling nonsense).
 
Back
Top