Raspberry Pi learning :: qt5.10.1 cross-compiler opengl ES2 [with] (armv8 64-bit)

Test Environment (raspberry pie and learning :: qt5 cross-compiler (armv8 64-bit) unanimously)
(1) hardware device

msi notebook, I7-4710H, 16G memory
Raspberry Pi 3b +, armv8 (64 bit), 16Gsd card
(2) System Environment

Notebook: ubuntu16.04 x64 bit
Raspberry Pi 3b +: debian9 x64 bits
recommendations: To cross compiler program 32, preferably a notebook system 32, on the contrary, if the cross compiler program 64, a notebook systems 64 , so you can avoid a lot of strange error

Environment configuration and compilation process
a raspberry pie environment configuration

(1) Since the unofficial, or with 64-bit system, the installation of the system will not repeat step

(2) Installation opengl

sudo apt-get install libgles2-mesa

APT-GET install libgles2 sudo-Mesa-dev
(3) to install the necessary environment to compile QT [although we are not in compiler development board QT, but we need these libraries to build sysroot]

sudo apt-get install libxcb-xinerama0-dev

sudo apt-add-repository ppa:u-szeged/sedkit

sudo apt-get update

sudo apt-get install sedkit-env-qtwebkit

sudo apt-get install build-essential perl python git

sudo apt-get install libx11-dev libxcb1-dev libxkbcommon-x11-dev libx11-xcb-dev libxext-dev

sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby

sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison

sudo apt-get install libbz2-dev libgcrypt11-dev libdrm-dev libcups2-dev libatkmm-1.6-dev

sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
compiler version (4) of the inspection system

Second, the notebook (ubuntu16.04) Environment Configuration

(1) cross-compiler downloads

https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/

Download the following figure two things:

A compiler, one sysroot

(2) Configuration cross compiler

Configuration process does not go into details, see raspberry pie learning :: qt5 cross-compiler (armv8 64-bit). The

(3) We also got another thing is sysroot

Briefly about the role of this thing: to construct a file system, we also need to develop the board opt, lib, usr and other directories covering up, both into one file system, used to provide cross-compiler compiler looking head .h files and libraries with .so other things. After so as to provide a substantially consistent with the target development board environment, given this environment, do not look for header files compiled when looking at notebook (ubuntu16.04) environment, only to find in sysroot this directory.

1) find a place, create directories

PI PI mkdir / sysroot
2) the downloaded directory stuff extract to sysroot effect is as follows:

3) Remove the Raspberry Pi sd card, sd card at rootfs directory will lib, opt, usr / include, something usr / lib directory to the cover / home / msi / pi / sysroot corresponding directory.

Select the merge, you can experience the same choice of coverage

[As long thought to construct a document setting development board, you will know how to do]

4) After the copy is complete, return to pi directory, create a new sysroot.py file, as follows:

#!/usr/bin/env python
import sys
import os

Take a sysroot directory and turn all the abolute symlinks and turn them into

relative ones such that the sysroot is usable within another system.

if len(sys.argv) != 2:
print("Usage is " + sys.argv[0] + “”)
sys.exit(1)

topdir = sys.argv [1]
topdir = os.path.abspath (topdir)

def handlelink(filep, subdir):
link = os.readlink(filep)
if link[0] != “/”:
return
if link.startswith(topdir):
return
#print(“Replacing %s with %s for %s” % (link, topdir+link, filep))
print(“Replacing %s with %s for %s” % (link, os.path.relpath(topdir+link, subdir), filep))
os.unlink(filep)
os.symlink(os.path.relpath(topdir+link, subdir), filep)

for subdir, dirs, files in os.walk(topdir):
for f in files:
filep = os.path.join(subdir, f)
if os.path.islink(filep):
#print(“Considering %s” % filep)
handlelink(filep, subdir)
5)保存后,给权限

the chmod + X sysroot.py the sudo
. 6) in the directory pi, execute, the symbolic link to solve the problem of the directory

sysroot ./sysroot.py
. 7) to here, arranged substantially complete environment

Third, compile QT

(1) Download the source code, and here I want to compile version qt5.10.1

http://download.qt.io/archive/qt/

Select the corresponding source code can be downloaded

(2) extracting the source, the position of free

(3) into the extracted directory, a new file autoconfig.sh, to modify the configuration parameters, as follows

