QT5+OpenGL es2 + eglfs交叉編譯安裝(RK3399)

QT5+OpenGL es2 + eglfs交叉編譯安裝(RK3399)

最近由于項(xiàng)目的需要,需要在aarch64 Ubuntu16.04中安裝QT5,系統(tǒng)自帶了一個(gè)qt5,但項(xiàng)目要求必須是qt5.12的版本并且需要包含opengl和eglfs的庫(kù),所以只能重新對(duì)移植QT5.12,下面把移植過(guò)程記錄下。

下載QT5源碼
下載地址:https://download.qt.io/archive/qt/
找到自己需要的版本進(jìn)行下載。

圖中標(biāo)出來(lái)的就是源碼下載鏈接。隨便下載哪一個(gè)都行。下載后放入ubuntu(我用的Ubuntu 16.04)系統(tǒng)中進(jìn)行解壓。

解壓后進(jìn)入源碼路徑。創(chuàng)建一個(gè)autoconfig.sh。寫(xiě)入下面內(nèi)容

#!/bin/sh
./configure \
-sysroot /home/xxxx/project/target  \
-extprefix /opt/qt5.12.11-aarch64 \
-confirm-license \
-opensource \
-release \
-make libs \
-xplatform linux-aarch64-gnu-g++ \
-pch \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-no-sse2 \
-no-openssl \
-no-cups \
-no-glib \
-no-dbus \
-qt-xcb \
-no-separate-debug-info \
-opengl es2 \
-egl \
-eglfs \
-qpa eglfs \
-no-linuxfb \
-recheck-all

這里面有兩個(gè)參數(shù)需要注意下。
-sysroot 指定根文件系統(tǒng)位置。交叉編譯時(shí)指定目標(biāo)文件系統(tǒng)的掛載路徑。并且QT的交叉編譯過(guò)程會(huì)在這個(gè)參數(shù)指定文件系統(tǒng)下查找所依賴的庫(kù)和包含的頭文件。
-prefix 指定編譯完成后make install時(shí)的安裝位置,如果系統(tǒng)中指定了sysroot參數(shù),那么安裝位置為sysroot+prefix。利用默認(rèn)的安裝位置時(shí)可以不用指定prefix參數(shù)。
-extprefix 這個(gè)參數(shù)和prefix 的作用差不多,只不多extprefix 指定的安裝路徑位置不添加sysroot指定的路徑,例如:-extprefix /opt/qt5.12.11-aach64 那么make install后安裝位置為編譯主機(jī)的/opt/qt5.12.11-aach64目錄中。
注:make install的具體安裝位置可以在配置命令執(zhí)行完成的log中看到。

修改編譯工具鏈
修改文件:qtbase/mkspecs/linux-aarch64-gnu-g++/qmake.conf。這個(gè)需要根據(jù)自己目標(biāo)機(jī)器的cpu架構(gòu)進(jìn)行修改。我用的是arm64的cpu,所以是linux-aarch64-gnu-g++/qmake.conf這個(gè)文件。其實(shí)這里具體用那個(gè)文件下的qmake.conf是和配置中的-xplatform參數(shù)對(duì)應(yīng)的。

# 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
QMAKE_AR                = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = aarch64-linux-gnu-objcopy
QMAKE_NM                = aarch64-linux-gnu-nm -P
QMAKE_STRIP             = aarch64-linux-gnu-strip

這里可以修改成交叉編譯工具鏈的絕對(duì)路徑。

添加QT支持OpenGL es2和eglfs庫(kù)的路勁和頭文件。

#
# qmake configuration for building with aarch64-linux-gnu-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

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
QMAKE_AR                = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = aarch64-linux-gnu-objcopy
QMAKE_NM                = aarch64-linux-gnu-nm -P
QMAKE_STRIP             = aarch64-linux-gnu-strip


QMAKE_INCDIR_OPENGL_ES2 = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_OPENGL_ES2 = /usr/lib/aarch64-linux-gnu

QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_EGL        = /usr/lib/aarch64-linux-gnu


