Skip to content

Commit

Permalink
fix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bindea-cristian committed Nov 15, 2024
1 parent 751307a commit ec5f422
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/appimage-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/appimage-armhf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion ci/arm/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions ci/arm/arm_build_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[*]}"
Expand Down
10 changes: 4 additions & 6 deletions ci/arm/arm_build_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -442,8 +442,7 @@ build_deps(){

run_workflow(){
install_packages
download_cmake
download_crosscompiler
move_tools
move_sysroot
build_iio-emu
build_scopy
Expand All @@ -454,8 +453,7 @@ run_workflow(){

get_tools(){
install_packages
download_cmake
download_crosscompiler
move_tools
move_sysroot
}

Expand Down
2 changes: 1 addition & 1 deletion ci/arm/build_qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
44 changes: 27 additions & 17 deletions ci/arm/cmake_toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,35 @@ cmake_minimum_required(VERSION 3.18)

set(CMAKE_SYSTEM_NAME Linux)

# Variables CMAKE_SYSROOT,
# CMAKE_INSTALL_PREFIX,
# STAGING_AREA,
# CMAKE_SYSTEM_PROCESSOR,
# and CMAKE_LIBRARY_ARCHITECTURE are defined as parameters to the cmake command
# CMAKE_SYSROOT
# CMAKE_INSTALL_PREFIX
# STAGING_AREA
# CMAKE_SYSTEM_PROCESSOR
# CMAKE_LIBRARY_ARCHITECTURE
# are exported from the arm_build_config.sh script

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)
set(CMAKE_PREFIX_PATH ${QT_LOCATION})
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}")

set(PKG_CONFIG_EXECUTABLE "${CMAKE_SYSROOT}/usr/bin/${CMAKE_LIBRARY_ARCHITECTURE}-pkg-config" CACHE PATH "PKG_CONFIG_EXECUTABLE"
FORCE
)

set(PKG_CONFIG_EXECUTABLE ${CMAKE_LIBRARY_ARCHITECTURE}-pkg-config)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(PKG_CONFIG_EXECUTABLE ${CMAKE_LIBRARY_ARCHITECTURE}-pkg-config CACHE PATH "PKG_CONFIG_EXECUTABLE" FORCE)
set(ENV{PKG_CONFIG_DIR} "")
else()
set(PKG_CONFIG_EXECUTABLE "${CMAKE_SYSROOT}/usr/bin/${CMAKE_LIBRARY_ARCHITECTURE}-pkg-config"
CACHE PATH "PKG_CONFIG_EXECUTABLE" FORCE
)
endif()

set(ENV{PKG_CONFIG_DIR} "")
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
set(ENV{PKG_CONFIG_EXECUTABLE} ${PKG_CONFIG_EXECUTABLE})
set(ENV{PKG_CONFIG_ALLOW_CROSS} 1)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
Expand Down Expand Up @@ -57,7 +66,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "-fexceptions -frtti ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-Os -g")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -lpthread -lboost_program_options")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread -lboost_program_options")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib")
Expand All @@ -68,11 +78,11 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${TOOLCHAIN_FILE}/${CMAK
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})

# # Debug Mode
# set(CMAKE_VERBOSE ON)
# set(CMAKE_VERBOSE_MAKEFILE ON)
# set(CMAKE_VERBOSE ON)
# set(CMAKE_VERBOSE_MAKEFILE ON)
# set(PKG_CONFIG_ARGN "--debug")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--verbose")
# set(CMAKE_FIND_DEBUG_MODE TRUE)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--verbose")
# set(CMAKE_FIND_DEBUG_MODE TRUE)

set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
Expand Down
9 changes: 5 additions & 4 deletions ci/arm/create_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand All @@ -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 \
Expand All @@ -34,8 +35,8 @@ tar_and_move_sysroot(){

create_image(){
pushd ${SRC_DIR}/ci/arm
#docker build --load --progress plain --tag cristianbindea/scopy2-arm64-appimage:testing -f docker/Dockerfile .
DOCKER_BUILDKIT=0 docker build --tag cristianbindea/scopy2-arm64-appimage:testing -f docker/Dockerfile . # build the image using old backend
#docker build --load --progress plain --tag cristianbindea/scopy2-arm64-appimage:testing -f docker/Dockerfile --build-arg ARCH=${ARCH} .
DOCKER_BUILDKIT=0 docker build --tag cristianbindea/scopy2-arm64-appimage:testing -f docker/Dockerfile --build-arg ARCH=${ARCH} . # build the image using old backend
popd
}

Expand Down
2 changes: 1 addition & 1 deletion ci/arm/create_sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 5 additions & 3 deletions ci/arm/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion ci/arm/inside_chroot_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/arm/inside_chroot_armhf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions ci/x86_64/copy-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec5f422

Please sign in to comment.