Solution: How to Cross Compile on Ubuntu x86_64 for Raspberry Pi

Thomas D. Dean
Wed Feb 27 03:36:00 GMT 2013

On Ubuntu:

1.  mount the RaspberryPi SD card image partition 2 on /mnt
     decide a better directory later
2.  Run the script
## build the object file
arm-linux-gnueabihf-gcc-4.6 -c \
     -nostdlib -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm -Wl,-t  \
     hello.c -o helloc.o
## link
arm-linux-gnueabihf-gcc-4.6 -o helloc helloc.o \
     -nostdlib -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard \
     -marm -Wl,-t  \
     /mnt/usr/lib/arm-linux-gnueabihf/crt1.o \
     /mnt/usr/lib/arm-linux-gnueabihf/crti.o \
     /mnt/usr/lib/gcc/arm-linux-gnueabihf/4.6/crtbegin.o \
     /mnt/lib/arm-linux-gnueabihf/ \
     /mnt/lib/arm-linux-gnueabihf/ \
     /mnt/usr/lib/arm-linux-gnueabihf/libc_nonshared.a \
     /mnt/lib/arm-linux-gnueabihf/ \
     /mnt/usr/lib/gcc/arm-linux-gnueabihf/4.6/crtend.o \
     /mnt/usr/lib/arm-linux-gnueabihf/crtn.o \

This produces an image that will execute on the Raspberry Pi.

There seems to be a problem with either the crtxxx.o files or the libs.

Where do I file a bug report?

Tom Dean

More information about the Gcc-help mailing list