Among them, the output path after -prefix path, but since we gave sysroot this path, so the final output path sysroot / prefix, that is our ultimate compilation results in / home / msi / pi / sysroot / home / msi / arm / qt5101_64 / qt_sdk, here
-sysroot path for the development board we just build a file system
-linuxfb represent compile the plug-in, this is the software rendering plug-in for displaying qtgui program
-eglfs hardware rendering plug, use this to run the program, will force the program to full screen
-openg es2 represent compiled with opengl es2 the qt
#! / bin / SH
./configure -prefix / Home / the MSI / ARM / qt5101_64 / qt_sdk
-verbose
-opensource
-release
-confirm-License
-xplatform Linux ++-G-gnueabi -ARM
-shared
-QT-zlib
-QT-libjpeg
-QT the libpng-
-make libs
-linuxfb
-eglfs
-NO2-CUPS
-NO2-iconv
-NO2-PCH
-NO2 OpenGL-
-OpenGL ES2
OpenSSL--NO2
-nomake examples
-sysroot / Home / MSI / PI / sysroot
(. 4) from the root directory qt source into

1) Modify qmake.conf file

QMAKE_INCDIR_OPENGL [_ES2], QMAKE_LIBDIR_OPENGL [_ES2 ], QMAKE_LIBS_OPENGL [_ES2] specifies the headers and the OpenGL ES2 library files, the path can be modified according to their actual key to find ES2 OpenGL library and header file of the file path egl
then the compiler into just in front of the cross compiler configuration (refer to read: raspberry Pi :: learning described qt5 cross compiler (armv8 64 bits)) that is modified to map the contents of the box:

2) the modified content as follows

qmake configuration for building with arm-linux-gnueabi-g++

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QMAKE_INCDIR_POST +=
KaTeX parse error: Undefined control sequence: \ at position 26: …T]/usr/include \̲ ̲ [QT_SYSROOT]/usr/include/aarch64-linux-gnu

QMAKE_LIBDIR_POST +=
KaTeX parse error: Undefined control sequence: \ at position 22: …SROOT]/usr/lib \̲ ̲ [QT_SYSROOT]/lib/aarch64-linux-gnu
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu

QMAKE_RPATHLINKDIR_POST +=
KaTeX parse error: Undefined control sequence: \ at position 22: …SROOT]/usr/lib \̲ ̲ [QT_SYSROOT]/usr/lib/aarch64-linux-gnu
KaTeX parse error: Undefined control sequence: \ at position 46: …inux-gnu/tegra \̲ ̲ [QT_SYSROOT]/lib/aarch64-linux-gnu

QMAKE_INCDIR_OPENGL[_ES2] +=
KaTeX parse error: Undefined control sequence: \ at position 22: …SROOT]/include \̲ ̲ [QT_SYSROOT]/include/EGL
KaTeX parse error: Undefined control sequence: \ at position 28: …/include/GLES2 \̲ ̲ [QT_SYSROOT]/include/GLES3
KaTeX parse error: Undefined control sequence: \ at position 26: …T]/include/KHR \̲ ̲ [QT_SYSROOT]/usr/include
KaTeX parse error: Undefined control sequence: \ at position 30: …sr/include/EGL \̲ ̲ [QT_SYSROOT]/usr/include/GLES2
KaTeX parse error: Undefined control sequence: \ at position 32: …/include/GLES3 \̲ ̲ [QT_SYSROOT]/usr/include/KHR

QMAKE_LIBDIR_OPENGL[_ES2] +=
KaTeX parse error: Undefined control sequence: \ at position 45: …x-gnu/mesa-egl \̲ ̲ [QT_SYSROOT]/lib/aarch64-linux-gnu/tegra-egl
KaTeX parse error: Undefined control sequence: \ at position 38: …64-linux-gnu \̲ ̲ [QT_SYSROOT]/usr/lib/aarch64-linux-gnu/mesa-egl
KaTeX parse error: Undefined control sequence: \ at position 50: …-gnu/tegra-egl \̲ ̲ [QT_SYSROOT]/usr/lib/aarch64-linux-gnu

QMAKE_LIBS_OPENGL[_ES2] += -lEGL -lGLESv2

include(…/common/linux.conf)
include(…/common/gcc-base-unix.conf)
include(…/common/g+±unix.conf)

modifications to g++.conf