QMAKE_LIBS_EGL         += -lEGL -lGLESv2
QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL
load(qt_config)

確定文件系統(tǒng)中包含opengl的庫(kù)。可以在文件系統(tǒng)usr目錄下找一下libEGL.so libGLESv2.so這兩個(gè)庫(kù)

find .| grep "EGL"
find .| grep "GLESv2"

如果沒(méi)有找到相應(yīng)的庫(kù)??梢酝ㄟ^(guò)下面命令安裝。

sudo apt-get install libgles2-mesa
sudo apt-get install libgles2-mesa-dev

注意上面的命令都是在掛載的目標(biāo)機(jī)文件系統(tǒng)下操作。
安裝上面的庫(kù)時(shí)可以利用sudo chroot "掛載路徑"進(jìn)去后來(lái)為掛載的文件系統(tǒng)安裝程序。

執(zhí)行編譯
經(jīng)過(guò)上面的修改后執(zhí)行下面命令執(zhí)行配置和編譯

./autoconfig.sh
make
sudo make install 

如果配置過(guò)程中出錯(cuò),需要先刪除config.log和config.cache在重新執(zhí)行autoconfig.sh進(jìn)行配置。
配置階段無(wú)誤的話下面這幾項(xiàng)會(huì)被選擇

 openGL ES系列…………yes

EGL…………………………yes

EGLFS……………………yes

EGLFS Mali………………yes

QT部署
make install 編譯好的QT系統(tǒng)會(huì)被安裝到extprefix指定的目錄中。copy打包這個(gè)目錄并把它放在目標(biāo)主機(jī)中相同的目錄結(jié)構(gòu)下,建議用tar的方式壓縮,防止丟失符號(hào)鏈接。如果make install安裝的目錄需要管理員權(quán)限訪問(wèn)可以sudo make install。
配置環(huán)境變量
修改/etc/profile文件添加下面環(huán)境變量

export QTDIR=/opt/qt5.12.11-aarch64
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export QT_QPA_PLATFORM=eglfs

QT_QPA_PLATFORM這個(gè)環(huán)境變量可以不用指定,如果想用eglfs顯示可以在運(yùn)行QT程序的時(shí)候增加參數(shù)“-platform eglfs”。
如果想在sudo命令下正確的利用eglfs插件顯示還需要在 /etc/environment中添加如下兩行。
這里特別提一下export QT_DEBUG_PLUGINS=1這個(gè)環(huán)境變量,設(shè)置后會(huì)打印log。通過(guò)打印出來(lái)的log可以分析程序是在什么地方出錯(cuò)了,如果存在庫(kù)的依賴不存在也會(huì)在log中指出是哪個(gè)位置的少什么樣的庫(kù)。個(gè)人感覺(jué)挺非常有用。

LD_LIBRARY_PATH=/opt/qt5.12.11-aarch64/lib
QT_QPA_PLATFORM_PLUGIN_PATH=/opt/qt5.12.11-aarch64/plugins

移植過(guò)程錯(cuò)誤解決
(1)QMAKE_INCDIR_OPENGL[_ES2]配置錯(cuò)誤問(wèn)題

出現(xiàn)上面問(wèn)題的時(shí)候可以自己檢查一下qtbase/mkspecs/linux-aarch64-gnu-g++/qmake.conf中對(duì)opengl的哪幾項(xiàng)配置是不是有問(wèn)題,能不能找到libEGL.so libGLESv2.so庫(kù)和相關(guān)的頭文件。是在找不到問(wèn)題在哪可以試著執(zhí)行rm config.*將配置過(guò)程中的臨時(shí)文件刪除掉在執(zhí)行./autoconfig.sh試試。如果檢查好都沒(méi)啥問(wèn)題還是報(bào)這樣的錯(cuò)誤,不防備份autoconfig.sh和qmake.conf文件,然后把QT的源碼刪除了重新解壓一份在把a(bǔ)utoconfig.sh和qmake.conf放在各自的錄下,運(yùn)行autoconfig.sh在試試。
注意我的qmake.config中指定的QMAKE_INCDIR_OPENGL_ES2、QMAKE_LIBDIR_OPENGL_ES2、QMAKE_INCDIR_EGL、QMAKE_LIBDIR_EGL不在同一文件系統(tǒng)中,具體原因看"編譯生成的libqeglfs.so依賴庫(kù)位置錯(cuò)誤問(wèn)題"中的介紹。
(2)EGLFS Mali 不能被選中,提示下面錯(cuò)誤:

