Ändringar mellan två versioner
Här visas ändringar i "Cross-compiling on an Ubuntu machine for the Raspberry Pi" mellan 2014-09-30 22:25 av Patric Jensfelt och 2014-09-30 22:28 av Patric Jensfelt.
Cross-compiling aon an Ubuntu machine for the Raspberry Pi
This page describes how you can cross compile for the Raspberry Pi on a Ubuntu machine. Most of it is taken from
http://stackoverflow.com/questions/19162072/installing-raspberry-pi-cross-compiler
sudo apt-get install git rsync cmake libc6-i386 lib32z1 lib32stdc++6mkdir ~/raspberrypicd ~/raspberrypigit clone git://github.com/raspberrypi/tools.gitmkdir ~/raspberrypi/rootfsrsync -rl --delete-after --safe-links pi@192.168.1.PI:/{lib,usr} $HOME/raspberrypi/rootfs where 192.168.X.Y should be replaced with the IP address of your Pi.
You need about 2.8GB for all the files and some time for downloading it all.
Add
export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin at the end of the file ~/.bashrc. You can edit the file with gedit ~/.bashrcLog out and log in again gedit ~/raspberrypi/pi.cmake Add this to the file
SET(CMAKE_SYSTEM_NAME Linux)SET(CMAKE_SYSTEM_VERSION 1)SET(CMAKE_C_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)SET(CMAKE_CXX_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/raspberrypi/rootfs)SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) Now we test it
cd ~/git clone https://github.com/jameskbride/cmake-hello-world.git cd cmake-hello-world mkdir build cd build cmake -D CMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake ../ make scp CMakeHelloWorld pi@192.168.X.Y:/home/pi/ ssh pi@192.168.X.Y ./CMakeHelloWorldwhere again 192.168.X.Y should be replaced with the IP address of your Pi.