Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Qt 5.12.9 #95

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Open a terminal and follow the steps below:
```bash
git clone https://github.com/neuronalmotion/qtrpi.git
cd qtrpi
export QTRPI_QT_VERSION='5.7.0'
export QTRPI_TARGET_DEVICE='linux-rpi3-g++'
export QTRPI_QT_VERSION='5.12.9'
export QTRPI_TARGET_DEVICE='linux-rasp-pi3-g++'
export QTRPI_TARGET_HOST='[email protected]'
./init-qtrpi-minimal.sh
./deploy-qtrpi.sh --prepare-rpi
Expand Down Expand Up @@ -98,4 +98,10 @@ By default the image automatically executes `qmake` and `make` in the current wo
``` shell
docker pull arose/qtrpi:rpi3-qt5.6.2
docker run -v /someqtprojectfolder/:/source arose/qtrpi:rpi3-qt5.6.2
```
```

### Errors during compile

#### Undefined reference error _dl_stack_flags with gcc and pthreads

Run sysroot-relativelinks.py again
38 changes: 38 additions & 0 deletions docker/rpi3/qt5.12.9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM debian:stable-slim
LABEL maintainer="Alexander Rose <[email protected]>"

# install necessary packages
RUN apt-get update -q && apt-get install -yq --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*

# Clone Qtrpi and additional scripts
RUN git clone https://github.com/MoJo2600/qtrpi.git -b 5.12.9

# Setup Qtrpi environment
ENV QTRPI_QT_VERSION='5.12.9' \
QTRPI_TARGET_DEVICE='linux-rasp-pi3-g++' \
QTRPI_TARGET_HOST='pi@localhost' \
QTRPI_DOCKER='True'

# Change workdir
WORKDIR /qtrpi

