Last active
April 22, 2016 21:11
-
-
Save jvcleave/8489b3ec5897eb1a26a2 to your computer and use it in GitHub Desktop.
MAC WITH DEBIAN VM CROSS COMPILER FOR RPI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ON THE RPI (if you haven't downloaded openFrameworks) | |
$ cd | |
$ curl -O http://www.openframeworks.cc/versions/v0.8.4/of_v0.8.4_linuxarmv6l_release.tar.gz | |
$ mkdir openFrameworks | |
$ tar vxfz of_v0.8.4_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1 | |
$ cd /home/pi/openFrameworks/scripts/linux/debian_armv6l | |
$ sudo ./install_dependencies.sh | |
ON THE MAC: | |
INSTALL VIRTUALBOX | |
INSTALL DEBIAN 32BIT SQUEEZE | |
http://gensho.acc.umu.se/cdimage/archive/7.6.0-live/i386/iso-hybrid/debian-live-7.6.0-i386-standard.iso | |
Use Bridge Mode (allows access to local network without NAT) | |
No Desktop Needed | |
ON THE DEBIAN VM: | |
NOTE:BELOW INSTRUCTIONS USE pi AS DEBIAN USER | |
ADD USER TO ROOT GROUP SO CAN USE APT-GET | |
$ su | |
$ visudo | |
# User privilege specification | |
root ALL=(ALL:ALL) ALL | |
pi ALL=(ALL:ALL) ALL | |
$ apt-get install debian-keyring debian-archive-keyring | |
# apt-key update | |
Virtualbox will try and boot into PAE mode by default which crashes | |
$ sudo nano /etc/default/grub | |
GRUB_DEFAULT=2 | |
$ sudo update-grub | |
STOP APT FROM LOOKING AT CD FOR UPDATES | |
$ sudo nano /etc/apt/sources.list | |
comment out using # or delete line | |
# deb cdrom:[Debian GNU/Linux 7 _Wheezy_ - Official Snapshot i386 LIVE/INSTALL Binary 20140723-18:00]/ wheezy main | |
$ sudo apt-get update | |
MOUNT PI ON DEBIAN | |
Assumes Pi has Samba server running with mount point as / | |
https://gist.github.com/jvcleave/f41132324ca75c2268f9 | |
$ sudo apt-get install cifs-utils | |
$ sudo mkdir /media/Data | |
$ sudo nano /etc/fstab | |
ADD LINE (jvcrpi.local is RPi Network address - can be IP) | |
//jvcrpi.local/Data /media/Data cifs credentials=/home/pi/.smbcredentials,iocharset=utf8 0 0 | |
CREATE FILE TO STORE SMB USER/PASS | |
$ nano /home/pi/.smbcredentials | |
#RPi samba user/pass | |
username=pi | |
password=pi | |
MOUNT PI | |
$ sudo mount -a | |
TEST | |
$ ls -al /media/Data | |
SETUP COMPILER | |
cd | |
sudo apt-get install git | |
git clone git://github.com/raspberrypi/tools.git --depth=1 | |
mv tools/ RPI_TOOLS | |
mkdir RPI_ROOT | |
mkdir -p RPI_ROOT/usr/include | |
mkdir -p RPI_ROOT/usr/lib | |
mkdir -p RPI_ROOT/usr/share | |
cp -Rv /media/Data/usr/include RPI_ROOT/usr/ | |
cp -Rv /media/Data/usr/lib RPI_ROOT/usr/ | |
cp -Rv /media/Data/usr/share RPI_ROOT/usr/ | |
cd RPI_ROOT | |
ln -s /media/Data/etc/ etc | |
ln -s /media/Data/lib/ lib | |
ln -s /media/Data/opt/ opt | |
//SET ENVIRONMENT VARIABLES | |
export GST_VERSION=1.0 | |
export RPI_ROOT=/home/pi/RPI_ROOT | |
export RPI_TOOLS=/home/pi/RPI_TOOLS | |
export PLATFORM_OS=Linux | |
export PLATFORM_ARCH=armv6l | |
export PKG_CONFIG_PATH=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$RPI_ROOT/usr/share/pkgconfig:$RPI_ROOT/usr/lib/pkgconfig | |
//FIX ABSOLUTE PATHS IN ~/RPI_ROOT/usr/libs | |
cd | |
wget https://gist.githubusercontent.com/jvcleave/8489b3ec5897eb1a26a2/raw/bafa359d35123c7941447f480a09e0fe0e94f151/fixQualifiedLibraryPaths.sh | |
chmod +x fixQualifiedLibraryPaths.sh | |
sudo ./fixQualifiedLibraryPaths.sh $RPI_ROOT $RPI_TOOLS/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ | |
//INSTALL COMPILER | |
sudo apt-get install pkg-config make build-essential | |
TRY AND COMPILE | |
$ cd /media/Data/home/pi/openFrameworks/apps/myApps/emptyExample | |
$ make -j6 RPI_TOOLS=$RPI_TOOLS RPI_ROOT=$RPI_ROOT GST_VERSION=1.0 PLATFORM_OS=Linux PLATFORM_ARCH=armv6l | |
OPTIONAL | |
MAKE ENVIRONMENT VARIABLES PERMANENT | |
$ cd | |
$ nano .profile | |
ADD LINES | |
export GST_VERSION=1.0 | |
export RPI_ROOT=/home/pi/RPI_ROOT | |
export RPI_TOOLS=/home/pi/RPI_TOOLS | |
export PLATFORM_OS=Linux | |
export PLATFORM_ARCH=armv6l | |
export PKG_CONFIG_PATH=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$RPI_ROOT/usr/share/pkgconfig:$RPI_ROOT/usr/lib/pkgconfig | |
export MAKEFLAGS="-j 6 " | |
$ source .profile | |
YOU CAN NOW JUST COMPILE WITH make | |
$ cd /media/Data/home/pi/openFrameworks/apps/myApps/emptyExample | |
$ make | |
TROUBLESHOOTING | |
If you get errors the key offender is that some libraries in RPI_ROOT are linked with absolute paths. This should have been fixed with the running of fixQualifiedLibraryPaths.sh but there could possibly be exceptions | |
The way to fix is to find the link (e.g. with libm) | |
$ find ~/RPI_ROOT/ -name libm.so | |
#returned /home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf/libm.so | |
$ cd /home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf/ | |
$ rm libm.so | |
$ ln -s ../../../lib/arm-linux-gnueabihf/libm.so.6 libm.so | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script is ugly, feel free to fix it | |
if [ "$#" -ne 2 ]; then | |
echo "usage ./cmd target-rootfs target-toolchain" | |
exit -1 | |
fi | |
#passed args | |
ROOTFS=$1 | |
TOOLCHAIN=$2 | |
if [ -x $TOOLCHAIN ]; then | |
echo "Passed valid toolchain" | |
MACHINE=$($TOOLCHAIN -dumpmachine) | |
DEB_MULTI_ARCH_MADNESS=$ROOTFS/usr/lib/$MACHINE | |
fi | |
CURRENTDIR=$PWD | |
function adjustSymLinks | |
{ | |
echo "Adjusting the symlinks in $1 to be relative" | |
cd $1 | |
find . -maxdepth 1 -type l | while read i; | |
do qualifies=$(file $i | sed -e "s/.*\`\(.*\)'/\1/g" | grep ^/lib) | |
if [ -n "$qualifies" ]; then | |
newPath=$(file $i | sed -e "s/.*\`\(.*\)'/\1/g" | sed -e "s,\`,,g" | sed -e "s,',,g" | sed -e "s,^/lib,$2/lib,g"); | |
echo $i | |
echo $newPath; | |
sudo rm $i; | |
sudo ln -s $newPath $i; | |
fi | |
done | |
} | |
adjustSymLinks $ROOTFS/usr/lib "../.." | |
if [ -n "$DEB_MULTI_ARCH_MADNESS" -a -d "$DEB_MULTI_ARCH_MADNESS" ]; then | |
echo "Debian multiarch dir exists, adjusting" | |
adjustSymLinks $DEB_MULTI_ARCH_MADNESS "../../.." | |
fi | |
cd $CURRENTDIR |
Adjusting the symlinks in /home/pi/RPI_ROOT/usr/lib/arm-linux-gnueabihf to be relative
./libglib-2.0.so
../../../lib/arm-linux-gnueabihf/libglib-2.0.so.0
./libusb-0.1.so.4
../../../lib/arm-linux-gnueabihf/libusb-0.1.so.4
./libnss_files.so
../../../lib/arm-linux-gnueabihf/libnss_files.so.2
./librt.so
../../../lib/arm-linux-gnueabihf/librt.so.1
./libusb-1.0.so
../../../lib/arm-linux-gnueabihf/libusb-1.0.so.0.1.0
./libutil.so
../../../lib/arm-linux-gnueabihf/libutil.so.1
./libexpat.so
../../../lib/arm-linux-gnueabihf/libexpat.so.1.6.0
./libanl.so
../../../lib/arm-linux-gnueabihf/libanl.so.1
./libcidn.so
../../../lib/arm-linux-gnueabihf/libcidn.so.1
./libnss_dns.so
../../../lib/arm-linux-gnueabihf/libnss_dns.so.2
./libcrypt.so
../../../lib/arm-linux-gnueabihf/libcrypt.so.1
./libnss_compat.so
../../../lib/arm-linux-gnueabihf/libnss_compat.so.2
./libnss_nisplus.so
../../../lib/arm-linux-gnueabihf/libnss_nisplus.so.2
./liblzma.so
../../../lib/arm-linux-gnueabihf/liblzma.so.5.0.0
./libthread_db.so
../../../lib/arm-linux-gnueabihf/libthread_db.so.1
./libm.so
../../../lib/arm-linux-gnueabihf/libm.so.6
./libdbus-1.so
../../../lib/arm-linux-gnueabihf/libdbus-1.so.3.8.13
./libpcre.so
../../../lib/arm-linux-gnueabihf/libpcre.so.3
./libBrokenLocale.so
../../../lib/arm-linux-gnueabihf/libBrokenLocale.so.1
./libnss_nis.so
../../../lib/arm-linux-gnueabihf/libnss_nis.so.2
./libnss_hesiod.so
../../../lib/arm-linux-gnueabihf/libnss_hesiod.so.2
./libresolv.so
../../../lib/arm-linux-gnueabihf/libresolv.so.2
./libudev.so
../../../lib/arm-linux-gnueabihf/libudev.so.1.5.0
./libnsl.so
../../../lib/arm-linux-gnueabihf/libnsl.so.1
./libz.so
../../../lib/arm-linux-gnueabihf/libz.so.1.2.8
./libdl.so
../../../lib/arm-linux-gnueabihf/libdl.so.2
./libpng12.so.0
../../../lib/arm-linux-gnueabihf/libpng12.so.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.privateinternetaccess.com/forum/discussion/18063/debian-8-1-0-jessie-sudo-fix-not-installed-by-default