EGLFS Mali………………no

查找config.log會(huì)發(fā)現(xiàn)有提示fbdev_window *沒(méi)有定義錯(cuò)誤。網(wǎng)上查到兩種解決辦法
方案一、創(chuàng)建一個(gè)空的fbdev_window.h,結(jié)果報(bào)fbdev_window *沒(méi)有定義;
方案二、創(chuàng)建一個(gè)軟鏈接,將fbdev_window.h軟鏈接到egl.h,結(jié)果如方案一所示。ln -s egl.h fbdev_window.h
試了上面兩種方式都沒(méi)有用,從log中提示的錯(cuò)誤可以判斷是少一個(gè)fbdev_window的類型。而上面哪兩種方案其實(shí)都實(shí)際上沒(méi)有把這個(gè)數(shù)據(jù)類型定義,所以才會(huì)失敗。后來(lái)查找到下面的帖子,完美解決這個(gè)錯(cuò)誤。https://blog.csdn.net/lixiaojun216/article/details/121602501。這里非常感謝博主的分享。
創(chuàng)建fbdev_window.h文件存放到目標(biāo)文件系統(tǒng)的/usr/include/EGL目錄下,頭文件內(nèi)容如下

/*
 1. This confidential and proprietary software may be used only as
 2. authorised by a licensing agreement from ARM Limited
 3. (C) COPYRIGHT 2008-2011 ARM Limited
 4. ALL RIGHTS RESERVED
 5. The entire notice above must be reproduced on all authorised
 6. copies and copies may only be made to the extent permitted
 7. by a licensing agreement from ARM Limited.
 */
 
/**
 8. @file fbdev_window.h
 9. @brief A window type for the framebuffer device (used by egl and tests)
 */
 
#ifndef _FBDEV_WINDOW_H_
#define _FBDEV_WINDOW_H_
 
#ifdef __cplusplus
extern "C" {
#endif
 
typedef enum
{
    FBDEV_PIXMAP_DEFAULT = 0,
    FBDEV_PIXMAP_SUPPORTS_UMP = (1<<0),
    FBDEV_PIXMAP_ALPHA_FORMAT_PRE = (1<<1),
    FBDEV_PIXMAP_COLORSPACE_sRGB = (1<<2),
    FBDEV_PIXMAP_EGL_MEMORY = (1<<3)        /* EGL allocates/frees this memory */
} fbdev_pixmap_flags;
 
typedef struct fbdev_window
{
    unsigned short width;
    unsigned short height;
} fbdev_window;
 
typedef struct fbdev_pixmap
{
    unsigned int height;
    unsigned int width;
    unsigned int bytes_per_pixel;
    unsigned char buffer_size;
    unsigned char red_size;
    unsigned char green_size;
    unsigned char blue_size;
    unsigned char alpha_size;
    unsigned char luminance_size;
    fbdev_pixmap_flags flags;
    unsigned short *data;
    unsigned int format; /* extra format information in case rgbal is not enough, especially for YUV formats */
} fbdev_pixmap;
 
#ifdef __cplusplus
}
#endif
 
 
#endif

