Hi3559编译QT(带webingine_opengl)

1 篇文章 0 订阅
1 篇文章 0 订阅

/********************************************************************************

** date: 2020.10.10

** desc: 海思平台编译QT(带webingine和opengl)文档说明

*********************************************************************************/

在此分享出来是为了避免大家少走弯路

 

海思SDK版本:Hi3559A V100R001C02SPC020

编译器:aarch64-himix100-linux-gcc 6.3.0
QT源码  qt-everywhere-src-5.13.2.tar.xz

 

准备工作

编译器默认安装到了/opt/hisi-linux/x86-arm/aarch64-himix100-linu目录下。

首先,对编译器做一点小改动。

将/opt/hisi-linux/x86-arm/aarch64-himix100-linux/target/usr链接到/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr下

# cd /opt/hisi-linux/x86-arm/aarch64-himix100-linux
# ln -s ./target/usr usr

 将/opt/hisi-linux/x86-arm/aarch64-himix100-linux/aarch64-linux-gnu链接到/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib/aarch64-linux-gnu下

# cd usr/lib
# ln -s /opt/hisi-linux/x86-arm/aarch64-himix100-linux/aarch64-linux-gnu aarch64-linux-gnu

将海思SDK里mpp/component/gpu/release目录下的include目录和lib目录拷贝到opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr目录下

-----------------------------------------------------------------------------
1.安装依赖库
执行:apt-get install gettext gperf bison flex(后面三个没装编译QT的时候会告警说编译webengine模块需要它们)

我没装这几个编译完是可以通过,但是自带demon那个minibrowser根本不能点击不知道是不是这个问题,我现在也在尝试,如果解决了我就不再更新了哈
-----------------------------------------------------------------------------
2.编译第三方依赖库
udev编译(udev-167.tar.bz2)
udev在SDK里osdrv/tools/board/udev-167目录下,用 config.sub替换config.sub文件

可以在https://download.csdn.net/download/o619660156/12919966下载
./configure  --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --disable-extras --disable-introspection --with-pic --with-systemdsystemunitdir=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/share --build=x86_64-pc-linux-gnu --host=aarch64-himix100-linux --target=aarch64-linux-gnu CFLAGS='-w -mcpu=cortex-a73.cortex-a53' LDFLAGS='-w -mcpu=cortex-a73.cortex-a53'
-----------------------------------------------------------------------------
zlib编译(zlib-1.2.11.tar.gz)
export CC=aarch64-himix100-linux-gcc
./configure --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr
-----------------------------------------------------------------------------
sqlite3编译(sqlite-autoconf-3330000.tar.gz)
./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr
-----------------------------------------------------------------------------
util-linux编译(util-linux-2.33.2.tar.gz)
./configure --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --host=aarch64-himix100-linux CC=aarch64-himix100-linux-gcc CXX=aarch64-himix100-linux-g++ --without-python --without-tinfo --without-ncursesw --without-ncurses
-----------------------------------------------------------------------------
libpng编译(libpng-1.6.37.tar.gz)
./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr

libpng编译(libpng-1.2.59.tar.gz)交叉编译freetype会用到
./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr
-----------------------------------------------------------------------------
fontconfig 编译
交叉编译freetype(freetype-2.10.2.tar.xz)
./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr

交叉编译libxml2:(libxml2-2.9.10.tar.gz)
./configure --host=arm-linux --target=arm-linux CC=aarch64-himix100-linux-gcc AR=aarch64-himix100-linux-ar LD=aarch64-himix100-linux-ld  --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --without-lzma  --without-python

fontconfig(fontconfig-2.13.1.tar.bz2)
./configure CC=aarch64-himix100-linux-gcc --disable-docs --host=arm-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --enable-libxml2
-----------------------------------------------------------------------------
expat-2.2.9编译(expat-2.2.9.tar.bz2)
./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr


dbus编译(dbus-1.10.26.tar.gz)
./configure --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --host=aarch64-himix100-linux CC=aarch64-himix100-linux-gcc CXX=aarch64-himix100-linux-g++ --enable-shared --enable-static CFLAGS=-I/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/ LDFLAGS=-L/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib --disable-tests(OK)