QMAKE_CC = aarch64-linux-gnu-gcc
QMAKE_CXX = aarch64-linux-gnu-g++
QMAKE_LINK = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++

modifications to linux.conf

= Aarch64-Linux-QMAKE_AR GNU-Ar CQS
QMAKE_OBJCOPY = aarch64-GNU-Linux-the objcopy
QMAKE_NM = aarch64 GNU-Linux-nm--P
QMAKE_STRIP = aarch64 GNU-Linux-Strip-
Load (qt_config)
(. 5) starts to compile the configuration qt parameters, namely qt source in the root directory, you can run autoconfig.sh

sudo chmod +x autoconfig.sh

./autoconfig.sh
configuration results may be prompted to opengl function test failed, probably like this

#opengl es2 header files, libraries, configuration errors:

ERROR: Feature ‘opengles2’ was enabled, but the pre-conditio

#EGL header file or library file path configuration errors:

ERROR: Feature ‘eglfs’ was enabled, but the pre-conditio

At this time, the source code can be found in the root directory qt config.log, this is generated when configure configuration log, time to find what is wrong can be.

After revising, it can not be directly re-run autoconfig.sh, configuration files and config.cache config.log be deleted before that delete two files in the following figure:

Until the configuration is successful, it is likely to be output as follows:

(6) begin compile

make -j4
compilation process, if stopped because of an error, but an error message when they can not see, can once again run make, this time it is easy to find the error message

If prompted what header files are missing, these library files, found after the corresponding question,

(1) sd card can be inserted back on the board, then install it using apt-get,

(2) reconfiguration sysroot, (i.e., re-copy lib, usr / include, usr / lib and other folders to the corresponding directory sysroot),

(3) and then re-correction symbolic links (ie running again ./sysroot.py sysroot)

(4) back to the qt source root directory, then you can continue to make -j4 compiled

Compiled output:

After (7) is compiled, run make install

make install
(8) After completion of all, you can see what prefix generated at sysroot directory path, i.e.

Fourth, the development board rearrangement

(1) Copy the compiled results to the next development board / home / pi directory, my directory is

The results compiled in the following path: / home / msi / pi / sysroot / home / msi / arm / qt5101_64

Copy to Raspberry Pi at: / home / pi / qt5101_64

(2) development board qt library path configuration

Configuring Qt runtime environment, open the / etc / profile, in the last line of input about content:

export QTDIR = / home / pi / qt5101_64 / qt_sdk #qtsdk path on the system
export QT_QPA_FONTDIR = Q T D I R / l i b / f o n t s e x p o r t Q T Q P A P L A T F O R M P L U G I N P A T H = QTDIR/lib/fonts export QT_QPA_PLATFORM_PLUGIN_PATH= QTDIR/plugins/
export LD_LIBRARY_PATH= Q T D I R / l i b : QTDIR/lib: LD_LIBRARY_PATH
Export QT_QPA_PLATFORM = linuxfb: fb = / dev / fb0 #framebuffer drive
export QWS_MOUSE_PROTO = / dev / input /
if configured qml, qtquick to run the program, plus the following configuration (otherwise it will prompt QTQUICK module is not installed Reference may be made:

https://lemirep.wordpress.com/2013/06/01/deploying-qt-applications-on-linux-and-windows-3/):

export QML_IMPORT_PATH= Q T D I R / q m l e x p o r t Q M L 2 I M P O R T P A T H = QTDIR/qml export QML2_IMPORT_PATH= The QTDIR / QML
(. 3) refresh configuration

Source / etc / Profile
(4) Library file configuration

1) In /etc/ld.so.conf.d/ directory, create a qt5.conf

mkdir /etc/ld.so.conf.d/qt5.conf the sudo
2) was added qt_sdk path, i.e.

/ Home / PI / qt5101_64 / qt_sdk / lib /
3) Refresh

sudo ldconfig

Five test

Test Results:

Qt successfully compiled
the compiler will complain at some notebook prompted to find stdlib.h, there was not any program error
will be cross-compiled program copied to the development board
to check whether libraries are complete:
ldd filename
run the file directly. / filename running back can also add parameters -platform linuxfb or -platform eglfs, to run platform-specific
operating results: after the program opens, leaving only blur the program interface, the mouse sliding gone. . . The system might not support opengl?

Published 206 original articles · won praise 12 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_43248127/article/details/104077645