(3)編譯生成的libqeglfs.so依賴庫(kù)位置錯(cuò)誤問(wèn)題:
利用ldd命令查看/opt/qt5.12.11-aarch64/plugins/platforms/libqeglfs.so會(huì)發(fā)現(xiàn)這個(gè)庫(kù)所依賴libGLESv2.so的位置不對(duì),位置中包含了編譯主機(jī)的路徑,例如通過(guò)上面的方式編譯出來(lái)的libGLESv2.so位置指向了/home/xxxx/project/target/usr/lib/aarch64-linux-gnu目錄。libEGL.so也存在同樣的問(wèn)題。
方法一:在目標(biāo)文件系統(tǒng)中根據(jù)上面的要求在指定的目錄下創(chuàng)建響應(yīng)的符號(hào)鏈接,鏈接到庫(kù)的實(shí)際位置上去。但是對(duì)于強(qiáng)迫癥患者,這種方法有點(diǎn)要命。
方法二:這里就要提到QMAKE_INCDIR_OPENGL_ES2、QMAKE_LIBDIR_OPENGL_ES2、QMAKE_INCDIR_EGL、QMAKE_LIBDIR_EGL這幾個(gè)配置參數(shù)的妙用了。他們分別指定了編譯openGL時(shí)查找libGLESv2.so和libEGL.so庫(kù)的位置,以及頭文件的位置。這里我把這兩個(gè)庫(kù)cpoy到編譯主機(jī)的/usr/lib/aarch64-linux-gnu目錄下,然后根據(jù)目標(biāo)主機(jī)的符號(hào)鏈接方式創(chuàng)建響應(yīng)的符號(hào)鏈接。然后頭文件的位置還是采用目標(biāo)文件系統(tǒng)中的頭文件,所有才有了上面哪樣配置的情況。下面是我在編譯主機(jī)上創(chuàng)建的文件,文件來(lái)源都來(lái)自目標(biāo)主機(jī)的同一個(gè)目錄下,這個(gè)很重要必須目錄相同。不然又提示庫(kù)的連接位置不對(duì)。

你以為這樣就可以了嗎。實(shí)際上如果你不刪除sysroot 屬性指定的哪個(gè)文件系統(tǒng)中相同目錄下的庫(kù)文件,在編譯的時(shí)候一樣還是優(yōu)先找sysroot中指定文件系統(tǒng)的庫(kù)。
(4)eglfs插件無(wú)法顯示問(wèn)題。
本想利用上面的方法編譯已經(jīng)通過(guò)了,各種庫(kù)也能找到,程序也應(yīng)該可以運(yùn)行起來(lái)了吧,利用QT里面自帶的測(cè)試程序編譯個(gè)cube的程序測(cè)試一下。結(jié)果傻了提示一個(gè)0x3003的錯(cuò)誤,網(wǎng)上查了一下說(shuō)是什么顯示bpp不匹配的問(wèn)題,發(fā)現(xiàn)沒(méi)啥用,并且執(zhí)行echo 16 > /sys/class/graphics/fb0/bits_per_pixel后屏幕就黑屏了。因?yàn)閯傞_(kāi)始的時(shí)候我并沒(méi)有在配置中添加-no-linuxfb參數(shù),所以linuxfb應(yīng)該是可以顯示的,我就試了一下執(zhí)行程序的時(shí)候改成-platform linuxfb參數(shù),結(jié)果依然無(wú)法正常顯示提示如下:

xcb 相關(guān)問(wèn)題

后來(lái)用自己之前編譯的一個(gè)framebuffer的程序來(lái)試了一下在屏上顯示圖片,結(jié)果和這個(gè)錯(cuò)誤一樣。初步判斷這個(gè)可能和文件系統(tǒng)有關(guān)系,因?yàn)槲业哪繕?biāo)文件系統(tǒng)是ubuntu 16.04桌面用的是xubuntu。這種桌面一般用的都是x11的顯示方式,所以沒(méi)再糾結(jié)這個(gè)問(wèn)題。同時(shí)也在想上面那個(gè)eglfs無(wú)法顯示的問(wèn)題是不是也是不支持x11的顯示方式在造成的。并且我在網(wǎng)上還查找到有個(gè)xcb的插件用的就是x11的顯示方式。于是在QT的編譯配置中加入-qt-xcb的參數(shù),先確定程序能正常運(yùn)行起來(lái)。
本以為添加了-qt-xcb直接配置編譯就能通過(guò),結(jié)果配置過(guò)程中就提示各種錯(cuò)誤。有提示就好,根據(jù)提示各種網(wǎng)上搜索,并且config.log中也記錄了配置過(guò)程出錯(cuò)的log。后來(lái)總結(jié)了一下,其實(shí)這個(gè)過(guò)程中出錯(cuò)大多是因?yàn)槿鄙兕^文件和編譯依賴的庫(kù)所致,經(jīng)過(guò)一下修改后可以成功配置和編譯
目標(biāo)文件系統(tǒng)中安裝下面依賴庫(kù)

