QT5.12 交叉编译到hisi3516平台

QT5.12 交叉编译到hisi平台

一、 hisi交叉编译环境安装

参考 安装交叉编译工具:arm-himix200-linux

简略摘要:

  • 下载后执行:
tar -zxvf arm-himix200-linux.tgz
cd arm-himix200-linux
sudo ./arm-himix200-linux.install

二、qt安装

1. qt 下载

2. qt安装

  • 安装环境:
    • Ubuntu 16.4 64位。
    • hisi交叉编译工具链路径: /opt/hisi-linux (上面安装arm-himix200-linux时默认的路径)
    • qt-everywhere-src-5.12.0 当前保存的位置 /opt
    • 期望安装的位置 /opt, 如截图

在这里插入图片描述

  • 安装步骤
    • 切换到su权限, 并将下载的qt文件拷贝到/opt目录

    •  tar xf qt-everywhere-src-5.12.0.tar  # 解压QT	
      
    •   cd  /opt/qt-everywhere-src-5.12.0 # 切换 目录到qt下, 准备安装 
      
    •  ./configure -prefix  /opt/arm-himix200_qt5.12.0  -release -opensource -confirm-license -static  -shared -platform linux-g++  -xplatform linux-arm-himix200-linux-g++  -qt-freetype -no-pch -no-avx -no-openssl -no-cups -no-dbus -no-opengl -no-glib  -no-xcb  -no-eglfs  -no-pkg-config -no-iconv -skip qtwebchannel -skip qtcanvas3d
      

      解释:

      • -prefix /opt/arm-himix200_qt5.12.0 值将交叉编译后的结果放到/opt/arm-himix200_qt5.12.0 目录
      • -static 生成静态库 即.so库, 如果需要在板子上运行, 则必须加入该参数
      • -platform linux-g++ -xplatform linux-arm-himix200-linux-g++ 只 本地采用 linux-g++ 编译, 交叉编译的工具链为linux-arm-himix200-linux-g++ 注: 如果xplatform 是自己制定的平台, 可能在.config时报错, 解决方法见最下方附录1:
        		ERROR: Invalid target platform 'linux-arm-himix200-linux-g++'.
        
      • 如果不想编译qt 的example 可以加入 -nomake examples 命令
    •  make -j8 # 漫长的编译, 可以根据自己的电脑选择不同的编译条数
      
    •   make install -j8
      
    • 注: 如果有编译错误, 直接修改源码进, 然后重新make (我在某次编译时出现过这个问题, 在写这篇blog的时候没有出现 所以没有列出具体的修改方法)

三、 移植到hisi3516板上

  • 前提条件,hisi板的各个环境已经初始化完成
  1. copy 编译出的demo到开发板上
    demo路径 opt/arm-himix200_qt5.12.0/examples/widgets/widgets/analogclock目录下的analogclock可执行文件
    2.拷贝各个so库到板子的/lib目录下, 路径:/opt/arm-himix200_qt5.12.0/lib简单起见, 也可在运行时提示缺什么库拷贝什么库

  2. 在板子上设置环境变量

    export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=600x1024:mmSize=600x1024:offset=0x0:tty=/dev/ttyAMA0
    export QT_QPA_FONTDIR=/lib/fonts        
    export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/platforms         
    export QT_DEBUG_PLUGINS=1 
    

    解释:
    QT_QPA_PLATFORM 指定平台的运行环境为linuxfb 分辨率为600x1024
    QT_QPA_FONTDIR 字库的位置, 改为板子实际的位置
    QT_QPA_PLATFORM_PLUGIN_PATH 指定PLUGIN_PATH的位置, 在当前环境下即linuxfb的位置。 如果板子上没有, 从/opt/arm-himix200_qt5.12.0/plugins/platforms目录下拷贝
    QT_DEBUG_PLUGINS开启debug调试模式, 用于启动时的调试, 调试完毕后删除该变量

  3. 在开发板上运行 ./analogclock提示

    ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11' failed.
    

    解决方法 指定环境变量为Llinuxfb一般在嵌入式板子上都是使用linuxfb的,说明第三步的环境变量有问题, 再检查下。

  4. demo运行成功

四、附录1 QT增加自己指定平台的编译方法

  1. cd到qtbase/mkspecs目录,找一个相似的工具链, cp一份并修改为指定的工具链
    •   	cd qtbase/mkspecs # cd到该目录
        	cp linux-arm-gnueabi-g++/ linux-arm-himix200-linux-g++ -r # 拷贝一份linux-arm-gnueabi-g++  
        	cd linux-arm-himix200-linux-g++ #  切换到新复制的目录并修改
      
    • 当前qmake.conf的内容为:在这里插入图片描述

    • 修改为
      在这里插入图片描述
      即重新指定交叉编译链

    • 完成 , 重新回到qt安装步骤继续安装

  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon) Target compiler: gcc 6.3.1 Configuration: cross_compile use_gold_linker 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 ...................... 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 ............................... yes 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 ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ 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 ........ no OpenSSL 1.1 ............................ no DTLS ................................... yes 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 ............... yes PNG .................................. yes Using system libpng ................ no EGL .................................... no OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ no OpenGL ES 3.0 ........................ no OpenGL ES 3.1 ........................ no OpenGL ES 3.2 ........................ no 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 EGL on X11 ........................... no QPA backends: DirectFB ............................... no EGLFS .................................. 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 ............................. no 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 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 .................................. no JPEG ................................. no harfbuzz ............................. no freetype ............................. no x11 .................................. no Required system libraries: fontconfig ........................... no dbus ................................. no nss .................................. no khr .................................. no glibc ................................ yes Required system libraries for qpa-xcb: libdrm ............................... no xcomposite ........................... no xcursor .............................. no xi ................................... no xrandr ............................... no xtst ................................. no Note: Also available for Linux: linux-clang linux-icc

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值