From af602342ecb86ba4f6a91bea6fadcfdce7bdb3a2 Mon Sep 17 00:00:00 2001 From: Theodore Watson Date: Tue, 22 Aug 2023 18:42:23 -0700 Subject: [PATCH] Upgrade arm - closes #7573 (#7611) #changelog #armv6 --- .github/workflows/build-linux-armv6.yml | 37 +++++++++++++++++++ .github/workflows/build-linux.yml | 10 +---- .../src/ofxAssimpModelLoader.cpp | 2 +- addons/ofxOpenCv/addon_config.mk | 2 +- .../linuxarmv6l/config.linuxarmv6l.default.mk | 10 ++--- scripts/ci/linuxarmv6l/build.sh | 27 +++++--------- scripts/ci/linuxarmv6l/install.sh | 13 +++++-- scripts/ci/linuxarmv6l/multistrap.conf | 10 ++--- 8 files changed, 69 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build-linux-armv6.yml diff --git a/.github/workflows/build-linux-armv6.yml b/.github/workflows/build-linux-armv6.yml new file mode 100644 index 00000000000..f51cb649cbc --- /dev/null +++ b/.github/workflows/build-linux-armv6.yml @@ -0,0 +1,37 @@ +name: build-linux-arm + +# make the action not run on the local repo if the branch is also in a pull request to OF/OF +on: + push: + if: github.event_name == 'push' && github.event.pull_request == null + paths-ignore: + - '**/*.md' + - 'examples/**' + pull_request: + if: github.event_name == 'pull_request' && github.repository == 'openframeworks/openFrameworks' + paths-ignore: + - '**/*.md' + - 'examples/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-linux-platforms: + runs-on: ubuntu-latest + strategy: + matrix: + cfg: + - {target: linuxarmv6l, libs: armv6l} +# - {target: linuxarmv7l, libs: armv7l} + env: + TARGET: ${{matrix.cfg.target}} + steps: + - uses: actions/checkout@v3 + - name: Download libs + run: ./scripts/linux/download_libs.sh -a ${{matrix.cfg.libs}}; + - name: Install dependencies + run: ./scripts/ci/$TARGET/install.sh; + - name: Build + run: ./scripts/ci/$TARGET/build.sh; diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index e5bbce61f0a..b76df373676 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,4 +1,4 @@ -name: build-linux64-and-arm +name: build-linux64 # make the action not run on the local repo if the branch is also in a pull request to OF/OF on: @@ -25,8 +25,6 @@ jobs: matrix: cfg: - {target: linux64, libs: 64gcc6} - - {target: linuxarmv6l, libs: armv6l} -# - {target: linuxarmv7l, libs: armv7l} env: TARGET: ${{matrix.cfg.target}} steps: @@ -39,12 +37,6 @@ jobs: fi - name: Install dependencies run: ./scripts/ci/$TARGET/install.sh; -# - name: Install gcc4 -# run: if [ ${{matrix.cfg.target}} = "64gcc4" ]; then -# sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; -# sudo apt-get update -q; -# sudo apt-get install gcc-4.9 g++-4.9; -# fi - name: Build run: if [ "$TARGET" = "linux64" ]; then scripts/ci/$TARGET/build.sh; diff --git a/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp b/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp index 9d3a4c629a7..e9660a0011a 100644 --- a/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp +++ b/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp @@ -218,7 +218,7 @@ void ofxAssimpModelLoader::calculateDimensions(){ normalizedScale = scene_max.x-scene_min.x; normalizedScale = std::max(double(scene_max.y - scene_min.y), normalizedScale); normalizedScale = std::max(double(scene_max.z - scene_min.z), normalizedScale); - if (abs(normalizedScale) < std::numeric_limits::epsilon()){ + if (fabs(normalizedScale) < std::numeric_limits::epsilon()){ ofLogWarning("ofxAssimpModelLoader") << "Error calculating normalized scale of scene" << std::endl; normalizedScale = 1.0; } else { diff --git a/addons/ofxOpenCv/addon_config.mk b/addons/ofxOpenCv/addon_config.mk index 420fdaf90f9..1ce0c834e46 100644 --- a/addons/ofxOpenCv/addon_config.mk +++ b/addons/ofxOpenCv/addon_config.mk @@ -73,7 +73,7 @@ linux: ADDON_INCLUDES_EXCLUDE += libs/opencv/% linuxarmv6l: - ADDON_PKG_CONFIG_LIBRARIES = opencv + ADDON_PKG_CONFIG_LIBRARIES = opencv4 ADDON_LIBS_EXCLUDE = libs/opencv/% ADDON_INCLUDES_EXCLUDE = libs/opencv ADDON_INCLUDES_EXCLUDE += libs/opencv/% diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index acecd0c594b..d33871572bb 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -57,7 +57,7 @@ endif #check if we are newer than Stretch and use the new system ifeq ($(shell expr $(VER_ID) \>= 9), 1) - # comment the line below if you want to use the non X window based system - currently compatible with RPi 1-3 only + # comment the line below if you want to use the non X window based system - currently compatible with RPi 1-3 only USE_PI_LEGACY = 0 USE_ATOMIC = 1 endif @@ -191,7 +191,7 @@ PLATFORM_LDFLAGS += -pthread ifdef USE_ATOMIC PLATFORM_LDFLAGS += -latomic -endif +endif ################################################################################ # PLATFORM HEADER SEARCH PATHS @@ -221,7 +221,6 @@ PLATFORM_HEADER_SEARCH_PATHS += $(RPI_ROOT)/opt/vc/include/interface/vmcs_host/l PLATFORM_LIBRARY_SEARCH_PATHS += $(RPI_ROOT)/opt/vc/lib - ################################################################################ # PLATFORM CORE EXCLUSIONS # During compilation, these makefiles will generate lists of sources, headers @@ -271,10 +270,11 @@ endif PLATFORM_CFLAGS += --sysroot=$(SYSROOT) PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/c++ - PLATFORM_HEADER_SEARCH_PATHS += $(SYSROOT)/usr/include/$(GCC_PREFIX)/c++/7 + 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)/usr/lib/gcc/$(GCC_PREFIX)/7 + 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 += -Xlinker -rpath-link=$(SYSROOT)/usr/lib/$(GCC_PREFIX) diff --git a/scripts/ci/linuxarmv6l/build.sh b/scripts/ci/linuxarmv6l/build.sh index bd8778623aa..1d28f5cd804 100755 --- a/scripts/ci/linuxarmv6l/build.sh +++ b/scripts/ci/linuxarmv6l/build.sh @@ -1,21 +1,11 @@ #!/bin/bash set -ev OF_ROOT=$( cd "$(dirname "$0")/../../.." ; pwd -P ) -PROJECTS=$OF_ROOT/libs/openFrameworksCompiled/project -# source $OF_ROOT/scripts/ci/ccache.sh -# Add compiler flag to reduce memory usage to enable builds to complete -# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56746#c7 -# the "proper" way does not work currently: -export CXXFLAGS="${CXXFLAGS} -ftrack-macro-expansion=0" - -echo "**** Building OF core ****" -cd $OF_ROOT -# this carries over to subsequent compilations of examples -sed -i "s/PLATFORM_OPTIMIZATION_CFLAGS_DEBUG = .*/PLATFORM_OPTIMIZATION_CFLAGS_DEBUG = -g0/" $PROJECTS/makefileCommon/config.linux.common.mk -cd $PROJECTS export GCC_PREFIX=arm-linux-gnueabihf export GST_VERSION=1.0 +#NOTE: GCC_VERSION should match the version present in the downloaded toolchain +export GCC_VERSION=9.4.0 export RPI_ROOT=${OF_ROOT}/scripts/ci/$TARGET/raspbian export TOOLCHAIN_ROOT=${OF_ROOT}/scripts/ci/$TARGET/rpi_toolchain export PLATFORM_OS=Linux @@ -25,10 +15,16 @@ 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 -make Debug -j2 +export CROSS_COMPILING=1 +export PATH=/rpi_toolchain/bin/:$PATH +export LD_LIBRARY_PATH=/rpi_toolchain/lib:$LD_LIBRARY_PATH + echo "**** Building emptyExample ****" -cd $OF_ROOT/scripts/templates/linuxarmv6l +cd $OF_ROOT +cp scripts/templates/linuxarmv6l/Makefile examples/templates/emptyExample/ +cp scripts/templates/linuxarmv6l/config.make examples/templates/emptyExample/ +cd examples/templates/emptyExample/ make Debug -j2 echo "**** Building allAddonsExample ****" @@ -37,6 +33,3 @@ cp scripts/templates/linuxarmv6l/Makefile examples/templates/allAddonsExample/ cp scripts/templates/linuxarmv6l/config.make examples/templates/allAddonsExample/ cd examples/templates/allAddonsExample/ make Debug -j2 - -git checkout $PROJECTS/makefileCommon/config.linux.common.mk -git checkout $PROJECTS/linuxarmv6l/config.linuxarmv6l.default.mk diff --git a/scripts/ci/linuxarmv6l/install.sh b/scripts/ci/linuxarmv6l/install.sh index 10dd2ef9915..7dcfed4565a 100755 --- a/scripts/ci/linuxarmv6l/install.sh +++ b/scripts/ci/linuxarmv6l/install.sh @@ -30,9 +30,10 @@ if [[ ! -d "$SCRIPT_DIR" ]]; then SCRIPT_DIR="$PWD"; fi . "$SCRIPT_DIR/../../dev/downloader.sh" downloadToolchain(){ - downloader http://ci.openframeworks.cc/rpi_toolchain_gcc6.tar.bz2 - tar xjf rpi_toolchain_gcc6.tar.bz2 - rm rpi_toolchain_gcc6.tar.bz2 + wget https://github.com/openframeworks/openFrameworks/releases/download/tools/cross-gcc-9.4.0-pi_0-1.tar.gz + tar xvf cross-gcc-9.4.0-pi_0-1.tar.gz + mv cross-pi-gcc-9.4.0-0 rpi_toolchain + rm cross-gcc-9.4.0-pi_0-1.tar.gz } downloadFirmware(){ @@ -69,8 +70,12 @@ createRaspbianImg downloadToolchain downloadFirmware +#needed for some of the toolchain libs +cp -rn rpi_toolchain/arm-linux-gnueabihf/libc/lib/* $ROOT/raspbian/usr/lib/ +cp -rn rpi_toolchain/arm-linux-gnueabihf/libc/usr/lib/* $ROOT/raspbian/usr/lib/ +cp -rn rpi_toolchain/arm-linux-gnueabihf/lib/* $ROOT/raspbian/usr/lib/ + cd $ROOT/raspbian/usr/lib relativeSoftLinks cd $ROOT/raspbian/usr/lib/arm-linux-gnueabihf relativeSoftLinks -cd $ROOT/raspbian/usr/lib/gcc/arm-linux-gnueabihf/4.9 diff --git a/scripts/ci/linuxarmv6l/multistrap.conf b/scripts/ci/linuxarmv6l/multistrap.conf index 077b43284fd..c13f93a78e3 100644 --- a/scripts/ci/linuxarmv6l/multistrap.conf +++ b/scripts/ci/linuxarmv6l/multistrap.conf @@ -12,18 +12,18 @@ packages=busybox busybox-syslogd udhcpc source=http://archive.raspbian.org/raspbian keyring=raspbian-archive-keyring components=main contrib non-free rpi -suite=stretch +suite=bullseye [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 udev +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 udev libudev-dev source=http://archive.raspbian.org/raspbian keyring=raspbian-archive-keyring components=main contrib non-free rpi -suite=stretch +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 libgles1-mesa-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 +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 gfortran source=http://archive.raspbian.org/raspbian keyring=raspbian-archive-keyring components=main contrib non-free rpi -suite=stretch +suite=bullseye