apt-get install libx11-dev libx11-xcb-dev
apt-get install libxkbcommon-dev libxkbcommon-x11-dev

因?yàn)槲疑厦鎾燧d的是一個(gè)完整的文件體統(tǒng),所以通chroot命令進(jìn)入文件系統(tǒng)后,只要網(wǎng)絡(luò)正常就可以直接通過(guò)命令安裝程序。
修改/usr/include/EGL/eglplatform.h文件,

struct gbm_device;
struct gbm_surface;

#if defined(__GBM__)
typedef struct gbm_device * EGLNativeDisplayType;
typedef struct gbm_surface * EGLNativeWindowType;
typedef void * EGLNativePixmapType;
#elif defined(__unix__)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#endif

typedef EGLNativeWindowType NativeWindowType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeDisplayType NativeDisplayType;

具體可以參考https://dev.t-firefly.com/thread-13087-1-9.html中的介紹。也謝謝博主奉獻(xiàn)。
通過(guò)上面的修改后重啟編譯部署QT并重新編譯一下cube應(yīng)用,放到目標(biāo)主機(jī)中運(yùn)行./cube -platform xcb,程序可以正常運(yùn)行,但是用-platform eglfs顯示還是依然存在文件。
繼續(xù)查看log信息,發(fā)現(xiàn)EGLFS X11 … no有這么一行,懷疑是不是就是因?yàn)檫@個(gè)沒(méi)有被選中才導(dǎo)致了顯示錯(cuò)誤。通過(guò)對(duì)config.log分析最后查找到安裝下面兩個(gè)庫(kù)可以解決此問(wèn)題。

apt-get install libxext-dev libxfixes-dev

下面是配置過(guò)程中控制臺(tái)輸出的信息,貼出來(lái)分享一下,如果又相同的移植過(guò)程可以對(duì)比一下輸出

+ cd qtbase
+ /home/lincor/project/qt-src/qtbase/configure -top-level -sysroot /home/lincor/project/target -extprefix /opt/qt5.12.11-aarch64 -confirm-license -opensource -release -make libs -xplatform linux-aarch64-gnu-g++ -pch -qt-libjpeg -qt-libpng -qt-zlib -no-sse2 -no-openssl -no-cups -no-glib -no-dbus -qt-xcb -no-separate-debug-info -opengl es2 -egl -eglfs -qpa eglfs -no-linuxfb -recheck-all
Creating qmake...
Done.

This is the Qt Open Source Edition.

You have already accepted the terms of the Open Source license.

