From 0f222df9a25c8fe5c6d55df4159947004a2fc40e Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sun, 14 Nov 2021 17:48:46 -0800 Subject: [PATCH] Make the OLED script work on Bullseye (#470) * Add check for gcc 10+ and inject compiler flaggs * Bump Python libraries --- src/oled_monitor/requirements.txt | 4 ++-- src/oled_monitor/start.sh | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/oled_monitor/requirements.txt b/src/oled_monitor/requirements.txt index a519940a..2efda11d 100644 --- a/src/oled_monitor/requirements.txt +++ b/src/oled_monitor/requirements.txt @@ -2,7 +2,7 @@ Adafruit-Blinka==6.15.0 adafruit-circuitpython-busdevice==5.1.0 adafruit-circuitpython-framebuf==1.4.7 adafruit-circuitpython-ssd1306==2.12.2 -Adafruit-PlatformDetect==3.13.0 +Adafruit-PlatformDetect==3.17.2 Adafruit-PureIO==1.1.9 Pillow==8.4.0 pkg-resources==0.0.0 @@ -12,5 +12,5 @@ pyusb==1.2.1 rpi-ws281x==4.3.0 RPi.GPIO==0.7.0 sysv-ipc==1.1.0 -protobuf==3.17.3 +protobuf==3.19.1 unidecode==1.3.2 diff --git a/src/oled_monitor/start.sh b/src/oled_monitor/start.sh index 634509e1..955b1aaa 100755 --- a/src/oled_monitor/start.sh +++ b/src/oled_monitor/start.sh @@ -57,6 +57,14 @@ if ! i2cdetect -y 1 &> /dev/null ; then echo "i2cdetect -y 1 did not find a screen." exit 2 fi + +# Compiler flags needed for gcc v10 and up +if [[ `gcc --version | awk '/gcc/' | awk -F ' ' '{print $3}' | awk -F '.' '{print $1}'` -ge 10 ]]; then + echo -n "gcc 10 or later detected. Will compile with the following flags: " + COMPILER_FLAGS="-fcommon" + echo $COMPILER_FLAGS +fi + if ! test -e venv; then echo "Creating python venv for OLED Screen" python3 -m venv venv @@ -64,7 +72,7 @@ if ! test -e venv; then source venv/bin/activate echo "Installing requirements.txt" pip install wheel - pip install -r requirements.txt + CFLAGS="$COMPILER_FLAGS" pip install -r requirements.txt git rev-parse HEAD > current fi @@ -76,7 +84,7 @@ if ! test -e current; then else if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then echo "New version detected, updating requirements.txt" - pip install -r requirements.txt + CFLAGS="$COMPILER_FLAGS" pip install -r requirements.txt git rev-parse HEAD > current fi fi