Setting up Code::Blocks to cross-compile in Ubuntu


Joined
Dec 1, 2006
Messages
948
Location
Scotland
Website
Visit site
DISCLAIMER
This guide was written by a total Linux noob for other Linux noobs and the solution was arrived at by trial, error, luck and flaw. If I've missed anything out or I'm doing something stupid or unnecessary please feel free to correct me :)

It will show you, step-by-step, how I set up a cross-compiler in Ubuntu 10.04 (Lucid Lynx) using Code::Blocks 8.02. It will probably work for other versions of Ubuntu and Code::Blocks but I've really no idea.

STEP 1
Download and install Cpasjustes cross-compiler tool chain following the instructions on THIS thread.


STEP 2
Install Code::Blocks. I used the Ubuntu Software Centre to install this. In Ubuntu goto Applications/Ubuntu Software Centre. Search for code::blocks and hit install.


STEP 3
Run Code::Blocks.
In Code::Blocks goto settings/compiler and debugger. Make a copy of the default compiler by hitting copy and renaming it Pandora.
step31.png


Now select the Pandora compiler[sup]1[/sup] and click the 'Linker Settings' tab and, using the ADD button[sup]2[/sup] add the following libraries one by one (case sensitive):
SDL
SDL_mixer
SDL_image
libts-1.0
step32.png


Next, in the 'Search Directories' tab, select the 'Compiler' tab and add the following lines:
/usr/local/pandora/arm-2009q3/arm-none-linux-gnueabi/include
/usr/local/pandora/arm-2009q3/usr/include
step33.png


Still in the 'Search Directories' tab select the 'Linker' tab and add the following lines:
/usr/local/pandora/arm-2009q3/lib
/usr/local/pandora/arm-2009q3/usr/lib
step34.png


Now, in the 'Toolchain Executables' tab (you might have to use the right scroll arrow[sup]1[/sup] to reveal this tab) press the '...' button to the right of the box below where it says 'Compilers installation directory'[sup]2[/sup] and navigate to /usr/local/pandora/arm-2009q3 and click open.
One by one, add in the 'Program Files' tab under each entry by navigating to /usr/local/pandora/arm-2009q3/bin as follows
C compiler : arm-none-linux-gnueabi-gcc
C++ compiler : arm-none-linux-gnueabi-g++
Linker for dynamic libs : arm-none-linux-gnueabi-g++
Linker for static libs : arm-none-linux-gnueabi-ar
Debugger : arm-none-linux-gnueabi-gdb
step35.png



That's it!

You should now be able to create Pandora executables :)
 
Last edited by a moderator:
The topic title is a bit misleading. You're only explaining how to configure a specific IDE such that it utilizes a cross-compiler.
 
Caine said:
The topic title is a bit misleading. You're only explaining how to configure a specific IDE such that is utilizes a cross-compiler.

You're right. I'll change it.

Could a mod change the title to 'Setting up Code::Blocks to cross-compile in Ubuntu' or the like?
Thanks :)
 
Last edited by a moderator:
Nice tutorial.

It's fun to see, even in these early days, all the different, helpful posts popping up.

Thanks!
 
I've written up some other useful info here

Yes it's intended for Penjin but, much of it should be helpful for anyone configuring your cross compiler. Unfathomable Depths, please feel free to add anything that you find useful to your guide.
 
Not trying to dig up an old thread but I didn't see much of a reason in creating a new one.

But back to the point.

My question is that if I was to compile a program I made using Irrlicht as my rendering engine which supports OpenGL ES would it work flawlessly?

Would I need to do anything special before setting it up or could I just port over any of my Irrlicht projects using this compiler?

Edit: If I was to also set up the Irrlicht linkers for the Pandora compiler it should work as long as I set my render OpenGL ES right?

Thanks in advance,
Kordman916

P.S: Thanks for the tutorial this is by far the easiest and most pain-free compiler setup I've ever done. :)
 
That's a good question. I will ask Cpas.

*edit* Cpas is obviously busy but sebt3 shoots, and he scores with this. Used my reply with quote so it's obvious what I'm talking about

http://www.gp32x.de/board/index.php?/topic/55876-rendering-engine/page__view__findpost__p__904587

*edit2* that isnt the right post. Just scroll up a bit to find the link for the Pandora Irrlicht package.
 
Last edited by a moderator:
Apologies for the mini-necro, but it's only a couple of weeks so hopefully I won't get into trouble!

I've followed everything in the OP (including a couple of minor tweaks to make it work), but now if I try to compile I get:

"/usr/lib/libSDL.so: file not recognized: File format not recognized"

Any ideas? Thanks in advance.
 
I was trying a SDL Application, so I tried Console Application this time, and got 1 error again:

"/usr/local/pandora/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lSDL"
 
Just as an aside - I tried following the guide to the letter on a fresh Ubuntu 10,04 install and it worked fine.

The one problem I did have was with Cpasjustes tool chain where it couldn't find the file arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 when running toolchain.sh (the repo was down). I just downloaded it from HERE and created a directory called 'tmp' in the same folder as toolchain.sh then ran toolchain.sh.
 
Unfathomable Depths said:
Just as an aside - I tried following the guide to the letter on a fresh Ubuntu 10,04 install and it worked fine.

The one problem I did have was with Cpasjustes tool chain where it couldn't find the file arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 when running toolchain.sh (the repo was down). I just downloaded it from HERE and created a directory called 'tmp' in the same folder as toolchain.sh then ran toolchain.sh.

Yeah I had to google the filename in order to get it. I probably should have mentioned but my machine is 64-bit, if that would have any effect on things?
 
Last edited by a moderator:
The guide only sets up the Pandora compiler. To compile on your own machine you have to set up the GCC compiler to work with SDL.

This should only be a matter of selecting the GCC compiler in 'settings/compiler and debugger' and adding
SDL
SDL_mixer
SDL_image

in the linker options.

If you have to install SDL use the Synaptic Package Manager under 'system/admin' in Ubuntu.

Remember to select which compiler you want to use in 'project/build options' in Code::Blocks :)
 
Unfathomable Depths said:
The guide only sets up the Pandora compiler. To compile on your own machine you have to set up the GCC compiler to work with SDL.

This should only be a matter of selecting the GCC compiler in 'settings/compiler and debugger' and adding
SDL
SDL_mixer
SDL_image

in the linker options.

If you have to install SDL use the Synaptic Package Manager under 'system/admin' in Ubuntu.

Remember to select which compiler you want to use in 'project/build options' in Code::Blocks :)

Well I'm trying to get my own machine to be able to compile Pandora builds. Forgive me, I assumed that's what this was for, considering the guide shows setting it up in Ubuntu. (?)
 
Last edited by a moderator:
Back
Top