Running configuration tests...
Checking for gold linker... yes
Checking for machine tuple... yes
Checking for valid makespec... yes
Checking for alloca() in alloca.h... yes
Checking for target architecture... arm64
Checking for host architecture... x86_64
Checking for C++14 support... yes
Checking for C++1z support... no
Checking for C99 support... yes
Checking for C11 support... yes
Checking for new dtags support... yes
Checking for pkg-config... yes
Checking for D-Bus >= 1.2 (host)... yes
Checking for udev... no
Checking for POSIX fallocate()... yes
Checking for precompiled header support... yes
Checking for RDRAND instruction... no
Checking for symbol visibility support... yes
Checking for -Bsymbolic-functions support... no
Checking for STL compatibility... yes
Checking for clock_gettime()... yes
Checking for POSIX monotonic clock... yes
Checking for C++11 <future>... yes
Checking for dlopen()... yes
Checking for eventfd... yes
Checking for futimens()... yes
Checking for getauxval()... yes
Checking for getentropy()... no
Checking for GNU libc... yes
Checking for POSIX iconv... yes
Checking for ICU... no
Checking for inotify... yes
Checking for SysV IPC... yes
Checking for linkat()... yes
Checking for ppoll()... yes
Checking for renameat2()... no
Checking for slog2... no
Checking for statx() in libc... no
Checking for 64 bit atomics... yes
Checking for DoubleConversion... no
Checking for PCRE2... no
Checking for O_CLOEXEC... yes
Checking for C++11 <random>... yes
Checking for working std::atomic for function pointers... yes
Checking for getifaddrs()... yes
Checking for IPv6 ifname... yes
Checking for Linux AF_NETLINK sockets... yes
Checking for xkbcommon >= 0.5.0... yes
Checking for XCB >= 1.9... yes
Checking for OpenGL ES 2.0... yes
Checking for KMS... no
Checking for EGL... yes
Checking for XLib... yes
Checking for EGL on X11... yes
Checking for EGLDevice... yes
Checking for GBM... yes
Checking for Mali EGL... yes
Checking for i.Mx6 EGL... no
Checking for XCB Xlib... yes
Checking for evdev... yes
Checking for FreeType... no
Checking for mtdev... no
Checking for OpenGL ES 3.0... yes
Checking for OpenGL ES 3.1... yes
Checking for OpenGL ES 3.2... yes
Checking for OpenVG... no
Checking for default QPA platform... eglfs
Checking for HarfBuzz... no
Checking for tslib... no
Checking for Vulkan... no
Checking for X11 prefix... /usr
Checking for X11 session management... no
Checking for xkbcommon-x11... yes
Checking for DB2 (IBM)... no
Checking for InterBase... no
Checking for MySQL... no
Checking for OCI (Oracle)... no
Checking for ODBC... no
Checking for PostgreSQL... no
Checking for SQLite (version 2)... no
Checking for TDS (Sybase)... no
Checking for Socket CAN... yes
Checking for Socket CAN FD... yes
Checking for jasper... no
Checking for mng... no
Checking for tiff... no
Checking for webp... no
Checking for Direct3D 12... no
Checking for SDL2... no
Checking for Assimp... no
Checking for Autodesk FBX... no
Checking for Wayland client library... no
Checking for Wayland EGL library... no
Checking for wayland-server... no
Checking for BlueZ... no
Checking for sensorfw... no
Checking for Gypsy... no
Checking for WinRT Geolocation API... no
Checking for ALSA... no
Checking for Vivante GPU... no
Checking for GStreamer 1.0... no
Checking for GStreamer 0.10... no
Checking for Video for Linux... yes
Checking for OpenAL... no
Checking for PulseAudio >= 0.9.10... no
Checking for libresourceqt5... no
Checking for libclang... no
Checking for alsa... no
Checking for embedded... yes
Checking for bison... yes
Checking for flex... yes
Checking for gperf... no
Checking for host pkg-config... /usr/bin/pkg-config
Checking for linker supports -z noexecstack... yes
Checking for x11... yes
Checking for libdrm... no
Checking for poppler-cpp... no
Checking for pulseaudio >= 0.9.10... no
Checking for python2... /usr/bin/python2
Checking for d-bus... no
Checking for fontconfig... no
Checking for glib-2.0 >= 2.32.0... no
Checking for glibc > 2.16... yes
Checking for jsoncpp... no
Checking for khr... yes
Checking for libevent... no
Checking for libvpx... no
Checking for libwebp, libwebpmux and libwebpdemux... no
Checking for libxml2 and libxslt... no
Checking for minizip... no
Checking for system ninja... no
Checking for nss >= 3.26... no
Checking for opus... no
Checking for protobuf... no
Checking for re2... no
Checking for snappy... no
Checking for xcomposite... no
Checking for xcursor... no
Checking for xi... no
Checking for xtst... no
Done running configuration tests.

