小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Qt移植:Ubuntu16.04 交叉編譯qt5.9.6詳細(xì)教程

 XeonGate 2019-05-30

https://blog.csdn.net/christine14122/article/details/83621585

          博主是嵌入式小萌新,項目需要移植qt到arm開發(fā)板上,歷經(jīng)千辛萬苦解決了各種問題,最后終于成功了,所以整理了開發(fā)筆記給更多的小伙伴參考。

1.準(zhǔn)備階段

①下載交叉編譯器aarch65-linux-gnu,下載地址為:https://releases./components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/

②下載Qt5.9.6源碼,下載地址為:http://download./archive/qt/5.9/5.9.6/single/

③下載Qtcreator安裝包,下載地址為:http://download./archive/qt/5.9/5.9.6/

④安裝虛擬機VMware? Workstation 14 Pro和Ubuntu16.04.5 LTS,博主的虛擬機版本如下圖:

⑤將文件分別存放在相應(yīng)文件夾下并解壓:

****.tar.gz 文件的解壓命令是 :tar -zxvf ****.tar.gz

****.tar.xz 文件的解壓命令是 :tar xvJf ****.tar.xz

第一步的準(zhǔn)備工作已完成。


2. 安裝交叉編譯器:

交叉編譯器解壓之后的路徑為:/home/admin/Qt_Env/Cross-compiler/

①查看當(dāng)前環(huán)境變量命令:echo $PATH

②在/etc/profile中添加新的環(huán)境變量:

  • 執(zhí)行命令:gedit /etc/profile

  • 在文件末尾添加:export PATH=$PATH:/home/admin/Qt_Env/Cross-compiler/aarch64-linux-gnu/bin

  • 執(zhí)行命令:source /etc/profile

③再次執(zhí)行echo $PATH

 

可以看到環(huán)境變量已經(jīng)添加上了。

④驗證編譯器是否安裝成功

  • 執(zhí)行命令:aarch64-linux-gnu-g++ -v

終端顯示編譯器信息如下:

編譯器安裝成功。

注意:在/etc/profile中改變的環(huán)境變量是臨時的,重啟虛擬機或重啟終端會導(dǎo)致環(huán)境變量修改不生效,所以在編譯qt之前一定要確定交叉編譯器安裝成功,如果執(zhí)行④打印的是gcc的版本信息,那么可能是編譯器路徑不對,或者多執(zhí)行幾次source /etc/profile即可。


3.交叉編譯qt5.9.6

①配置qt的configure

在目錄/home/Qt_Env/Qt_opensource下創(chuàng)建 qt_compiler_conf.sh文件,文件是configure的配置項,關(guān)于配置項的說明資料很多,在此不在贅述。

  1. #!/bin/sh
  2. ./configure -prefix /opt/aarch64/qt596_64/qt_sdk \
  3. -opensource \
  4. -debug \
  5. -confirm-license \
  6. -xplatform linux-arm-gnueabi-g++ \
  7. -no-opengl \
  8. -no-pch \
  9. -shared \
  10. -no-iconv \
  11. -no-xcb \

②修改qmake文件

安裝目錄打開:/home/hytera/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtbase/mkspecs/linux-arm-gnueabi-g++,打開qmake.conf文件,修改編譯器:

  1. #
  2. # qmake configuration for building with arm-linux-gnueabi-g++
  3. #
  4. MAKEFILE_GENERATOR = UNIX
  5. CONFIG += incremental
  6. QMAKE_INCREMENTAL_STYLE = sublib
  7. include(../common/linux.conf)
  8. include(../common/gcc-base-unix.conf)
  9. include(../common/g++-unix.conf)
  10. QT_QPA_DEFAULT_PLATFORM=linuxfb
  11. # modifications to g++.conf
  12. QMAKE_CC = aarch64-linux-gnu-gcc
  13. QMAKE_CXX = aarch64-linux-gnu-g++
  14. QMAKE_LINK = aarch64-linux-gnu-g++
  15. QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++
  16. # modifications to linux.conf
  17. QMAKE_AR = aarch64-linux-gnu-ar cqs
  18. QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
  19. QMAKE_NM = aarch64-linux-gnu-nm -P
  20. QMAKE_STRIP = aarch64-linux-gnu-strip
  21. load(qt_config)

注意:arm開發(fā)板上顯示屏的驅(qū)動是基于fb的話,記得在文件中添加QT_QPA_DEFAULT_PLATFORM=linuxfb。

③執(zhí)行qt_compiler_conf.sh配置文件

※ 在終端執(zhí)行命令:./qt_compiler_conf.sh 

※ 或者,博主將終端打印的日志重定向到了confLog.txt文件中,方便查看,故執(zhí)行的命令是:./qt_compiler_conf.sh  2>&1 | tee confLog.txt