./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr
-----------------------------------------------------------------------------
openssl编译(openssl-1.1.1h.tar.gz)
./config no-asm shared --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --openssldir=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr
编辑Makefile,修改CROSS_COMPILE= aarch64-himix100-linux-,删除两处 -m64
查看CC和CXX对不对
-----------------------------------------------------------------------------
icu交叉编译
下载icu4c
在源码的同级目录建立icupc目录
$ mkdir icupc
$ cd icupc
$ ../source/runConfigureICU Linux/gcc
$ make
$ cd ../source
$ ./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --with-cross-build=/home/QTBuild/Third/icu/icupc
make
-------------------------------------------------------------------------------
nspr交叉编译:
$ sed -ri 's#^(RELEASE_BINS =).*#\1#' pr/src/misc/Makefile.in
$ sed -i 's#$(LIBRARY) ##' config/rules.mk
$ ./configure --prefix=/usr --with-mozilla --with-pthreads --enable-64bit CC=gcc
$ make -j8

将config目录复制一份,目录名为conf_x86_64
$ cp -r config config_x86_64
$ make clean
$ ./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --with-pthreads --enable-64bit
$ cp config_x86_64/nsinstall config
$ make -j8
# source /etc/profile
# make install

-------------------------------------------------------------------------------
nss:
将补丁放在源码根目录下

$ patch -Np1 -i ./nss-3.57-standalone-1.patch
$ cd nss
$ make -j1 BUILD_OPT=1 CC=gcc CCC=g++ NSPR_INCLUDE_DIR=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nspr USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz NSS_ENABLE_WERROR=0 USE_64=1 NSS_USE_SYSTEM_SQLITE=1
$ make clean
$

make -j1 \
  CC=aarch64-himix100-linux-gcc \
  CCC=aarch64-himix100-linux-g++ \
  BUILD_OPT=1 \
  NSPR_INCLUDE_DIR=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nspr \
  NSS_USE_SYSTEM_SQLITE=1 \
  NSS_ENABLE_WERROR=0 \
  USE_SYSTEM_ZLIB=1 \
  USE_STATIC_RTL=1 \
  OS_TEST=aarch64 USE_64=1(OK)
 
$ make -j1 BUILD_OPT=1 NSPR_INCLUDE_DIR=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nspr USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz NSS_ENABLE_WERROR=0 NSS_USE_SYSTEM_SQLITE=1 CC=aarch64-himix100-linux-gcc CCC=aarch64-himix100-linux-g++ RANLIB=aarch64-himix100-linux-ranlib OS_TEST=aarch64 USE_64=1

报错后将coreconf/nsinstall/Linux5.0_x86_64_cc_glibc_PTH_64_OPT.OBJ目录下的三个文件拷贝到coreconf/nsinstall/Linux5.0_aarch64_aarch64-himix100-linux-gcc_glibc_PTH_64_OPT.OBJ目录下进行替换(目录名和Linux内核版本号有关),然后继续执行上面的make命令
第二次报错后将cmd/shlibsign/Linux5.0_x86_64_cc_glibc_PTH_64_OPT.OBJ目录下的两个文件拷贝到cmd/shlibsign/Linux5.0_aarch64_aarch64-himix100-linux-gcc_glibc_PTH_64_OPT.OBJ目录下进行替换(目录名和Linux内核版本号有关),然后继续执行上面的make命令


 
安装:

$ cd ../dist/Linux5.0_aarch64_aarch64-himix100-linux-gcc_glibc_PTH_64_OPT.OBJ
# install -v -m755 lib/*.so              /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib
# install -v -m644 lib/{*.chk,libcrmf.a} /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib
# install -v -m755 -d                    /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nss
# cp -v -RL ../{public,private}/nss/*    /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nss
# chmod -v 644                           /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/nss/*
# install -v -m755 bin/{certutil,nss-config,pk12util} /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/bin
# install -v -m644 lib/pkgconfig/nss.pc  /opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib/pkgconfig
这中间会有报错不管它

 

同样进入x86的在进行安装

安装到/usr/目录下。自己对下目录

------------------------------------------------------------------------------
**这里需要再进入libpng16的目录里面重新进行一遍make install否则qt编译会认不到.
-------------------------------------------------------------------------------
打开/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib/pkgconfig和/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/share/pkgconfig目录下所有的.pc文件,将路径里面的所有的/opt/hisi-linux/x86-arm/aarch64-himix100-linux删除
-------------------------------------------------------------------------------
编译
进入 qtbase/mkspaces
修改 linux-aarch64-gnu-g++/