Configure summary:

Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon)
Target compiler: gcc 5.4.0
Configuration: cross_compile use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent reduce_exports stl
Build options:
  Mode ................................... release
  Optimize release build for size ........ no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++14
  Using ccache ........................... no
  Using gold linker ...................... yes
  Using new DTAGS ........................ yes
  Using precompiled headers .............. yes
  Using LTCG ............................. no
  Target compiler supports:
    NEON ................................. yes
  Build parts ............................ libs
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... no
  Qt D-Bus directly linked to libdbus .... no
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... no
  Using system zlib ...................... no
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  iconv .................................. yes
  ICU .................................... no
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  Using system PCRE2 ..................... no
Qt Network:
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  Linux AF_NETLINK ....................... yes
  OpenSSL ................................ no
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ no
  DTLS ................................... no
  SCTP ................................... no
  Use system proxies ..................... yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ no
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. no
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... no
    PNG .................................. yes
      Using system libpng ................ no
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. yes
  X11 specific:
    XLib ................................. yes
    XCB Xlib ............................. yes
    EGL on X11 ........................... yes
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ no
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... yes
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ yes
  LinuxFB ................................ no
  VNC .................................... yes
  Mir client ............................. no
  XCB:
    Using system-provided XCB libraries .. no
    XCB XKB .............................. yes
    XCB XInput ........................... yes
    Native painting (experimental) ....... no
    GL integrations:
      GLX Plugin ......................... no
      EGL-X11 Plugin ..................... yes
Qt Sql:
  SQL item models ........................ yes
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... no
Qt Testlib:
  Tester for item models ................. yes
Qt SerialBus:
  Socket CAN ............................. yes
  Socket CAN FD .......................... yes
Further Image Formats:
  JasPer ................................. no
  MNG .................................... no
  TIFF ................................... yes
    Using system libtiff ................. no
  WEBP ................................... yes
    Using system libwebp ................. no
Qt QML:
  QML network support .................... yes
  QML debugging and profiling support .... yes
  QML sequence object .................... yes
  QML list model ......................... yes
  QML XML http request ................... yes
  QML Locale ............................. yes
  QML delegate model ..................... yes
Qt Quick:
  Direct3D 12 ............................ no
  AnimatedImage item ..................... yes
  Canvas item ............................ yes
  Support for Qt Quick Designer .......... yes
  Flipable item .......................... yes
  GridView item .......................... yes
  ListView item .......................... yes
  TableView item ......................... yes
  Path support ........................... yes
  PathView item .......................... yes
  Positioner items ....................... yes
  Repeater item .......................... yes
  ShaderEffect item ...................... yes
  Sprite item ............................ yes
Qt Scxml:
  ECMAScript data model for QtScxml ...... yes
Qt Gamepad:
  SDL2 ................................... no
Qt 3D:
  Assimp ................................. yes
  System Assimp .......................... no
  Output Qt3D Job traces ................. no
  Output Qt3D GL traces .................. no
  Use SSE2 instructions .................. no
  Use AVX2 instructions .................. no
  Aspects:
    Render aspect ........................ yes
    Input aspect ......................... yes
    Logic aspect ......................... yes
    Animation aspect ..................... yes
    Extras aspect ........................ yes
Qt 3D Renderers:
  OpenGL Renderer ........................ yes
Qt 3D GeometryLoaders:
  Autodesk FBX ........................... no
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Qt Bluetooth:
  BlueZ .................................. no
  BlueZ Low Energy ....................... no
  Linux Crypto API ....................... no
  WinRT Bluetooth API (desktop & UWP) .... no
Qt Sensors:
  sensorfw ............................... no
Qt Quick Controls 2:
  Styles ................................. Default Fusion Imagine Material Universal
Qt Quick Templates 2:
  Hover support .......................... yes
  Multi-touch support .................... yes
Qt Positioning:
  Gypsy GPS Daemon ....................... no
  WinRT Geolocation API .................. no
Qt Location:
  Qt.labs.location experimental QML plugin . yes
  Geoservice plugins:
    OpenStreetMap ........................ yes
    HERE ................................. yes
    Esri ................................. yes
    Mapbox ............................... yes
    MapboxGL ............................. yes
    Itemsoverlay ......................... yes