※ 執(zhí)行結(jié)果為:

  1. + cd qtbase
  2. + /home/hytera/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtbase/configure -top-level -prefix /opt/aarch64/qt596_64/qt_sdk -opensource -debug -confirm-license -xplatform linux-arm-gnueabi-g++ -no-opengl -no-pch -shared -no-iconv -xcb
  3. Creating qmake...
  4. Done.
  5. This is the Qt Open Source Edition.
  6. You have already accepted the terms of the Open Source license.
  7. Running configuration tests...
  8. Done running configuration tests.
  9. Configure summary:
  10. Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
  11. Building for: linux-arm-gnueabi-g++ (arm64, CPU features: neon)
  12. Configuration: cross_compile compile_examples enable_new_dtags largefile neon optimize_debug shared rpath debug c++11 c++14 c++1z concurrent dbus no-pkg-config reduce_exports release_tools stl
  13. Build options:
  14. Mode ................................... debug; optimized tools
  15. Optimize debug build ................... yes
  16. Building shared libraries .............. yes
  17. Using C++ standard ..................... C++1z
  18. Using ccache ........................... no
  19. Using gold linker ...................... no
  20. Using new DTAGS ........................ yes
  21. Using precompiled headers .............. no
  22. Using LTCG ............................. no
  23. Target compiler supports:
  24. NEON ................................. yes
  25. Build parts ............................ libs examples
  26. Qt modules and options:
  27. Qt Concurrent .......................... yes
  28. Qt D-Bus ............................... yes
  29. Qt D-Bus directly linked to libdbus .... no
  30. Qt Gui ................................. yes
  31. Qt Network ............................. yes
  32. Qt Sql ................................. yes
  33. Qt Testlib ............................. yes
  34. Qt Widgets ............................. yes
  35. Qt Xml ................................. yes
  36. Support enabled for:
  37. Using pkg-config ....................... no
  38. QML debugging .......................... yes
  39. udev ................................... no
  40. Using system zlib ...................... no
  41. Qt Core:
  42. DoubleConversion ....................... yes
  43. Using system DoubleConversion ........ no
  44. GLib ................................... no
  45. iconv .................................. no
  46. ICU .................................... no
  47. Logging backends:
  48. journald ............................. no
  49. syslog ............................... no
  50. slog2 ................................ no
  51. Using system PCRE2 ..................... no
  52. Qt Network:
  53. getaddrinfo() .......................... yes
  54. getifaddrs() ........................... yes
  55. IPv6 ifname ............................ yes
  56. libproxy ............................... no
  57. OpenSSL ................................ no
  58. Qt directly linked to OpenSSL ........ no
  59. SCTP ................................... no
  60. Use system proxies ..................... yes
  61. Qt Gui:
  62. Accessibility .......................... yes
  63. FreeType ............................... yes
  64. Using system FreeType ................ no
  65. HarfBuzz ............................... yes
  66. Using system HarfBuzz ................ no
  67. Fontconfig ............................. no
  68. Image formats:
  69. GIF .................................. yes
  70. ICO .................................. yes
  71. JPEG ................................. yes
  72. Using system libjpeg ............... no
  73. PNG .................................. yes
  74. Using system libpng ................ no
  75. EGL .................................... no
  76. OpenVG ................................. no
  77. OpenGL:
  78. Desktop OpenGL ....................... no
  79. OpenGL ES 2.0 ........................ no
  80. OpenGL ES 3.0 ........................ no
  81. OpenGL ES 3.1 ........................ no
  82. Session Management ..................... yes
  83. Features used by QPA backends:
  84. evdev .................................. yes
  85. libinput ............................... no
  86. INTEGRITY HID .......................... no
  87. mtdev .................................. no
  88. tslib .................................. no
  89. xkbcommon-evdev ........................ no
  90. QPA backends:
  91. DirectFB ............................... no
  92. EGLFS .................................. no
  93. LinuxFB ................................ yes
  94. VNC .................................... yes
  95. Mir client ............................. no
  96. Qt Widgets:
  97. GTK+ ................................... no
  98. Styles ................................. Fusion Windows
  99. Qt PrintSupport:
  100. CUPS ................................... no
  101. Qt Sql:
  102. DB2 (IBM) .............................. no
  103. InterBase .............................. no
  104. MySql .................................. no
  105. OCI (Oracle) ........................... no
  106. ODBC ................................... no
  107. PostgreSQL ............................. no
  108. SQLite2 ................................ no
  109. SQLite ................................. yes
  110. Using system provided SQLite ......... no
  111. TDS (Sybase) ........................... no
  112. Qt SerialBus:
  113. Socket CAN ............................. yes
  114. Socket CAN FD .......................... yes
  115. QtXmlPatterns:
  116. XML schema support ..................... yes
  117. Qt QML:
  118. QML interpreter ........................ yes
  119. QML network support .................... yes
  120. Qt Quick:
  121. Direct3D 12 ............................ no
  122. AnimatedImage item ..................... yes
  123. Canvas item ............................ yes
  124. Support for Qt Quick Designer .......... yes
  125. Flipable item .......................... yes
  126. GridView item .......................... yes
  127. ListView item .......................... yes
  128. Path support ........................... yes
  129. PathView item .......................... yes
  130. Positioner items ....................... yes
  131. ShaderEffect item ...................... yes
  132. Sprite item ............................ yes
  133. Qt Gamepad:
  134. SDL2 ................................... no
  135. Qt 3D:
  136. Assimp ................................. yes
  137. System Assimp .......................... no
  138. Output Qt3D Job traces ................. no
  139. Output Qt3D GL traces .................. no
  140. Qt 3D GeometryLoaders:
  141. Autodesk FBX ........................... no
  142. Qt Wayland Client ........................ no
  143. Qt Wayland Compositor .................... no
  144. Qt Bluetooth:
  145. BlueZ .................................. no
  146. BlueZ Low Energy ....................... no
  147. Linux Crypto API ....................... no
  148. Qt Sensors:
  149. sensorfw ............................... no
  150. Qt Quick Controls 2:
  151. Styles ................................. Default Material Universal
  152. Qt Quick Templates 2:
  153. Hover support .......................... yes
  154. Multi-touch support .................... yes
  155. Qt Positioning:
  156. Gypsy GPS Daemon ....................... no
  157. WinRT Geolocation API .................. no
  158. Qt Location:
  159. Geoservice plugins:
  160. OpenStreetMap ........................ yes
  161. HERE ................................. yes
  162. Esri ................................. yes
  163. Mapbox ............................... yes
  164. MapboxGL ............................. no
  165. Itemsoverlay ......................... yes
  166. Qt Multimedia:
  167. ALSA ................................... no
  168. GStreamer 1.0 .......................... no
  169. GStreamer 0.10 ......................... no
  170. Video for Linux ........................ yes
  171. OpenAL ................................. no
  172. PulseAudio ............................. no
  173. Resource Policy (libresourceqt5) ....... no
  174. Windows Audio Services ................. no
  175. DirectShow ............................. no
  176. Windows Media Foundation ............... no
  177. Qt WebEngine:
  178. Embedded build ......................... yes
  179. Pepper Plugins ......................... no
  180. Printing and PDF ....................... no
  181. Proprietary Codecs ..................... no
  182. Spellchecker ........................... yes
  183. WebRTC ................................. no
  184. Using system ninja ..................... no
  185. ALSA ................................... no
  186. PulseAudio ............................. no
  187. System libraries:
  188. re2 .................................. no
  189. ICU .................................. no
  190. libwebp and libwebpdemux ............. no
  191. Opus ................................. no
  192. ffmpeg ............................... no
  193. Note: Also available for Linux: linux-clang linux-icc
  194. Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
  195. Qt is now configured for building. Just run 'make'.
  196. Once everything is built, you must run 'make install'.
  197. Qt will be installed into '/opt/aarch64/qt596_64/qt_sdk'.
  198. Prior to reconfiguration, make sure you remove any leftovers from
  199. the previous build.

