海思SDK版本:Hi3559AV100_SDK_V2.0.1.0
编译器版本:aarch64-himix100-linux-gcc 6.3.0(这个版本有点小问题,使用前需要先清除本地化设置)
$ export LANG=C
编译器默认安装到了/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目录下
然后安装QT依赖的第三方软件
包括 zlib、sqlite3、util-linux、openssl、nspr、nss、libpng、icu、freetype、fontconfig、expat、eudev、dbus
选最新的Release版源码下载即可
zlib sqlite3 util-linux libpng freetype fontconfig expat eudev dbus编译方法:
$ export LANG=C $ ./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr $ make -j8 # export LANG=C # source /etc/profile # make install
icu下载icu4c
在源码的同级目录建立icupc目录
$ export LANG=C $ mkdir icupc $ cd icupc $ ../icu/source/runConfigureICU Linux/gcc $ make $ cd ../icu/source $ ./configure --host=aarch64-himix100-linux --prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/usr --with-cross-build=/home/user/build/icupc
$ make -j8 # export LANG=C # source /etc/profile # make install
openssl:
$ ./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
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 $ make -j8
将conf目录复制一份,目录名为conf_x86_64
$ export LANG=C $ cp -r conf conf_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 $ cp config_x86_64/nsinstall.o config $ make -j8
# export LANG=C # source /etc/profile # make install
nss:
将补丁放在源码根目录下
$ patch -Np1 -i ./nss-3.44-standalone-1.patch $ cd nss $ make -j1 BUILD_OPT=1 NSPR_INCLUDE_DIR=/usr/include/nspr USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz NSS_ENABLE_WERROR=0 USE_64=1 NSS_USE_SYSTEM_SQLITE=1 $ make clean
$ export LANG=C
$ 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
至此,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删除。
配置和编译QT:
进入QT源码目录,进入qtbase/mkspecs目录,复制linux-aarch64-gnu-g++目录为linux-aarch64-himix100目录,进入linux-aarch64-himix100目录,打开qmake.conf文件,修改为以下内容
# # qmake configuration for building with aarch64-linux-gnu-g++ # #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)
在QT源码根目录下新建build_hisi.sh文件,内容为
#!/bin/bash ./configure -v \ -extprefix /home/user/soft/QT5.12_hisi \ -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
配置:
$ export LANG=C $ chmod a+x build_hisi.sh $ ./build_hisi.sh
无报错并且配置结果如下时即可编译安装
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 -j8 $ make install
命令前的$表示普通用户,#表示root用户,用sudo su可以切换到root用户下