QtXmlPatterns:
  XML schema support ..................... yes
Qt Multimedia:
  ALSA ................................... no
  GStreamer 1.0 .......................... no
  GStreamer 0.10 ......................... no
  Video for Linux ........................ yes
  OpenAL ................................. no
  PulseAudio ............................. no
  Resource Policy (libresourceqt5) ....... no
  Windows Audio Services ................. no
  DirectShow ............................. no
  Windows Media Foundation ............... no
Qt Tools:
  QDoc ................................... no
Qt WebEngine:
  Embedded build ......................... yes
  Full debug information ................. no
  Pepper Plugins ......................... no
  Printing and PDF ....................... no
  Proprietary Codecs ..................... no
  Spellchecker ........................... yes
  Native Spellchecker .................... no
  WebRTC ................................. no
  Use System Ninja ....................... no
  Geolocation ............................ yes
  WebChannel support ..................... yes
  Use v8 snapshot ........................ yes
  Kerberos Authentication ................ no
  Support qpa-xcb ........................ no
  Building v8 snapshot supported ......... yes
  Use ALSA ............................... no
  Use PulseAudio ......................... no
  Optional system libraries used:
    re2 .................................. no
    icu .................................. no
    libwebp, libwebpmux and libwebpdemux . no
    opus ................................. no
    ffmpeg ............................... no
    libvpx ............................... no
    snappy ............................... no
    glib ................................. no
    zlib ................................. no
    minizip .............................. no
    libevent ............................. no
    jsoncpp .............................. no
    protobuf ............................. no
    libxml2 and libxslt .................. no
    lcms2 ................................ no
    png .................................. no
    JPEG ................................. no
    harfbuzz ............................. no
    freetype ............................. no
  Required system libraries:
    fontconfig ........................... no
    dbus ................................. no
    nss .................................. no
    khr .................................. yes
    glibc ................................ yes
  Required system libraries for qpa-xcb:
    x11 .................................. yes
    libdrm ............................... no
    xcomposite ........................... no
    xcursor .............................. no
    xi ................................... no
    xtst ................................. no

Note: Also available for Linux: linux-clang linux-icc

Note: PKG_CONFIG_LIBDIR automatically set to /home/lincor/project/target/usr/lib/pkgconfig:/home/lincor/project/target/usr/share/pkgconfig:/home/lincor/project/target/usr/lib/aarch64-linux-gnu/pkgconfig

Note: PKG_CONFIG_SYSROOT_DIR automatically set to /home/lincor/project/target

Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.

Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.

WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.

Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.

WARNING: gperf is required to build QtWebEngine.

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/opt/qt5.12.11-aarch64'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

經(jīng)過(guò)上面的移植后eglfs插件可以正常運(yùn)行,并且GPU功能也正常
展示一下顯示效果:

結(jié)束語(yǔ):
經(jīng)歷了3周多時(shí)間,終于是搞定了QT的移植,整個(gè)過(guò)程中踩了不少的坑,這里記錄下來(lái)一是為了后面再遇到此類問(wèn)題能有個(gè)參考,二也是分享一下自己經(jīng)驗(yàn),希望后來(lái)人在移植過(guò)程中少踩點(diǎn)坑。
能讀到這里朋友,謝謝你對(duì)這片文章的支持。另外文章中大部分內(nèi)容為手敲,錯(cuò)別字比較多,還望諒解。

QT5+OpenGL es2 + eglfs交叉編譯安裝(續(xù))

eglplatform.h和fbdev_window.h下載下載:
https://download.csdn.net/download/xuesong10210/76481431
交叉編譯產(chǎn)物下載地址:
https://download.csdn.net/download/xuesong10210/76495076

參考:
https://blog.csdn.net/pengjiaqi1028/article/details/111476742
https://blog.csdn.net/lixiaojun216/article/details/121602501
https://blog.csdn.net/yuangc/article/details/118021354
https://blog.csdn.net/dieju8330/article/details/86743919
https://dev.t-firefly.com/thread-13087-1-9.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容