From 7ff44f6234c61810f2e32d86f76c14facea31a15 Mon Sep 17 00:00:00 2001 From: Bindea Cristian Date: Mon, 11 Nov 2024 15:42:15 +0200 Subject: [PATCH] fix fix --- .github/workflows/appimage-arm64.yml | 4 ++-- .github/workflows/appimage-armhf.yml | 4 ++-- ci/arm/.dockerignore | 2 +- ci/arm/arm_build_config.sh | 14 +++++++------- ci/arm/arm_build_process.sh | 10 ++++------ ci/arm/build_qt.sh | 2 +- ci/arm/cmake_toolchain.cmake | 11 +++++++++-- ci/arm/create_docker_image.sh | 5 +++-- ci/arm/create_sysroot.sh | 2 +- ci/arm/docker/Dockerfile | 8 +++++--- ci/arm/inside_chroot_arm64.sh | 2 +- ci/arm/inside_chroot_armhf.sh | 4 ++-- ci/x86_64/copy-deps.sh | 3 +-- core/CMakeLists.txt | 2 +- 14 files changed, 40 insertions(+), 33 deletions(-) diff --git a/.github/workflows/appimage-arm64.yml b/.github/workflows/appimage-arm64.yml index f9160cd197..9e00037723 100644 --- a/.github/workflows/appimage-arm64.yml +++ b/.github/workflows/appimage-arm64.yml @@ -24,8 +24,8 @@ jobs: run: | cd $GITHUB_WORKSPACE sudo apt update - ./ci/arm/create_sysroot.sh install_packages install_qemu - ./ci/arm/arm_build_process.sh generate_ci_envs + ./ci/arm/create_sysroot.sh arm64 install_packages install_qemu + ./ci/arm/arm_build_process.sh arm64 generate_ci_envs docker run \ --mount type=bind,source="$GITHUB_WORKSPACE",target=/home/runner/scopy \ diff --git a/.github/workflows/appimage-armhf.yml b/.github/workflows/appimage-armhf.yml index 474139ebb6..d729ada587 100644 --- a/.github/workflows/appimage-armhf.yml +++ b/.github/workflows/appimage-armhf.yml @@ -24,8 +24,8 @@ jobs: run: | cd $GITHUB_WORKSPACE sudo apt update - ./ci/arm/create_sysroot.sh install_packages install_qemu - ./ci/arm/arm_build_process.sh generate_ci_envs + ./ci/arm/create_sysroot.sh arm32 install_packages install_qemu + ./ci/arm/arm_build_process.sh arm32 generate_ci_envs docker run \ --mount type=bind,source="$GITHUB_WORKSPACE",target=/home/runner/scopy \ diff --git a/ci/arm/.dockerignore b/ci/arm/.dockerignore index 10cc45b886..5ded1c6247 100644 --- a/ci/arm/.dockerignore +++ b/ci/arm/.dockerignore @@ -7,5 +7,5 @@ !copy-deps.sh !inside_chroot.sh !build_qt.sh -!qt_patch_arm32.patch +!qt_patch_armhf.patch !qt_patch_arm64.patch \ No newline at end of file diff --git a/ci/arm/arm_build_config.sh b/ci/arm/arm_build_config.sh index 8d5c2b5c4e..4372a3e049 100644 --- a/ci/arm/arm_build_config.sh +++ b/ci/arm/arm_build_config.sh @@ -51,8 +51,6 @@ APP_SQUASHFS=$SRC_SCRIPT/scopy.squashfs # Runetimes downloaded from https://github.com/AppImage/AppImageKit/releases/continuous Mar 9, 2023 RUNTIME_ARM=$SRC_SCRIPT/runtime-${TOOLCHAIN_HOST%%-*} # remove everything after the first hyphen - - if [ $TOOLCHAIN_HOST == "aarch64-linux-gnu" ]; then CMAKE_SYSTEM_PROCESSOR=aarch64 CMAKE_LIBRARY_ARCHITECTURE=aarch64-linux-gnu @@ -61,15 +59,17 @@ elif [ $TOOLCHAIN_HOST == "arm-linux-gnueabihf" ]; then CMAKE_LIBRARY_ARCHITECTURE=arm-linux-gnueabihf fi +# Export variables to parameterize the CMake toolchain file +export CMAKE_SYSROOT="$SYSROOT" +export QT_LOCATION="$QT_LOCATION" +export STAGING_AREA="$STAGING_AREA" +export CMAKE_SYSTEM_PROCESSOR="$CMAKE_SYSTEM_PROCESSOR" +export CMAKE_LIBRARY_ARCHITECTURE="$CMAKE_LIBRARY_ARCHITECTURE" + CMAKE_OPTS=(\ - -DCMAKE_SYSROOT="$SYSROOT" \ - -DQT_LOCATION="$QT_LOCATION" \ - -DSTAGING_AREA="$STAGING_AREA" \ -DCMAKE_INSTALL_PREFIX="$SYSROOT" \ -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_SYSTEM_PROCESSOR="$CMAKE_SYSTEM_PROCESSOR" \ - -DCMAKE_LIBRARY_ARCHITECTURE="$CMAKE_LIBRARY_ARCHITECTURE" ) CMAKE="$CMAKE_BIN ${CMAKE_OPTS[*]}" diff --git a/ci/arm/arm_build_process.sh b/ci/arm/arm_build_process.sh index b8a7e06321..8b2a476c2f 100755 --- a/ci/arm/arm_build_process.sh +++ b/ci/arm/arm_build_process.sh @@ -11,7 +11,7 @@ source $SRC_SCRIPT/arm_build_config.sh $1 echo -- USING CMAKE COMMAND: echo $CMAKE -echo -- USING QT: $QT +echo -- USING QT: $QT_LOCATION echo -- USING QMAKE: $QMAKE_BIN echo -- SYSROOT: $SYSROOT @@ -410,7 +410,7 @@ move_appimage(){ if [ $TOOLCHAIN_HOST == "aarch64-linux-gnu" ]; then mv $APP_IMAGE $SRC_DIR/Scopy-arm64.AppImage elif [ $TOOLCHAIN_HOST == "arm-linux-gnueabihf" ]; then - mv $APP_IMAGE $SRC_DIR/Scopy-arm32.AppImage + mv $APP_IMAGE $SRC_DIR/Scopy-armhf.AppImage fi } @@ -442,8 +442,7 @@ build_deps(){ run_workflow(){ install_packages - download_cmake - download_crosscompiler + move_tools move_sysroot build_iio-emu build_scopy @@ -454,8 +453,7 @@ run_workflow(){ get_tools(){ install_packages - download_cmake - download_crosscompiler + move_tools move_sysroot } diff --git a/ci/arm/build_qt.sh b/ci/arm/build_qt.sh index 783124f3cd..16191b0821 100755 --- a/ci/arm/build_qt.sh +++ b/ci/arm/build_qt.sh @@ -22,7 +22,7 @@ download_qt(){ if [ $TOOLCHAIN_HOST == "aarch64-linux-gnu" ]; then patch -p1 -R < $SRC_SCRIPT/qt_patch_arm64.patch elif [ $TOOLCHAIN_HOST == "arm-linux-gnueabihf" ]; then - patch -p1 < $SRC_SCRIPT/qt_patch_arm32.patch + patch -p1 < $SRC_SCRIPT/qt_patch_armhf.patch fi else echo "QT already downloaded" diff --git a/ci/arm/cmake_toolchain.cmake b/ci/arm/cmake_toolchain.cmake index aa1f02d524..1f8b3ead74 100644 --- a/ci/arm/cmake_toolchain.cmake +++ b/ci/arm/cmake_toolchain.cmake @@ -6,7 +6,14 @@ set(CMAKE_SYSTEM_NAME Linux) # CMAKE_INSTALL_PREFIX, # STAGING_AREA, # CMAKE_SYSTEM_PROCESSOR, -# and CMAKE_LIBRARY_ARCHITECTURE are defined as parameters to the cmake command +# and CMAKE_LIBRARY_ARCHITECTURE are defined as parameters + +set(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT}) +set(QT_LOCATION $ENV{QT_LOCATION}) +set(STAGING_AREA $ENV{STAGING_AREA}) +set(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT}) +set(CMAKE_SYSTEM_PROCESSOR $ENV{CMAKE_SYSTEM_PROCESSOR}) +set(CMAKE_LIBRARY_ARCHITECTURE $ENV{CMAKE_LIBRARY_ARCHITECTURE}) set(TOOLCHAIN_FILE ${STAGING_AREA}/cross-pi-gcc) set(TOOLCHAIN_BIN ${TOOLCHAIN_FILE}/bin) @@ -70,7 +77,7 @@ set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) # # Debug Mode # set(CMAKE_VERBOSE ON) # set(CMAKE_VERBOSE_MAKEFILE ON) -# set(PKG_CONFIG_ARGN "--debug") +# set(PKG_CONFIG_ARGN "--debug") # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--verbose") # set(CMAKE_FIND_DEBUG_MODE TRUE) diff --git a/ci/arm/create_docker_image.sh b/ci/arm/create_docker_image.sh index 3718fb4a61..5c52a479d7 100755 --- a/ci/arm/create_docker_image.sh +++ b/ci/arm/create_docker_image.sh @@ -3,7 +3,8 @@ set -ex SRC_DIR=$(git rev-parse --show-toplevel 2>/dev/null ) || \ SRC_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && cd ../../ && pwd ) -source $SRC_DIR/ci/arm/arm_build_config.sh $1 +ARCH=$1 +source $SRC_DIR/ci/arm/arm_build_config.sh "$ARCH" # install docker install_packages(){ @@ -16,7 +17,7 @@ install_packages(){ } create_sysroot(){ - $SRC_DIR/ci/arm/create_sysroot.sh \ + $SRC_DIR/ci/arm/create_sysroot.sh "$ARCH" \ install_packages \ download_kuiper \ install_qemu \ diff --git a/ci/arm/create_sysroot.sh b/ci/arm/create_sysroot.sh index cca9f4873f..276c18d41d 100755 --- a/ci/arm/create_sysroot.sh +++ b/ci/arm/create_sysroot.sh @@ -65,7 +65,7 @@ configure_sysroot(){ if [ $TOOLCHAIN_HOST == "aarch64-linux-gnu" ]; then cat $SRC_SCRIPT/inside_chroot_arm64.sh | sudo chroot ${SYSROOT} elif [ $TOOLCHAIN_HOST == "arm-linux-gnueabihf" ]; then - cat $SRC_SCRIPT/inside_chroot_arm32.sh | sudo chroot ${SYSROOT} + cat $SRC_SCRIPT/inside_chroot_armhf.sh | sudo chroot ${SYSROOT} fi } diff --git a/ci/arm/docker/Dockerfile b/ci/arm/docker/Dockerfile index 00177cc857..dfbc0d85a9 100644 --- a/ci/arm/docker/Dockerfile +++ b/ci/arm/docker/Dockerfile @@ -1,5 +1,6 @@ FROM --platform=linux/amd64 ubuntu:20.04 AS start SHELL ["/bin/bash", "-c"] +ARG ARCH ARG USER=runner ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/Bucharest @@ -26,19 +27,20 @@ WORKDIR /home/${USER} FROM start AS sysroot_builder ARG USER=runner +ARG ARCH ENV DEBIAN_FRONTEND=noninteractive #Copy all scopy/ci/arm folder inside the image COPY * /home/${USER}/ -RUN ./create_sysroot.sh arm64 \ +RUN ./create_sysroot.sh ${ARCH} \ install_packages \ move_and_extract_sysroot \ fix_relativelinks -RUN ./build_qt.sh arm64 \ +RUN ./build_qt.sh ${ARCH} \ install_packages \ download_qt \ download_crosscompiler \ build -RUN ./arm_build_process.sh arm64 \ +RUN ./arm_build_process.sh ${ARCH} \ install_packages \ download_cmake \ download_crosscompiler \ diff --git a/ci/arm/inside_chroot_arm64.sh b/ci/arm/inside_chroot_arm64.sh index 992269a260..1e9372156e 100644 --- a/ci/arm/inside_chroot_arm64.sh +++ b/ci/arm/inside_chroot_arm64.sh @@ -19,7 +19,7 @@ apt -y dist-upgrade dpkg --configure -a apt -y install '^libxcb.*-dev' autoconf automake bison build-essential cmake dh-python figlet flex freeglut3-dev g++ gawk gcc \ - gdb-multiarch gdbserver git libavahi-client* libavahi-common* libboost1.81-all-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev \ + gdb-multiarch gdbserver git libavahi-client* libavahi-common* libboost1.81-all-dev libdrm-dev libgbm-dev libglib2.0-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev \ libgmp-dev libinput-dev libopenal-dev libsndfile1-dev libspeechd-dev libts-dev libudev-dev libunwind-dev libxcb-icccm4 libxcb-xinerama0 \ libx11-xcb-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libxrender-dev libxml2-dev libxml2-utils mesa-common-dev mesa-utils* \ perl pkg-config unzip wget || true diff --git a/ci/arm/inside_chroot_armhf.sh b/ci/arm/inside_chroot_armhf.sh index 6e199ad3ed..2238b29cdf 100644 --- a/ci/arm/inside_chroot_armhf.sh +++ b/ci/arm/inside_chroot_armhf.sh @@ -25,10 +25,10 @@ rm -rfv $(find / | grep gnuradio) apt -y build-dep qtbase5-dev || true apt -y install '^libxcb.*-dev' autoconf automake bison build-essential cmake figlet flex freeglut3-dev g++ gawk gcc \ - gdb-multiarch gdbserver git libavahi-client* libavahi-common* libboost1.81-all-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ + gdb-multiarch gdbserver git libavahi-client* libavahi-common* libboost1.81-all-dev libdrm-dev libgbm-dev libglib2.0-dev libgl1-mesa-dev libgles2-mesa-dev \ libglu1-mesa-dev libgmp-dev libinput-dev libopenal-dev libsndfile1-dev libspeechd-dev libts-dev libudev-dev \ libunwind-dev libx11-xcb-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libxrender-dev libxml2-dev libxml2-utils \ - mesa-common-dev mesa-utils* perl pkg-config python2 unzip wget || true + mesa-common-dev mesa-utils* perl pkg-config dh-python unzip wget || true wget https://raw.githubusercontent.com/abhiTronix/raspberry-pi-cross-compilers/master/utils/SSymlinker sed -i 's/sudo//g' SSymlinker diff --git a/ci/x86_64/copy-deps.sh b/ci/x86_64/copy-deps.sh index 35d3ecbe6f..1653cb6127 100755 --- a/ci/x86_64/copy-deps.sh +++ b/ci/x86_64/copy-deps.sh @@ -3,14 +3,13 @@ set -e SRC_DIR=$(git rev-parse --show-toplevel 2>/dev/null ) || \ SRC_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && cd ../../ && pwd ) -source $SRC_DIR/ci/armhf/armhf_build_config.sh BINARY=$1 LOCATION=$2 LIBS_ARRAY=() BLACKLISTED=($(wget --quiet https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist -O - | sort | uniq | cut -d '#' -f 1 | grep -v "^#.*" | grep "[^-\s]")) -export LD_LIBRARY_PATH="${APP_DIR}/usr/lib:${SYSROOT}/lib:${SYSROOT}/lib/arm-linux-gnueabihf:${SYSROOT}/usr/arm-linux-gnueabihf/lib:${SYSROOT}/usr/local/qt5.15/lib:${SYSROOT}/usr/local/lib:${SRC_DIR}/build" +export LD_LIBRARY_PATH="${APP_DIR}/usr/lib:${SRC_DIR}/build:$LD_LIBRARY_PATH" run_ldd(){ for library in $(ldd "$1" | cut -d '>' -f 2 | awk '{print $1}') do diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 33015e69e9..1b581110e4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -60,7 +60,7 @@ if(${WITH_PYTHON}) message(STATUS "Using default Python EXECUTABLE") endif() - if(CMAKE_SYSTEM_PROCESSOR MATCHES arm) + if(CMAKE_SYSTEM_PROCESSOR MATCHES arm OR CMAKE_SYSTEM_PROCESSOR MATCHES aarch64) find_package(Python3 REQUIRED COMPONENTS Development) else() find_package(Python3 REQUIRED COMPONENTS Interpreter Development)