# Execute init script and clean up after it
RUN ./init-qtrpi-full.sh && \
rm /opt/qtrpi/*.img && \
rm -rf /opt/qtrpi/raspi/*.tar.xz

# Extend path
ENV PATH=/opt/qtrpi/bin:$PATH

# Create path for source files
RUN mkdir /source
WORKDIR /source

# Execute build commands on run
CMD /qtrpi/docker/scripts/build.sh
Empty file modified docker/scripts/build.sh
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion init-qtrpi-full.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# DEBUG
set -e

source ${0%/*}/utils/common.sh

function usage() {
Expand Down Expand Up @@ -47,4 +50,3 @@ cd utils
./switch-sysroot.sh full
./synchronize-qt-modules.sh
./compile-qt-modules.sh --clean-output --clean-modules-repo

2 changes: 1 addition & 1 deletion qt-modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ qtquickcontrols
qtquickcontrols2
qtserialport
qtsvg
qtgraphicaleffects
qtgraphicaleffects
24 changes: 15 additions & 9 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,28 @@ function device_name() {
'linux-rasp-pi-g++') NAME='rpi1' ;;
'linux-rasp-pi2-g++') NAME='rpi2' ;;
'linux-rpi3-g++') NAME='rpi3' ;;
'linux-rasp-pi3-g++') NAME='rpi3' ;;
esac
echo $NAME
}

validate_var_qtrpi_qt_version() {
for VERSION in '5.6.2' '5.7.0'; do
for VERSION in '5.6.2' '5.7.0' '5.12.9'; do
if [[ "$QTRPI_QT_VERSION" == "$VERSION" ]]; then
VALID=true
fi
done

if [[ ! $VALID ]]; then
exit_error "Invalid QTRPI_QT_VERSION value ($QTRPI_QT_VERSION). Supported values: \n- 5.6.2 \n- 5.7.0"
exit_error "Invalid QTRPI_QT_VERSION value ($QTRPI_QT_VERSION). Supported values: \n- 5.6.2 \n- 5.7.0 \n- 5.12.9"
fi
}

validate_var_qtrpi_target_device() {
NAME=$(device_name $QTRPI_TARGET_DEVICE)

if [[ ! $NAME ]]; then
exit_error "Invalid QTRPI_TARGET_DEVICE value ($QTRPI_TARGET_DEVICE). Supported values: \n- linux-rasp-pi-g++ \n- linux-rasp-pi2-g++ \n- linux-rpi3-g++"
exit_error "Invalid QTRPI_TARGET_DEVICE value ($QTRPI_TARGET_DEVICE). Supported values: \n- linux-rasp-pi-g++ \n- linux-rasp-pi2-g++ \n- linux-rasp-pi3-g++"
fi
}

Expand All @@ -69,10 +70,11 @@ check_env_vars() {


ROOT=${QTRPI_ROOT-/opt/qtrpi}
TARGET_DEVICE=${QTRPI_TARGET_DEVICE-'linux-rasp-pi2-g++'}
QT_VERSION=${QTRPI_QT_VERSION-'5.7.0'}
TARGET_DEVICE=${QTRPI_TARGET_DEVICE-'linux-rasp-pi3-g++'}
QT_VERSION=${QTRPI_QT_VERSION-'5.12.9'}
TARGET_HOST=$QTRPI_TARGET_HOST
RASPBIAN_BASENAME='raspbian_latest'
LINARO_BASENAME='linaro_latest'

DEVICE_NAME=$(device_name $TARGET_DEVICE)

Expand Down Expand Up @@ -109,18 +111,22 @@ function cd_root() {
function clean_git_and_compilation() {
git reset --hard HEAD
git clean -fd
make clean -j 10
make distclean -j 10
make clean
make distclean
}

function qmake_cmd() {
LOG_FILE=${1:-'default'}
$ROOT/raspi/qt5/bin/qmake -r |& tee $ROOT/logs/$LOG_FILE.log
$ROOT/raspi/qt5/bin/qmake |& tee $ROOT/logs/$LOG_FILE.log

# Got a lot of errors like `qtdeclarative - Could not find feature qml-network`
# Removing `-r` fixed this and modules are still working
# https://stackoverflow.com/questions/47443971/project-error-could-not-find-feature-when-running-qmake-on-any-qt-module
}

function make_cmd() {
LOG_FILE=${1:-'default'}
make -j 10 |& tee --append $ROOT/logs/$LOG_FILE.log
make |& tee --append $ROOT/logs/$LOG_FILE.log
}

function download_sysroot_minimal() {
Expand Down
6 changes: 5 additions & 1 deletion utils/compile-qt-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function build_module() {
function fix_qmake() {
QMAKE_FILE=mkspecs/devices/$TARGET_DEVICE/qmake.conf

echo "PATH"
echo $PWD
echo $QMAKE_FILE

# Add missing INCLUDEPATH in qmake conf
grep -q 'INCLUDEPATH' $QMAKE_FILE || cat>>$QMAKE_FILE << EOL
INCLUDEPATH += \$\$[QT_SYSROOT]/opt/vc/include
Expand All @@ -46,7 +50,7 @@ EOL
}

function build_qtbase() {
export CROSS_COMPILE=$ROOT/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
export CROSS_COMPILE=$ROOT/raspi/${LINARO_BASENAME}/bin/arm-linux-gnueabihf-
export SYSROOT=$ROOT/raspbian/sysroot
MODULE='qtbase'

Expand Down
4 changes: 3 additions & 1 deletion utils/download-raspbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ function download_raspbian() {
message 'Downloading Raspbian latest image'
wget --output-document=${RASPBIAN_BASENAME}.zip \
--content-disposition \
https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-03-03/2017-03-02-raspbian-jessie.zip
https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-01-12/2021-01-11-raspios-buster-armhf-lite.zip

#https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-01-12/2021-01-11-raspios-buster-armhf-full.zip
# https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-03-03/2017-03-02-raspbian-jessie.zip

unzip -p ${RASPBIAN_BASENAME}.zip > ${RASPBIAN_BASENAME}.img
}
Expand Down
8 changes: 5 additions & 3 deletions utils/init-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ if [[ ! $DOCKER_BUILD ]]; then
sudo umount $ROOT/raspbian/sysroot-full/proc

sudo mkdir -p $ROOT
sudo chown -R $USER:$USER $ROOT
GROUP=$(id -g -n)
sudo chown -R $USER:$GROUP $ROOT
else
# === Docker-Mode ===
# umount is not allowed in a docker image, besides we use a fresh linux image => skipping sanity checks
# sudo is also not needed/installed by default => creating directory structure without use of sudo
mkdir -p $ROOT
chown -R $USER:$USER $ROOT
GROUP=$(id -g -n)
chown -R $USER:$GROUP $ROOT
fi

cd_root

mkdir raspi raspbian bin logs
mkdir raspi -p raspbian bin logs
6 changes: 4 additions & 2 deletions utils/prepare-sysroot-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ sudo mount -o bind /sys sysroot-full/sys
# comment preload conf to avoid the following error during apt-get build-dep command
# qemu: uncaught target signal 4 (Illegal instruction) - core dumped
# Illegal instruction
sudo sed -i '/./s/^/#/g' sysroot-full/etc/ld.so.preload
# TODO It is now working without this - remove when properly tested
# sudo sed -i '/./s/^/#/g' sysroot-full/etc/ld.so.preload

# Uncomment deb-src to have access to dev packages
sudo sed -i '/deb-src/s/^#//g' sysroot-full/etc/apt/sources.list
Expand All @@ -44,7 +45,8 @@ sudo umount sysroot-full/sys
sudo umount sysroot-full/dev
sudo umount sysroot-full/proc

sudo chown -R $USER:$USER sysroot-full
GROUP=$(id -g -n)
sudo chown -R $USER:$GROUP sysroot-full

$UTILS_DIR/sysroot-relativelinks.py sysroot-full

37 changes: 28 additions & 9 deletions utils/synchronize-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function usage() {
Usage: $0 [options]

-h| --help Display help text.
-n| --no-download If the toolchain file is present, do not download it again.
-d| --directory Destination directory where the toolchain is downloaded.
EOF
}
Expand All @@ -16,6 +17,9 @@ while [[ $# -gt 0 ]]; do
-h|--help)
DISPLAY_HELP=true
;;
-n|--no-download)
NO_DOWNLOAD=true
;;
-d|--directory)
DIRECTORY_ARG="$2"
;;
Expand All @@ -41,17 +45,32 @@ fi

cd raspi

export LINARO_RELEASE="gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf"

message 'Downloading Raspberry Pi toolchain'

if [[ ! $DOCKER_BUILD ]]; then
if [[ ! -d 'tools' ]]; then
git clone https://github.com/raspberrypi/tools
fi
function download_toolchain() {
# Download and unzip the latest raspbian image (~1.4Go zipped)
message "Downloading linaro ${LINARO_RELEASE}"
wget --output-document=${LINARO_BASENAME}.tar.xz \
--content-disposition \
https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/${LINARO_RELEASE}.tar.xz
mkdir ${LINARO_BASENAME} && tar xfv ${LINARO_BASENAME}.tar.xz -C ${LINARO_BASENAME} --strip-components 1
}

pushd tools
git pull origin master
popd
if [[ -d "./${LINARO_BASENAME}" ]]; then
if [[ ! $NO_DOWNLOAD ]]; then
while true; do
read -p "You already have the current toolchain, do you want to download the lastest version [y/n]? " yn
case $yn in
[Yy]* ) download_toolchain; break;;
[Nn]* ) break;;
esac
done
else
echo "Using existing toolchain"
fi
else
# create shallow copy, which is a lot faster
git clone --depth=1 -b master https://github.com/raspberrypi/tools
download_toolchain;
fi