④執(zhí)行make并重定向到makeLog.txt

命令為:make -j4 2>&1 | tee makeLog.txt

這個過程時間比較久,根據(jù)電腦性能,半個小時到六個小時不等。執(zhí)行完成后的makeLog.txt如下,可以打開makeLog.txt,檢索是否有error,如果沒有,那就順利編譯通過啦?。?!

  1. -----------------------------------------------------------------------------------------
  2. 前面省略26571行
  3. -----------------------------------------------------------------------------------------
  4. make[4]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtnetworkauth/examples/oauth/twittertimeline'
  5. make[3]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtnetworkauth/examples/oauth'
  6. make[2]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtnetworkauth/examples'
  7. make[1]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtnetworkauth'

⑤執(zhí)行make install安裝命令,并重定向到installLog.txt

命令為:make install 2>&1 | tee installLog.txt

installLog.txt的內(nèi)容如下,打開文件檢測是否有error。

  1. -------------------------------------------------------------------------------------------
  2. 前面省略13492行
  3. -------------------------------------------------------------------------------------------
  4. make[2]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qttranslations/translations'
  5. make[1]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qttranslations'
  6. cd qtdoc/ && ( test -e Makefile || /home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtbase/bin/qmake -o Makefile /home/hytera/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc/qtdoc.pro ) && make -f Makefile install
  7. make[1]: Entering directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc'
  8. cd doc/ && ( test -e Makefile || /home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtbase/bin/qmake -o Makefile /home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc/doc/doc.pro ) && make -f Makefile install
  9. make[2]: Entering directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc/doc'
  10. make[2]: Nothing to be done for 'install'.
  11. make[2]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc/doc'
  12. make[1]: Leaving directory '/home/admin/Qt_Env/Qt_opensource/qt-everywhere-opensource-src-5.9.6/qtdoc'

       完成這一步,qt編譯成功。


4. 將qt移植到arm開發(fā)板并運行example程序

   這一部分內(nèi)容較多,將在博主的另一篇博文中介紹。

 

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多