pukster
Posts: 32
Joined: Sat Sep 14, 2013 7:44 am

We need a cross compilation tutorial

Thu Nov 28, 2013 7:49 am

Before anyone lashes out at me, I did google this problem, I looked all over Stack Overflow and I spent about 15 minutes searching it in the forums here, but I have not found a suitable tutorial on how to cross compile a program for the raspi. I found great sites on which cross compilers to download, like this one

raspi tools
and how to set up a cross compiler, like this one

Installing Raspberry Pi Cross-Compiler

But then everyone is completely silent when it comes to what to do with the cross compiler once it's up and running. I think what would go a long way is if someone was kind enough to put up some sticky tutorial posts demonstrating the step by step process of installing, for example, omxplayer. Specifically, it should outline how to modify the conventional

./configure
make
sudo make install

commands such that they become aware of the cross compilation process.

MattF
Posts: 55
Joined: Tue Feb 12, 2013 10:01 am

Re: We need a cross compilation tutorial

Thu Nov 28, 2013 11:22 pm

A rough answer from my history:

rm -rf ~/311MOD && mkdir ~/311MOD && make -j2 ARCH=arm CROSS_COMPILE=${CCPREFIX} && make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=/home/apf/311MOD modules_install && cp arch/arm/boot/zImage /home/apf/Jul4 && cd ~/311MOD && tar jcvf ../Jul4/Sep25.tar.bz2 .

echo $CCPREFIX /home/apf/PI/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-

I know it's a little terse, but perhaps may point in the right direction

Oh yes, and menu config is

make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig

pukster
Posts: 32
Joined: Sat Sep 14, 2013 7:44 am

Re: We need a cross compilation tutorial

Fri Nov 29, 2013 12:43 am

Thank you, it is a step in the right direction

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6085
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: We need a cross compilation tutorial

Fri Nov 29, 2013 2:37 am

Take a look at the cross linux from scratch arm sysroot tutorials.
http://cross-lfs.org/view/clfs-sysroot/arm/index.html

It will depend on the software, so run ./configure --help and read the output carefully.

In general, in terms of generic autotools packages, you do this:

Code: Select all

./configure --build=${CLFS_HOST} --host=${CLFS_TARGET}
make
Where CLFS_HOST="$(echo $MACHTYPE | \
sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" and CLFS_TARGET coresponds to your target tuplet.

Up to you to figure out how you want to install it after it's compiled (you can use --prefix and install to the sd card).

I haven't looked at omxplayer recently, but it when I did, it wasn't a proper autotools package and I doubt it is now. To compile such software, you need to go into the makefile and know what you're doing (how to use makefiles and how to use gcc).

limpens
Posts: 38
Joined: Thu Sep 13, 2012 1:15 pm

Re: We need a cross compilation tutorial

Sat Nov 30, 2013 7:54 am

You might take a look at bsquask.com

Once setup you'll have a nice buildroot based cross compile environment.

Return to “Advanced users”