├── linux-pinephone-g++
├── qmake.conf
└── qplatformdefs.h
└── README.md
/linux-pinephone-g++/qmake.conf:
--------------------------------------------------------------------------------
1 | #
2 | # qmake configuration for the PinePhone with Mobian OS and Manajro ARM
3 |
4 | include(../common/linux_device_pre.conf)
5 |
6 | MAKEFILE_GENERATOR = UNIX # for Mobian
7 | CONFIG += incremental # for Mobian
8 | QMAKE_INCREMENTAL_STYLE = sublib # for Mobian
9 |
10 | QT_QPA_DEFAULT_PLATFORM = wayland
11 |
12 | SYSROOT_INC = $$[QT_SYSROOT]/usr/include
13 | SYSROOT_LIB = $$[QT_SYSROOT]/usr/lib
14 |
15 | # Extra stuff (OpenGL, DirectFB, ...)
16 | QMAKE_INCDIR_EGL = $$[SYSROOT_INC] \
17 | $$[SYSROOT_INC]/aarch64-linux-gnu \
18 | $$[SYSROOT_INC]/GL \
19 | $$[SYSROOT_INC]/EGL \
20 | $$[SYSROOT_INC]/GLES \
21 | $$[SYSROOT_INC]/GLES2 \
22 | $$[SYSROOT_INC]/GLES3 \
23 | $$[SYSROOT_INC]/GLFW
24 | QMAKE_LIBDIR_EGL = $$[SYSROOT_LIB] \
25 | $$[SYSROOT_LIB]/aarch64-linux-gnu
26 | QMAKE_INCDIR_OPENGL_ES2 = $$[QMAKE_INCDIR_EGL]
27 | QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL}
28 | QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL}
29 | QMAKE_LIBDIR_OPENVG = $${QMAKE_LIBDIR_EGL}
30 |
31 | QMAKE_LIBS_EGL = -lEGL
32 | QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL}
33 | QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL}
34 |
35 | #modifications to gcc-base.conf
36 | COMPILER_FLAGS = -march=armv8-a -mtune=cortex-a53
37 | QMAKE_CFLAGS = $${COMPILER_FLAGS}
38 | QMAKE_CXXFLAGS = $${COMPILER_FLAGS}
39 | QMAKE_CXXFLAGS_RELEASE += -O3
40 |
41 | QMAKE_LIBS += -lrt -lpthread -ldl
42 |
43 | DISTRO_OPTS += aarch64
44 |
45 | # for Mobian
46 | DISTRO_OPTS += deb-multi-arch
47 |
48 | # Preferred eglfs backend
49 | EGLFS_DEVICE_INTEGRATION = eglfs_mali
50 |
51 | include(../common/linux_arm_device_post.conf)
52 |
53 | load(qt_config)
54 |
--------------------------------------------------------------------------------
/linux-pinephone-g++/qplatformdefs.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2016 The Qt Company Ltd.
4 | ** Contact: https://www.qt.io/licensing/
5 | **
6 | ** This file is part of the qmake spec of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and The Qt Company. For licensing terms
14 | ** and conditions see https://www.qt.io/terms-conditions. For further
15 | ** information use the contact form at https://www.qt.io/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 3 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 3 requirements
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 | **
25 | ** GNU General Public License Usage
26 | ** Alternatively, this file may be used under the terms of the GNU
27 | ** General Public License version 2.0 or (at your option) the GNU General
28 | ** Public license version 3 or any later version approved by the KDE Free
29 | ** Qt Foundation. The licenses are as published by the Free Software
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 | ** included in the packaging of this file. Please review the following
32 | ** information to ensure the GNU General Public License requirements will
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 | ** https://www.gnu.org/licenses/gpl-3.0.html.
35 | **
36 | ** $QT_END_LICENSE$
37 | **
38 | ****************************************************************************/
39 |
40 | #include "../../linux-g++/qplatformdefs.h"
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Qt 5 CrossCompile for PinePhone
2 | Revision Date : 2023/11/17
3 |
4 |
5 | # Preface
6 | **This article is Qt 5.15 Cross-Compile and Remote Debug for PinePhone.**
7 | **I am building a cross compile environment with Qt 5.15.2, 5.15.11 (Mobian) and Qt 5.15.2, 5.15.6, 5.15.8, 5.15.11 (Manjaro ARM).**
8 |
9 | Here, my Linux PC is SUSE Enterprise 15 and openSUSE 15, my PinePhone is Mobian(Phosh) and Manjaro ARM(Phosh).
10 | When building Qt, please adapt to each user's environment.
11 |
12 | If you are using Mobian OS, I think that it is similar to the Cross-Compilation procedure for Raspberry Pi.
13 |
14 | **Note:**
15 | **If you want to use the latest GCC AArch64 ToolChain,**
16 | **you need to build GCC yourself by referring to the URL shown below.**
17 |
18 | https://github.com/presire/How_to_create_GCC_ToolChain_for_PinePhone.git
19 |
20 | **It is easy to create and is recommended.**
21 |
22 |
23 | # 1. Install the necessary dependencies for PinePhone and SSH Setting (PinePhone)
24 | Create a directory for installing Qt libraries on PinePhone.
25 | *This directory will be used in the last part of this article.*
26 |
27 | mkdir -p ~/InstallSoftware/Qt_5_15_2
28 |
29 |
30 | Get the latest updates on PinePhone.
31 |
32 | # Mobian
33 | sudo apt-get update
34 | sudo apt-get dist-upgrade
35 | sudo shutdown -r now
36 |
37 | # Manjaro
38 | sudo pacman -Syyu
39 | sudo shutdown -r now
40 |
41 |
42 | Install SSH server on PinePhone.
43 |
44 | # Mobian
45 | sudo apt-get install openssh-server
46 |
47 | # Manjaro
48 | sudo pacman -S --needed openssh
49 |
50 |
51 | Configure the SSH Server to start automatically, and start the SSH Server.
52 |
53 | # Mobian
54 | sudo systemctl enable ssh
55 | sudo systemctl start ssh
56 |
57 | # Manjaro
58 | sudo systemctl enable sshd
59 | sudo systemctl start sshd
60 |
61 |
62 | Install the dependencies required to build the Qt Library.
63 |
64 | # Mobian
65 | sudo apt-get install unzip ccache pkgconf-bin pkg-config libpkgconf3 pkgconf \
66 | build-essential make autoconf cmake extra-cmake-modules gcc gfortran gdb gdbserver python3 libgtk-3-dev \
67 | libc6 libc6-dev linux-libc-dev glibc-source libc-dev-bin libc-devtools libglib2.0-0 libglib2.0-dev libglib2.0-dev-bin \
68 | libgmp-dev libmpc-dev libmpfr-dev libisl-dev gconf2 gconf2-common libgconf2-dev \
69 | libdbus-1-3 libdbus-1-dev libdbus-c++-bin libdbus-c++-dev libsctp1 libsctp-dev libatspi2.0-0 libatspi2.0-dev \
70 | libzstd1 libzstd-dev libinput-bin libinput-dev libts0 libts-bin libts-dev libmtdev1 libmtdev-dev libevdev2 \
71 | libevdev-dev libicu-dev icu-devtools libblkid1 libblkid-dev libffi8 libffi-dev libmount1 libmount-dev \
72 | libudev1 libudev-dev libhd21 libhd-dev libtsm-dev pcre2-utils libpcre2-32-0 libpcre2-dev libselinux1 libselinux1-dev \
73 | libsepol2 libsepol-dev libwacom9 libwacom-dev libassimp5 libassimp-dev \
74 | libproxy-dev liblttng-ust1 liblttng-ust-common1 liblttng-ust-dev libb2-1 libb2-dev libsdl2-dev \
75 | libfontconfig1 libfontconfig-dev libfontconfig1-dev \
76 | libjpeg-dev libjpeg62-turbo libjpeg62-turbo-dev libjpeg-dev libasound2 libasound2-dev \
77 | sqlite3 libsqlite3-0 libsqlite3-dev libssl3 libssl-dev libnss3 libnss3-dev libxslt1.1 libxslt1-dev \
78 | libpugixml1v5 libpugixml-dev \
79 | libxkbcommon-dev libxcb-xinerama0 libxcb-xinerama0-dev libglut3.12 libglut-dev \
80 | libwayland-bin libwayland-dev libwayland-egl1 libwayland-egl++1 libwayland-egl1-mesa libwayland-egl-backend-dev \
81 | libwayland-client++1 libwayland-client-extra++1 libwayland-cursor++1 wayland-scanner++ wayland-protocols waylandpp-dev \
82 | libosmesa6-dev mesa-common-dev libopengl-dev libgl-dev libglm-dev libgl1-mesa-dev libgle3-dev libgles-dev \
83 | libgles2-mesa-dev libegl-dev libegl1-mesa-dev libgegl-dev libglu1-mesa libglu1-mesa-dev libglw1-mesa-dev \
84 | libglfw3-dev libglew-dev libglx-dev libgbm-dev libdrm-dev libdirectfb-dev \
85 | libglvnd-dev libglvnd-core-dev libglut-dev libopenal-dev libalut-dev \
86 | libweston-10-0 libweston-10-dev \
87 | linux-headers-arm64 linux-headers-6.1-sunxi64 # May not be necessary
88 |
89 | # Manjaro
90 | sudo pacman -S --needed base-devel rsync vi vim util-linux-libs glib2 make cmake unzip pkg-config \
91 | gdb gdb-common gdbm gcc gcc-libs gcc-fortran python2 python3 \
92 | ccache icu lksctp-tools python-atspi zstd libinput libtsm mtdev \
93 | libevdev libffi pcre pcre2 libwacom assimp fontconfig dbus dbus-c++ nss \
94 | libxkbcommon alsa-lib libxinerama pugixml sqlite libxslt openssl ffmpeg \
95 | wayland wayland-utils wayland-protocols egl-wayland waylandpp \
96 | wrapland wlc wayfire glew-wayland glfw-wayland libva1 \
97 | mesa mesa-utils glu libglvnd libb2 lttng-ust libproxy
98 |
99 |
100 | *If you want to use other features, you should also install the following dependencies.*
101 |
102 | **Mobian**
103 | * Bluetooth
104 | bluez bluez-tools libbluetooth-dev
105 |
106 | * Photo
107 | libjpeg-dev libpng-dev libtiff-dev libmng-dev libwebp-dev
108 |
109 | * Codec
110 | libavcodec-dev libavformat-dev libavutil-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev
111 | libpostproc-dev libv4l-dev libxvidcore-dev libx264-dev libx265-dev
112 |
113 | * Multimedia
114 | libwmf-dev
115 | libgstreamer1.0-0 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base
116 | gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad
117 | libgstreamer-plugins-bad1.0-dev gstreamer1.0-libav gstreamer1.0-pulseaudio gstreamer1.0-tools
118 | gstreamer1.0-alsa gstreamer1.0-x gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5
119 | libwayland-dev
120 |
121 | * ALSA audio
122 | libasound2-dev
123 |
124 | * Pulse audio
125 | pulseaudio libpulse-dev
126 |
127 | * OpenAL audio
128 | libopenal1 libopenal-data libopenal-dev libsndio7.0 libsndio-dev
129 |
130 | * Text to Speech
131 | flite1-dev libspeechd-dev
132 |
133 | * Qt SerialPort
134 | libserialport-dev
135 |
136 | * Database
137 | ODBC : unixodbc unixodbc-common unixodbc-dev
138 | PostgreSQL : libpq-dev
139 | MariaDB : libmariadbclient-dev
140 | SQLite : libsqlite3-dev
141 |
142 | * Printer
143 | libcups2-dev
144 |
145 | * Accessibility
146 | libatspi2.0-dev
147 |
148 | * SCTP
149 | libsctp1 libsctp-dev
150 | (To enable this, add the **-sctp** option when configuring.)
151 |
152 |
153 | **Manjaro**
154 | * Bluetooth
155 | bluez bluez-tools bluez-libs bluez-utils
156 |
157 | * Photo
158 | openjpeg2 libjpeg-turbo libpng libtiff libmng
159 |
160 | * Codec
161 | ffmpeg v4l-utils xvidcore x264 x265
162 |
163 | * Multimedia
164 | gstreamer gstreamermm gst-plugins-base gst-plugins-base-libs gst-plugins-good
165 | gst-plugins-bad gst-plugins-bad-libs gst-plugins-ugly gst-libav gst-plugin-wpe
166 | gst-plugin-pipewire gst-plugin-gtk qt-gstreamer gst-plugin-qmlgl gst-plugin-opencv
167 |
168 | * ALSA audio
169 | alsa-lib
170 |
171 | * Pulse audio
172 | pulseaudio-alsa
173 |
174 | * OpenAL audio
175 | openal
176 |
177 | * Text to Speech
178 | flite
179 |
180 | * Qt SerialPort
181 | libserialport
182 |
183 | * Database
184 | PostgreSQL : postgresql-libs libpqxx
185 | MariaDB : mariadb-clients mariadb-libs
186 | SQLite : sqlite
187 |
188 | * Printer
189 | libcups
190 |
191 | * Accessibility
192 | at-spi2-core at-spi2-atk
193 |
194 | * SCTP
195 | lksctp-tools
196 | (To enable this, add the **-sctp** option when configuring.)
197 |
198 | * Webengine
199 | Required : flex bison gperf readline nss libdrm
200 | Option1 : libxml2 libxml++ libxslt minizip jsoncpp lcms2 libevent protobuf protobuf-c
201 | Option2(Be careful, as it is unstable.) : opus libvpx
202 |
203 |
204 | Use the rsync command to synchronize the files between Linux PC and PinePhone.
205 | However, **some of the files to be synchronized require root privileges.**
206 |
207 | Therefore, add the following settings to the /etc/sudoers file so that all files can be synchronized even by ordinary users.
208 | With the following settings, the rsync command will be executed with super user privileges if necessary.
209 |
210 | echo "$USER ALL=NOPASSWD:$(which rsync)" | sudo tee --append /etc/sudoer
211 |
212 |
213 | Restart PinePhone just in case.
214 |
215 | sudo shutdown -r now
216 | # or
217 | sudo systemctl reboot
218 |
219 |
220 | # 2. Qt Source Code Download and etc... (Linux PC)
221 | # Qt 5.15.2
222 | wget https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
223 | tar xf qt-everywhere-opensource-src-5.15.2.tar.gz
224 |
225 | # Qt 5.15.6
226 | https://download.qt.io/official_releases/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz
227 | tar xf qt-everywhere-opensource-src-5.15.6.tar.gz
228 |
229 | Create the directories needed for the build.
230 |
231 | mkdir -p / \
232 | / \
233 | //bin \
234 | / \
235 | /
236 |
237 |
238 | # 3. Download the Qt target file from this Github (Linux PC)
239 | git clone https://github.com/presire/PinePhone_for_Qt_CrossCompile.git
240 |
241 | cp -r PinePhone_for_Qt_CrossCompile/linux-pinephone-g++ qt-everywhere-src-5.15.2/qtbase/mkspecs/devices
242 |
243 |
244 | In the downloaded and copied qmake.conf,
245 | comment **DISTRO_OPTS += deb-multi-arch** if you want to use Manjaro ARM.
246 |
247 | vi qt-everywhere-src-5.15.2/qtbase/mkspecs/devices/linux-pinephone-g++/qmake.conf
248 |
249 |
250 | # qt-everywhere-src-5.15.2/qtbase/mkspecs/devices/linux-pinephone-g++/qmake.conf file
251 |
252 | ...
253 |
254 | # If you use Manjaro ARM, you need to comment it.
255 | #DISTRO_OPTS += deb-multi-arch
256 |
257 | ...
258 |
259 |
260 | # 4. Setting Linux PC and Download GCC ARM Toolchain (Linux PC)
261 | First, Install the dependencies required to build the Qt Library for Linux PC.
262 | *(Perhaps **texinfo** is unnecessary.)*
263 |
264 | sudo zypper install autoconf automake cmake unzip tar git wget pkg-config gperf gcc gcc-c++ \
265 | gawk bison openssl flex figlet pigz ncurses-devel ncurses5-devel texinfo
266 |
267 |
268 | Next, download or install GCC ToolChain for AArch64.
269 | There are two ways to use the GCC ToolChain for AArch64.
270 |
271 |
272 | ## If create GCC ToolChain for PinePhone (Recommend)
273 | Access the URL shown below to create a GCC ToolChain.
274 | https://github.com/presire/How_to_create_GCC_ToolChain_for_PinePhone
275 |
276 | **Note :**
277 | **When building Qt 5.15, the following error occurs when using GCC 11 or later.**
278 | **However, no modification is required when building Qt 5.15.6.**
279 |
280 | error: 'numeric_limits' is not a member of 'std' static_cast(numbers.size()) : std::numeric_limits::max();
281 |
282 | error: expected primary-expression before '>' token static_cast(numbers.size()) : std::numeric_limits::max();
283 |
284 | error: '::max' has not been declared; did you mean 'std::max'? static_cast(numbers.size()) : std::numeric_limits::max();
285 |
286 |
287 | This is because std::limits has been removed and moved to the limits.h file.
288 |
289 | If you are building Qt 5.15.2 using GCC 11 or later,
290 | edit the file "qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qglobal.h" (**Around lines 45-48**) as shown below.
291 |
292 | vi qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qglobal.h
293 |
294 | // Before Edit
295 | #ifdef __cplusplus
296 | # include
297 | # include
298 | # include
299 | #endif
300 |
301 | // After Edit
302 | #ifdef __cplusplus
303 | # include
304 | # include
305 | # include
306 | #include // <- Add a line. (include limits.h file)
307 | #endif
308 |
309 |
310 | ### If you use Linaro GCC Toolchain
311 | Linaro offers monthly GNU toolchain integration builds that provide users with a snapshot of upstream builds.
312 | These builds allow developers to immediately test the functionality of pre-built binaries upstream.
313 |
314 | Download Linaro GCC ARM Toolchain.
315 | (latest) GCC Tool Chain Link : https://snapshots.linaro.org/gnu-toolchain/
316 |
317 | GCC Tool Chain 12.3 Link : https://snapshots.linaro.org/gnu-toolchain/12.3-2023.06-1/aarch64-linux-gnu/
318 | (old) GCC Tool Chain 7.5 Link : https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/
319 |
320 | tar xf gcc-linaro--x86_64_aarch64-linux-gnu.tar.xz
321 |
322 |
323 |
324 | # 5. Download & Install Wayland-Scanner (Linux PC)
325 | You need to install **Meson** & **Ninja** for building **Wayland-Scanner**.
326 |
327 | git clone https://github.com/wayland-project/wayland.git
328 | cd wayland && mkdir build
329 |
330 | meson ./build/ --prefix= -Ddocumentation=false
331 | ninja -C build/ install
332 |
333 | cp //bin/wayland-scanner //bin
334 |
335 |
336 | # 6. Download PinePhone's System Root (Linux PC)
337 | It is necessary to synchronize with the root directory of PinePhone, create the system root directory.
338 |
339 | mkdir -p ~/ && \
340 | ~//usr && \
341 | ~//usr/share
342 |
343 |
344 | rsync -avz --rsync-path="sudo rsync" --delete --rsh="ssh" @:/lib ~//
345 | rsync -avz --rsync-path="sudo rsync" --delete --rsh="ssh" @:/usr/lib ~//usr
346 | rsync -avz --rsync-path="sudo rsync" --delete --rsh="ssh" @:/usr/include ~//usr
347 | rsync -avz --rsync-path="sudo rsync" --delete --rsh="ssh" @:/usr/share/pkgconfig ~//usr/share
348 |
349 |
350 | Convert symbolic links of downloaded files and directories from absolute paths to relative paths.
351 |
352 | wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
353 | chmod +x sysroot-relativelinks.py
354 |
355 | ./sysroot-relativelinks.py
356 |
357 |
358 | # 7. Build Qt Source Code (Linux PC)
359 | **Note**
360 | When you use **GCC 13**, QtLocation builds may output build errors as shown below.
361 |
362 | error: 'uint8_t' was not declared in this scope
363 |
364 |
365 | This is because GCC 13 shuffles some internal includes, so ***cstdint*** is not included transiently.
366 | To use **uint8_t**, ***cstdint*** must be explicitly included.
367 |
368 | // qt-everywhere-src-5.15.XX/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp
369 | // Line 7.
370 | #include // Add
371 |
372 |
373 | // qt-everywhere-src-5.15.XX/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp
374 | // Line 6.
375 | #include // Add
376 |
377 |
378 | // qt-everywhere-src-5.15.XX/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp
379 | // Line 4.
380 | #include // Add
381 |
382 |
383 | Build the Qt source code.
384 |
385 | export PATH="//bin:$PATH"
386 |
387 | PKG_CONFIG_PATH=//usr/lib/pkgconfig://usr/lib/aarch64-linux-gnu/pkgconfig \
388 | PKG_CONFIG_LIBDIR=//usr/lib/pkgconfig://usr/lib/aarch64-linux-gnu/pkgconfig://usr/share/pkgconfig \
389 | ..//configure -v \
390 | -release \
391 | -opensource -confirm-license \
392 | -opengl es2 \
393 | -qpa wayland \
394 | -device linux-pinephone-g++ \
395 | -device-option CROSS_COMPILE=//bin/aarch64-linux-gnu- \
396 | -nomake examples -no-compile-examples -nomake tests -make libs -no-use-gold-linker -recheck-all \
397 | -skip qtwebengine -skip qtandroidextras -skip qtmacextras -skip qtwinextras \
398 | -skip qtscript -skip qtdoc \ (If not required)
399 | -skip qtgamepad -skip qtpurchasing -skip qtcharts -skip qtsensors \ (If not required)
400 | -skip qtlocation -skip qtspeech -skip qtlottie \ (If not required)
401 | -sysroot / \
402 | -prefix / \
403 | -extprefix / \
404 | -hostprefix / \
405 | #-no-gcc-sysroot # Comment if you use Linaro GCC Toolchain.
406 | # If you have built your own GCC Toolchain, you may need to remove comment.
407 |
408 |
409 | If the Configure script succeeds, execute the make or gmake command.
410 |
411 | make -j $(nproc) or gmake -j $(nproc)
412 |
413 | make install or gmake install
414 |
415 |
416 | # 8. Upload Qt Library (Linux PC)
417 | Deploy the built Qt library to PinePhone.
418 |
419 | rsync -avz --rsh="ssh" --delete //* \
420 | @:/home//InstallSoftware/Qt_5_15_2
421 |
422 |
423 | # 9. Setting Qt LIBRARY Path and etc... (PinePhone)
424 | Since the Qt Library you uploaded to PinePhone may have root privileges, execute the following command.
425 |
426 | sudo chown -R : ~/InstallSoftware/Qt_5_15_2
427 |
428 |
429 | Add the following content to the bottom line of the .profile.
430 |
431 | export QT_QPA_PLATFORMTHEME="qt5ct"
432 | export DISPLAY=":0" or export DISPLAY=":0.0"
433 |
434 | export QML_IMPORT_PATH="/home//InstallSoftware/Qt_5_15_2/qml"
435 | export QML2_IMPORT_PATH="/home//InstallSoftware/Qt_5_15_2/qml"
436 | export QT_PLUGIN_PATH="/home//InstallSoftware/Qt_5_15_2/plugins"
437 | export QT_QPA_PLATFORM_PLUGIN_PATH="/home//InstallSoftware/Qt_5_15_2/plugins/platforms"
438 | export QML_IMPORT_TRACE=1 # (if necessary)
439 |
440 |
441 | **Note:**
442 | If you write the environment variable LD_LIBRARY_PATH in .profile,
443 | you need to set again the environment variable LD_LIBRARY_PATH again in Qt Creator,
444 | [Project] - [Run] - [Environment] when you use Qt Creator for remote debugging.
445 |
446 | # ~/.profile
447 | export LD_LIBRARY_PATH="/home//InstallSoftware/Qt_5_15_2/lib:$LD_LIBRARY_PATH"
448 | export LD_LIBRARY_PATH="/home//InstallSoftware/Qt_5_15_2/plugins/qmltooling:$LD_LIBRARY_PATH"
449 |
450 |
451 | I personally recommend is to create a "00-Qt_5_15_2.conf" file in the /etc/ld.so.conf.d directory,
452 | and write the path as shown below.
453 |
454 | # /etc/ld.so.conf.d/00-Qt_5_15_2.conf
455 | /home//InstallSoftware/Qt_5_15_2/lib
456 | /home//InstallSoftware/Qt_5_15_2/plugins/qmltooling
457 |
458 |
459 | Update the .profile or /etc/ld.so.conf.d/00-Qt_5_15_2.conf.
460 |
461 | # .profile
462 | source .profile
463 |
464 | # /etc/ld.so.conf.d/00-Qt_5_15_2.conf
465 | sudo ldconfig
466 |
467 |
468 | Restart PinePhone.
469 |
470 | sudo shutdown -r now
471 |
472 |
473 | # 10. Use Qt Creator
474 | ## 10.1 Qt Creator General Settings
475 | Launch Qt Creator.
476 |
477 |
478 | * Setting up the Qt compiler Linaro GCC AArh64 Toolchain.
479 | Qt Creator - [Tool] - [Option] - [Kits] - [Compiler] -[Add] - [GCC] - [C]
480 | //bin/aarch64-linux-gnu-gcc
481 | Qt Creator - [Tool] - [Option] - [Kits] - [Compiler] -[Add] - [GCC] - [C++]
482 | //bin/aarch64-linux-gnu-g++
483 |
484 | * Setting up the Qt Debugger Linaro GCC AArh64 Toolchain.
485 | Qt Creator - [Tool] - [Option] - [Kits] - [Debugger] -[Add]
486 | //bin/aarch64-linux-gnu-gdb
487 |
488 | * Setting up the Qt Qmake for Qt Cross-Compile.
489 | Qt Creator - [Tool] - [Option] - [Kits] - [Qt version] -[Add]
490 | //bin/qmake
491 |
492 | * Setting up the Qt Qmake for Qt Cross-Compile.
493 | Qt Creator - [Tool] - [Option] - [Kits] - [Kits] -[Add]
494 | Compiler : The compiler configured above
495 | Debugger : The debugger configured above
496 | Qt version : The Qmake configured above
497 | Qt mkspec : //mkspecs/devices/linux-pinephone-g++
498 | Sysroot(It can be set or unset) : /\
499 |
500 | * Setting Add GDB Start Command.
501 | Qt Creator - [Tool] - [Option] - [Debugger] - [GDB]Tab
502 | Additional Startup Commands : set sysroot target:/
503 |
504 |
505 | ## 10.2 Setting up each project in Qt Creator
506 | Launch Qt Creator and Open or Create Qt Project.
507 |
508 |
509 | Qt Creator - [Project] - [Run] - [Run Settings] - [Environment] - [Details] - [Add]
510 | then, Click [Fetch Device Environment]Button.
511 | **when you run the debugger, Be sure to click on [Fetch Device Environment]Button.**
512 |
513 | * Variable - QT_QPA_PLATFORMTHEME
514 | Value - qt5ct
515 |
516 | * Variable : DISPLAY
517 | Value : 0 or Value : 0.0
518 |
519 | * Variable : LD_LIBRARY_PATH
520 | (If you write the environment variable LD_LIBRARY_PATH in PinePhone's .profile, you need to set this.)
521 | Value : /home//InstallSoftware/Qt_5_15_2/lib:/home//InstallSoftware/Qt_5_15_2/plugins/qmltooling
522 |
523 |
524 | # 11. Warning and Error related
525 | ## 11.1 Screen display-related errors for Debug
526 | When debugging, the following error is output.
527 |
528 | Failed to create wl_display (No such file or directory)
529 | ...
530 | error: XDG_RUNTIME_DIR not set in the environment
531 | ...
532 | qt.qpa.plugin: Could not load the Qt platform plugin "wayland"
533 |
534 |
535 | To fix this error,
536 | Qt Creator Side-Menu [Projects] - [Build & Run] - [Run] - [Command line arguments:]entry,
537 | Add the **-platform wayland** option to the [aaa] entry.
538 |
539 |
540 | ## 11.2 Debug start speed issues
541 | When you debug remote targets, GDB Debugger is looking in the local PinePhone's System-Root directory for the libraries.
542 | So just need to tell GDB Debugger to load the remote PinePhone's System-Root from the remote target.
543 |
544 | but, "set sysroot target:/" takes a long time to start debugging,
545 | so writing the following setting will speed up the start of debugging.
546 |
547 | First, Create the directories and symbolic links shown below.
548 |
549 | mkdir -p //home//InstallSoftware
550 | ln -s / //home//InstallSoftware
551 | mv //home//InstallSoftware/ \
552 | //home//InstallSoftware/Qt_5_15_2
553 |
554 |
555 | Next, Write the following settings.
556 | Qt Creator - [Tool] - [Option] - [Debugger] - [GDB]Tab - [Additional Startup Commands]
557 |
558 | set sysroot /<System Root PinePhone>
559 |
560 |
561 | ## 11.3 Floating point warning in GDB
562 | When you use GCC AArch64 TooChain 7.5 GDB, the following warning is displayed.
563 |
564 | **The warning shown below**
565 |
566 | while parsing target description (at line 68): Vector "v8f" references undefined type "ieee_half"
567 | Could not load XML target description; ignoring
568 |
569 |
570 | I don't know if this is the right way to do it,
571 | if you use "GDB for the GCC AArch64 ToolChain 10.2", you won't get the warning output.
572 |
573 | Download the GCC AArch64 ToolChain 10.2, shown bellow URL.
574 | You need to select "AArch64 GNU/Linux target (aarch64-none-linux-gnu)".
575 | https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
576 |
577 |
578 | **Note :**
579 | **The best way is to create your own GCC Toolchain for PinePhone.**
580 | **The URL shown below describes how to create a GCC Toolchain.**
581 |
582 | **https://github.com/presire/How_to_create_GCC_ToolChain_for_PinePhone.git**
583 |
584 |
585 | Make sure you can debug Qt project.
586 |
--------------------------------------------------------------------------------