修改qmke.conf为
#MACRO := -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \
#         -DEGL_FBDEV -DEGL_API_FBDEV -DEGL_API_MIDGARD -DPLATFORM_MALI700

MAKEFILE_GENERATOR      = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

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

QMAKE_LIBS_EGL += -lmali
QMAKE_LIBS_OPENGL_ES2 += -lmali
DEFINES += EGL_EGLEXT_PROTOTYPES GL_GLEXT_PROTOTYPES EGL_FBDEV EGL_API_FBDEV EGL_API_MIDGARD PLATFORM_MALI700

# modifications to g++.conf
QMAKE_CC = aarch64-himix100-linux-gcc
QMAKE_CXX = aarch64-himix100-linux-g++
QMAKE_LINK = aarch64-himix100-linux-g++
QMAKE_LINK_SHLIB = aarch64-himix100-linux-g++

# modifications to linux.conf
QMAKE_AR = aarch64-himix100-linux-ar cqs
QMAKE_OBJCOPY = aarch64-himix100-linux-objcopy
QMAKE_NM = aarch64-himix100-linux-nm -P
QMAKE_STRIP = aarch64-himix100-linux-strip
load(qt_config)

开始编译

export PKG_CONFIG_PATH=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib/pkgconfig:$PKG_CONFIG_PATH


./configure -v -extprefix  /opt/qt5.12.9_hi3559av100 -recheck-all -opensource -confirm-license -release -shared -xplatform linux-aarch64-himix100 -sysroot /opt/hisi-linux/x86-arm/aarch64-himix100-linux/target -no-gcc-sysroot -pkg-config -nomake examples -nomake tests -make libs -fontconfig -system-freetype -openssl-linked -L/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/lib/ -I/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr/include/

最后就是漫长的make时间了。。。大概几个小时吧

好了之后还需要编译GPU的ko这个

 

Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: linux-aarch64-himix100 (arm64, CPU features: neon)
Target compiler: gcc 6.3.0
Configuration: cross_compile compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus 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 ...................... no
  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 ............................... yes
  Qt D-Bus directly linked to libdbus .... yes
  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 ................................... yes
  Using system zlib ...................... yes
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  iconv .................................. no
  ICU .................................... yes
  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 ................................ yes
    Qt directly linked to OpenSSL ........ yes
  OpenSSL 1.1 ............................ yes
  DTLS ................................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... no
    PNG .................................. yes
      Using system libpng ................ yes
  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 .............................. no
  X11 specific:
    XLib ................................. no
    XCB Xlib ............................. no
    EGL on X11 ........................... no
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 ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ yes
  VNC .................................... yes
  Mir client ............................. no
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
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 ................................... yes
Qt WebEngine:
  Embedded build ......................... yes
  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
  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 ................................. yes
    minizip .............................. no
    libevent ............................. no
    jsoncpp .............................. no
    protobuf ............................. no
    libxml2 and libxslt .................. no
    lcms2 ................................ no
    png .................................. yes
    JPEG ................................. no
    harfbuzz ............................. no
    freetype ............................. yes
    x11 .................................. no
  Required system libraries:
    fontconfig ........................... yes
    dbus ................................. yes
    nss .................................. yes
    khr .................................. yes
    glibc ................................ yes
  Required system libraries for qpa-xcb:
    libdrm ............................... no
    xcomposite ........................... no
    xcursor .............................. no
    xi ................................... no
    xtst ................................. no

自己一个个对,走过很多就是这个的坑,某个配置项不支持得重新make install 然后/opt/hisi-linux/x86-arm/aarch64-himix100-linux删除

可以参考这个https://blog.csdn.net/xclshwd/article/details/90721080

反正我是没那么简单还需要下源码打补丁,不过最后都一一解决就是了。QT运行起来之前GPU ko要先加载起来否则无法正常工作

qt源码编译到最后发现-std=c++14不支持,查了一遍发现PC端编译器gcc,g++版本太低导致,安装个gcc6以上版本就可以了

 

config.zip

https://blog.csdn.net/heliangbin87/article/details/82499522
https://blog.csdn.net/weixin_30781107/article/details/97452727
https://copyfuture.com/blogs-details/20190608195350084gzabbsv48l4opjq

https://blog.csdn.net/haysonzeng/article/details/106211275

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值