Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
cfg:
- {target: linuxarmv6l, libs: armv6l}
# - {target: linuxarmv7l, libs: armv7l}
- {target: linuxaarch64, libs: aarch64}
env:
TARGET: ${{matrix.cfg.target}}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ PLATFORM_PKG_CONFIG_LIBRARIES += egl
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/sound/ofFmodSoundPlayer.cpp

ifeq ($(CROSS_COMPILING),1)

ifdef MAKEFILE_DEBUG
$(info detected cross compiling $(CROSS_COMPILING))
endif
ifdef TOOLCHAIN_ROOT
#You have specified TOOLCHAIN_ROOT with an environment variable
else
Expand All @@ -105,7 +107,7 @@ ifeq ($(CROSS_COMPILING),1)
ifdef GCC_PREFIX
#You have specified GCC_PREFIX with an environment variable
else
GCC_PREFIX = arm-linux-gnueabihf
GCC_PREFIX = aarch64-linux-gnu
endif

PLATFORM_CXX = $(TOOLCHAIN_ROOT)/bin/$(GCC_PREFIX)-g++
Expand All @@ -115,17 +117,21 @@ ifeq ($(CROSS_COMPILING),1)

SYSROOT=$(RPI_ROOT)

#c++ 17 support - comment out two lines below to use c++11
PLATFORM_CFLAGS += -std=c++17
PLATFORM_CFLAGS += --sysroot=$(SYSROOT)

PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/c++/7
PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/c++
PLATFORM_HEADER_SEARCH_PATHS += $(TOOLCHAIN_ROOT)/lib/gcc/$(GCC_PREFIX)/$(GCC_VERSION)/include

PLATFORM_LIBRARY_SEARCH_PATHS += $(SYSROOT)/usr/lib/$(GCC_PREFIX)
PLATFORM_LIBRARY_SEARCH_PATHS += $(SYSROOT)/lib/$(GCC_PREFIX)
PLATFORM_LIBRARY_SEARCH_PATHS += $(TOOLCHAIN_ROOT)/lib/gcc/$(GCC_PREFIX)/$(GCC_VERSION)

PLATFORM_LDFLAGS += --sysroot=$(SYSROOT)
PLATFORM_LDFLAGS += -Wl,-rpath=$(SYSROOT)/usr/lib/$(GCC_PREFIX)
PLATFORM_LDFLAGS += -Wl,-rpath=$(SYSROOT)/lib/$(GCC_PREFIX)
PLATFORM_LDFLAGS += -Xlinker -rpath-link=$(SYSROOT)/usr/lib/$(GCC_PREFIX)
PLATFORM_LDFLAGS += -Xlinker -rpath-link=$(SYSROOT)/lib/$(GCC_PREFIX)
PLATFORM_LDFLAGS += -Xlinker -rpath-link=$(SYSROOT)/opt/vc/lib
PLATFORM_LDFLAGS += -Xlinker -rpath-link=$(SYSROOT)/usr/lib/arm-linux-gnueabihf/pulseaudio

PKG_CONFIG_LIBDIR=$(SYSROOT)/usr/lib/pkgconfig:$(SYSROOT)/usr/lib/arm-linux-gnueabihf/pkgconfig:$(SYSROOT)/usr/share/pkgconfig
PKG_CONFIG_LIBDIR=$(SYSROOT)/usr/lib/pkgconfig:$(SYSROOT)/usr/lib/$(GCC_PREFIX)/pkgconfig:$(SYSROOT)/usr/share/pkgconfig

endif
34 changes: 34 additions & 0 deletions scripts/ci/linuxaarch64/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -ev
OF_ROOT=$( cd "$(dirname "$0")/../../.." ; pwd -P )

