rrolsbe
Posts: 40
Joined: Fri Aug 12, 2011 4:09 pm

How is everyone compiling the armhf code?

Sun Jul 15, 2012 9:09 pm

Maybe this is discussed somewhere on this Raspian forum but this thread title should stand out.

Since compiling code on the Pi itself would be very time consuming, what development environment are developers using? a virtual machine, qemu emulation etc? Since code is being compiled to use the Raspberry Pi floating point hardware, can this be done with a cross compiler running on an x86 architecture?

Thanks Very Much for any insight in advance!!
Regards, Ron

User avatar
mpthompson
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
Contact: Website

Re: How is everyone compiling the armhf code?

Sun Jul 15, 2012 9:17 pm

Plugwash has a thread in this forum about using usermode QEMU to build Raspbian code within a VM suitable to run on a i368/amd64 based system. That would probably be the best place to start. Others have used distcc with success, but I don't know much about that solution.

For the Raspbian project itself we are following Debians lead with using native build environments. We use a bank of eight Freescale iMX53 Quick Start Boards that each have 1 GHz ARM CPU, 1GB or RAM and a fast SATA attached hard drive. They aren't fast compared to a modern mult-core desktop system, but they can handle building large Debian packages which would choke the Raspberry Pi.

Iori Branford
Posts: 5
Joined: Wed Aug 03, 2011 4:28 pm

Re: How is everyone compiling the armhf code?

Mon Jul 16, 2012 6:13 pm

So far, my only successful cross-compile was achieved as follows.

On my host machine:
  • git clone the tools and firmware repos from github.com/raspberrypi
  • mkdir /mnt/raspi && sshfs raspberry-pi:/ /mnt/raspi -o allow_other
  • write a CMake toolchain file according to http://www.cmake.org/Wiki/CMake_Cross_Compiling , with compilers set to the ones in ${TOOLS}/arm-bcm2708/x86-linux64-cross-arm-linux-hardfp, and CMAKE_FIND_ROOT_PATH set to /mnt/raspi
  • cmake . -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} && make
  • copy newly built program to somewhere on the RPi via /mnt/raspi
Then on RPi with darkbasic's latest image:
  • ln /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 (or else the program will not be found when you actually try to run it, as it will expect to find the latter file but this image has only the former)
  • add /opt/vc into /etc/ld.so.conf (on this image, into a new file /etc/ld.so.conf.d/vc.conf)
  • ldconfig
  • run the program

outsider
Posts: 21
Joined: Tue Jul 03, 2012 2:16 pm

Re: How is everyone compiling the armhf code?

Tue Jul 17, 2012 4:01 am

I created a blog post on how I compile on my desktop over here: http://superpiadventures.wordpress.com/ ... vironment/

Grey Whittney
Posts: 10
Joined: Fri Jul 13, 2012 6:10 pm
Location: PA, USA

Re: How is everyone compiling the armhf code?

Fri Jul 20, 2012 3:33 pm

@Iori Branford; Thank you, thank you, thank you. I've been fighting with my Ubuntu box for cross compiling, and had issues with the rootfs not having /lib/ld-linux.so.3.

I've been using the images from: http://www.linuxsystems.it/2012/06/rasp ... mal-image/

in my rootfs copy, root directory I needed, and Pi root:

Code: Select all

ln -s lib/arm-linux-gnueabihf/ld-2.13.so lib/ld-linux.so.3
Other than that, I've followed, for crosstool-ng: http://www.bootc.net/archives/2012/05/2 ... pberry-pi/ (maybe not needed if you use the tools git repository)

Some of @outsider's work :http://superpiadventures.wordpress.com/ ... vironment/ (I think that needs to be: http://superpiadventures.com/2012/07/de ... vironment/ now )

and some of: http://biffengineering.com/wiki/index.p ... piler_Jail

Some of this I've used from other devices (not pi..): http://russelldavis.org/2010/10/20/sett ... r-zubuntu/
And Russell has more Pi related items here:
http://russelldavis.org/2012/01/28/sett ... mu-part-3/

I don't think the people around me understand when I say that I'm happy a c program on my Pi prints "Hello World" #grin#

--
~ Grey

Beini
Posts: 16
Joined: Mon Jul 09, 2012 4:26 pm

Re: How is everyone compiling the armhf code?

Sat Jul 21, 2012 10:41 am

I use distcc and an cross compiler. Typically less problems than with attempting to strictly cross compile since configure scripts run natively.
http://www.raspberrypi.org/phpBB3/viewt ... 66&t=11803

I played around with qemu-user, but found that pretty much like compiling on the pi speedwise.

Regular cross compiler requires switches to the toolchain. patches etc.

jorisvergeer
Posts: 6
Joined: Wed Jul 18, 2012 3:33 pm

Re: How is everyone compiling the armhf code?

Sat Jul 21, 2012 11:41 am

I have build my toolchain using crosstool-ng

It was pretty much the same as the toolchain bootc uses:
http://www.bootc.net/archives/2012/05/2 ... pberry-pi/

I changed the float type to hard and i specified more specific RPi cpu arch and tune options.
Also make sure you use the right eglibc and linux version.

I attached my configuration if you want to build the same as mine. (Make sure you check the directories)
Attachments
.config.tar.gz
configuration file used
(3.33 KiB) Downloaded 2684 times

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 19 guests