Ubuntu20.04.1(X86_64)Qt5.14.2配置ARM64交叉编译环境

本文详细介绍了如何在Ubuntu20.04.1(X86_64)上配置用于ARM64平台的Qt5.14.2交叉编译环境。步骤包括下载Qt源码和交叉编译器,安装ARM64编译器,编译Qt源码以及在Qt中配置交叉编译环境。通过这个过程,可以在X86_64系统上编译出适用于ARM64平台的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu20.04.1X86_64Qt5.14.2配置ARM64交叉编译环境

 

已有环境:

PC Linux Ubuntu20.04.1 64位 X86架构

Qt 版本号5.14.2

交叉编译器:gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu

 

概述:由于习惯性偷懒,所以不论做什么,都喜欢找现成的工具做开发,最近需要开发Ubuntu系统的软件,所以选择Qt,做个简单的界面,但是在交叉编译环节却困难重重,网上的介绍有很多,但是简单有效的方案不多,因此写下这个文档记录一下。

 

需求:

在ARM64平台的Ubuntu18.0.*系统中(Xavier),内置硬件测试程序(HW_CIT),主要功能为自动测试各种硬件是否正常。

 

工具:Qt 源码 地址:http://download.qt.io/archive/qt/

Qt Ubuntu 版本安装包 地址:http://download.qt.io/archive/qt/

ARM64交叉编译工具 (由于之前编译RK3399,所以配置了gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu编译器,网上应该还有很多其他版本)

(可以直接网上搜,或者去官网下载,方法非常多!!!)

 

 

步骤:

 

1.下载Qt 源码

根据上述的地址,选取自己适用的版本下载即可,我用的是5.14.2,需要注意自己的已有环境,本人PC是Linux系统,我第一次却下载的qt-everywhere-src-5.14.2.zip,解压后,有很多识别不了的符号,编译总是出错,所以应该选择下载

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
<think>好的,用户需要下载适用于Ubuntu 22.04 x86_64架构的仿真或模拟工具。首先,我需要确定哪些工具在Ubuntu 22.04的官方仓库中可用,并且支持x86_64架构。根据引用[1],Ubuntu 20.04已经提供了较高本的QEMU,可以通过命令行直接安装。对于Ubuntu 22.04,应该也是类似的步骤,可能本更高。因此,QEMU应该是首选推荐的工具之一。 接下来,用户提到的仿真或模拟工具可能包括虚拟化工具、系统模拟器或者硬件模拟器等。QEMU是一个功能强大的开源机器模拟器和虚拟化工具,支持多种架构,包括x86_64。安装QEMU的命令应该是`sudo apt install qemu-system-x86 qemu-utils`,这样可以安装系统模拟和工具集。 除了QEMU,另一个常见的工具是VirtualBox,它提供图形界面,适合桌面用户。不过VirtualBox可能需要添加Oracle的仓库,或者通过官方的deb包安装。因此,建议用户从官网下载最新的deb包,然后使用`sudo apt install ./virtualbox-*.deb`来安装,同时需要安装对应的扩展包。 另外,用户可能也需要其他辅助工具,比如KVM加速,这可以提升虚拟机的性能。检查是否支持KVM的命令是`kvm-ok`,以及安装相关组件的命令`sudo apt install virt-manager libvirt-daemon-system`。这些工具组合使用可以搭建完整的虚拟化环境。 关于编译环境的工具,像GCC交叉编译工具链可能在需要编译不同架构的程序时有用,比如安装gcc-aarch64-linux-gnu用于ARM64架构的交叉编译。这可能也是用户需求的一部分,尤其是如果用户需要进行跨架构的仿真测试。 在安装完成后,验证安装是否正确是重要的步骤。例如,运行`qemu-system-x86_64 --version`检查QEMU本,或者启动VirtualBox查看是否能创建虚拟机。此外,引用[3]中提到的库文件大小问题可能提醒用户注意磁盘空间,特别是在安装多个工具时,需要确保有足够的存储空间。 用户可能还会有其他相关需求,比如如何配置网络或共享文件夹,这时候可以建议他们查阅具体工具的文档或社区资源。同时,引用[2]提到的Python本切换可能在某些工具依赖特定Python本时有用,但仿真工具本身可能不直接相关,不过了解这一点有助于用户解决潜在的依赖问题。 总结来说,需要分步骤推荐QEMU、VirtualBox、KVM及相关工具,给出具体的安装命令,并提醒可能的依赖和验证步骤。同时,生成相关问题帮助用户进一步解决可能遇到的配置或使用问题。</think>### 下载Ubuntu 22.04 x86_64仿真/模拟工具指南 #### 1. QEMU(全系统模拟器) QEMU是开源的硬件虚拟化工具,支持跨架构系统仿真(如运行ARM系统镜像)和硬件加速虚拟化。 **安装命令**: ```bash sudo apt update s
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值