export GCC_PREFIX=aarch64-linux-gnu
export GCC_VERSION=10.3.0
export GST_VERSION=1.0
export RPI_ROOT=${OF_ROOT}/scripts/ci/$TARGET/raspbian
export TOOLCHAIN_ROOT=${OF_ROOT}/scripts/ci/$TARGET/rpi_toolchain
export PLATFORM_OS=Linux
export PLATFORM_ARCH=aarch64
export PKG_CONFIG_LIBDIR=${RPI_ROOT}/usr/lib/pkgconfig:${RPI_ROOT}/usr/lib/${GCC_PREFIX}/pkgconfig:${RPI_ROOT}/usr/share/pkgconfig
export CXX="${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-g++"
export CC="${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-gcc"
export AR=${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-ar
export LD=${TOOLCHAIN_ROOT}/bin/${GCC_PREFIX}-ld

export PATH=/rpi_toolchain/bin/:$PATH
export LD_LIBRARY_PATH=/rpi_toolchain/lib:$LD_LIBRARY_PATH

echo "**** Building emptyExample ****"
cd $OF_ROOT
cp scripts/templates/linuxaarch64/Makefile examples/templates/emptyExample/
cp scripts/templates/linuxaarch64/config.make examples/templates/emptyExample/
cd examples/templates/emptyExample/
make Debug -j2

#TODO:
#echo "**** Building allAddonsExample ****"
#cd $OF_ROOT
#cp scripts/templates/linuxaarch64/Makefile examples/templates/allAddonsExample/
#cp scripts/templates/linuxaarch64/config.make examples/templates/allAddonsExample/
#cd examples/templates/allAddonsExample/
#make Debug -j2
81 changes: 81 additions & 0 deletions scripts/ci/linuxaarch64/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
set -e
set -o pipefail
# trap any script errors and exit
trap "trapError" ERR

trapError() {
echo
echo " ^ Received error ^"
cat formula.log
exit 1
}

installPackages(){
sudo apt-get -y update
sudo apt-get -y install multistrap unzip
#workaround for https://bugs.launchpad.net/ubuntu/+source/multistrap/+bug/1313787
sudo sed -i s/\$forceyes//g /usr/sbin/multistrap
}

createRaspbianImg(){
#needed since Ubuntu 18.04 - allow non https repositories
mkdir -p raspbian/etc/apt/apt.conf.d/
echo 'Acquire::AllowInsecureRepositories "true";' | sudo tee raspbian/etc/apt/apt.conf.d/90insecure
multistrap -a arm64 -d raspbian -f multistrap.conf
}

SCRIPT_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$SCRIPT_DIR" ]]; then SCRIPT_DIR="$PWD"; fi
. "$SCRIPT_DIR/../../dev/downloader.sh"

downloadToolchain(){
wget https://github.com/openframeworks/openFrameworks/releases/download/tools/cross-gcc-10.3.0-pi_64.tar.gz
tar xvf cross-gcc-10.3.0-pi_64.tar.gz
mv cross-pi-gcc-10.3.0-64 rpi_toolchain
rm cross-gcc-10.3.0-pi_64.tar.gz
}

downloadFirmware(){
wget https://github.com/raspberrypi/firmware/archive/master.zip -O firmware.zip
unzip firmware.zip
cp -r firmware-master/opt raspbian/
rm -r firmware-master
rm firmware.zip
}

relativeSoftLinks(){
for link in $(ls -la | grep "\-> /" | sed "s/.* \([^ ]*\) \-> \/\(.*\)/\1->\/\2/g"); do
lib=$(echo $link | sed "s/\(.*\)\->\(.*\)/\1/g");
link=$(echo $link | sed "s/\(.*\)\->\(.*\)/\2/g");
rm $lib
ln -s ../../..$link $lib
done

for f in *; do
error=$(grep " \/lib/" $f > /dev/null 2>&1; echo $?)
if [ $error -eq 0 ]; then
sed -i "s/ \/lib/ ..\/..\/..\/lib/g" $f
sed -i "s/ \/usr/ ..\/..\/..\/usr/g" $f
fi
done
}


ROOT=$( cd "$(dirname "$0")" ; pwd -P )
echo $ROOT
cd $ROOT
installPackages
createRaspbianImg
downloadToolchain
downloadFirmware

cp -rn rpi_toolchain/aarch64-linux-gnu/libc/lib/* $ROOT/raspbian/usr/lib/
cp -rn rpi_toolchain/aarch64-linux-gnu/libc/usr/lib/* $ROOT/raspbian/usr/lib/
cp -rn rpi_toolchain/aarch64-linux-gnu/lib/* $ROOT/raspbian/usr/lib/

cd $ROOT/raspbian/usr/lib
relativeSoftLinks
cd $ROOT/raspbian/usr/lib/aarch64-linux-gnu
relativeSoftLinks

23 changes: 23 additions & 0 deletions scripts/ci/linuxaarch64/multistrap.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[General]
arch=arm64
directory=raspbian
cleanup=true
noauth=true
unpack=true
aptsources=Raspbian-Base OpenFrameworks
debootstrap=Raspbian-Base OpenFrameworks


[Raspbian-Base]
packages=base-files dbus dpkg dropbear initscripts iputils-ping isc-dhcp-client kmod login locales lsb-base lsb-release makedev netbase net-tools sysvinit-utils sysv-rc libudev-dev
source=http://deb.debian.org/debian
keyring=debian-archive-keyring
components=main contrib non-free rpi
suite=bullseye

[OpenFrameworks]
packages=libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libopencv-dev libegl1-mesa-dev libglvnd-dev libgles2-mesa-dev libassimp-dev librtaudio-dev libboost-filesystem-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav gstreamer1.0-pulseaudio gstreamer1.0-x gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good liburiparser-dev libcurl4-openssl-dev libxml2-dev libpugixml-dev libpoco-dev libglfw3-dev libxrandr-dev libxinerama-dev libxcursor-dev freeglut3-dev libxi-dev
source=http://deb.debian.org/debian
keyring=debian-archive-keyring
components=main contrib non-free rpi
suite=bullseye