C++/QT/ARM 处理器交叉编译/编程 [英] C++/QT/ARM Processors Cross-compiling/Programming

查看:32
本文介绍了C++/QT/ARM 处理器交叉编译/编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的所有 {C++|QT|ARM 处理器}开发人员

dear all {C++|QT|ARM Processors} developers

你好

最近,我参与了一个 QT/ARM 处理器软件开发项目.项目的一般组成部分是:

Recently, I'm involved in a QT/ARM Processor software development project. The general components of the project is:

Processor: Mini440 FriendlyARM (400 MHz Samsung S3C2440 ARM926T), 
    www.friendlyarm.net
    www.arm9.net
OS: Linux (Kernel version 2.6.32)
Programming Language: C++ (GCC/g++)
GUI Framework: QT

该项目的主要目的是为嵌入式手持设备,使用 QT/Embedded Linux.

The main purpose of the project is to develop a GUI for the embedded handheld device, using QT/Embedded Linux.

主机(开发机)上命令uname -a的输出为:

The output of command uname -a on host computer (development machine) is:

$ uname -a

Linux Scorpion 3.5.0-39-generic #60~precise1-Ubuntu SMP Wed Aug 14 15:38:41 UTC 2013x86_64 x86_64 x86_64 GNU/Linux

Linux scorpion 3.5.0-39-generic #60~precise1-Ubuntu SMP Wed Aug 14 15:38:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

命令 uname -a 在基于 ARM 的嵌入式设备上的输出为:

The output of command uname -a on embedded ARM-based device is:

Liunx FriendlyARM 2.6.32-FriendlyARM #5 Wed Jun 6 15:50:50HKT 2012 armv4tl 未知.

Liunx FriendlyARM 2.6.32-FriendlyARM #5 Wed Jun 6 15:50:50 HKT 2012 armv4tl unknown.

我的第一个问题是:

问.主机和目标计算机具有相同的体系结构是否重要,我的意思是两者都应该是 32 位(x86 或 i586/i686)还是都应该是 64 位(x86_64)?

Q. Is it important to host and target computers have the same architecture, I mean both should be 32-bits (x86 or i586/i686) or both should be 64-bits (x86_64)?

我做了以下步骤:

  1. 我使用基于 QT Designer (5.0.2) 的 QT Creator (2.7.0) 编写了一个简单的 GUI在桌面 Linux 机器(主机)上

  1. I wrote a simple GUI using QT Creator (2.7.0) based on QT Designer (5.0.2) on a desktop Linux machine (host computer)

基于知识,我在最近两个月从书籍和互联网上获得了有关交叉编译、工具链和其他许多相关概念的知识,我发现我必须安装 Trolltech 的另一个名为 Qtopia 的软件,QT 的嵌入式版本.我尝试安装名为 qtopia-core-opensource-src-4.3.5 的最新版 Qtopia在这一点上,我在配置、构建和制作方面遇到了很多问题软件.一个问题是主机上的 g++ 是 4.8.1(非常新),但是 Qtopia是大约 7 年前.当我尝试从源代码构建 Qtopia 时g++ 编译器会发出几个 C++ 错误,例如:

Based on knowledge, I gained in last two months from books and Intenet about Cross-compiling, and Tool-chain and other many many related concepts, I found I have to install another software from Trolltech called Qtopia, the Embedded version of QT. I tries to install the latest version of Qtopia called qtopia-core-opensource-src-4.3.5 at this point I had a lot of problems at configuration, building and making the software. One problem is g++ on host is 4.8.1 (very new), but the Qtopia is for about 7 years ago. When I tries to build the Qtopia from source the g++ compiler issues several C++ errors, for example:

错误:'ptrdiff_t' 没有命名类型错误:在此范围内未声明附加",并且未找到任何声明通过参数依赖查找

error: 'ptrdiff_t' does not name a type error: 'append' was not declared in this scope, and no declaration, where found by argument-dependent lookup

当然,我解决了这些问题,但是很明显 g++ 会发出这些错误因为Qtopia是用C++98写的,而g++4.8.1是基于C++11我的问题是:

Of course, I solved these problems, but it's obvious g++ issues these errors because Qtopia was written using C++98, but g++ 4.8.1 is based on C++11 my questions are:

问.Qtopia 使用哪个版本的 GCC 重要吗?另一件事是应该使用哪个版本的QT/Embedded?

Q. Is it important to use which version of GCC with Qtopia? another thing is which version of QT/Embedded should be used?

问.我是否必须使用旧版本的 QT/Embedded,如 Qtopia 或我可以使用较新的版本,例如 qt-everywhere-opensource-src-4.8.4?

Q. Do I have to use the old versions of QT/Embedded like Qtopia or I can use the newer versions like qt-everywhere-opensource-src-4.8.4?

另一个问题是关于内核版本:它重要吗问:主机和目标计算机具有相同的内核编号 (x.y.z) 是否重要?

another problem is about kernel version: is it important Q. Is it important to host and target computers have the same kernel number (x.y.z)?

如你所见,我在交叉编译和移植书面软件的细节方面迷失了方向从主机到嵌入式设备.我在使用QT和编写C++方面几乎没有问题在桌面版本中.最后,感谢您提供一般但实用的指南/提示从 x86 GCC 交叉编译到 FreindlyARM 平台.

As you can see, I lost in details of cross-compiling and porting written software from host to embedded device. I almost have no problem in using QT and writing C++ in desktop version. At last, I appreciate you to give a your general but practical guideline/tips to cross-compiling from x86 GCC to FreindlyARM platform.

请多多指教

TIA

赛义德·阿姆罗拉希·博尤基

Saeed Amrollahi Boyouki

推荐答案

问.主机和目标计算机具有相同的架构是否重要,我的意思是两者都应该是 32 位(x86 或 i586/i686)还是都应该是 64 位(x86_64)?

Q. Is it important to host and target computers have the same architecture, I mean both should be 32-bits (x86 or i586/i686) or both should be 64-bits (x86_64)?

不,您可以进行任何更改,尽管我从未见过 32 位主机和 64 位目标.根据我的知识,另一种组合应该可以正常工作.

No, you can any variation, although I have never seen 32 bit host and 64 bit target. The other combination should just work according to my knowledge.

问.Qtopia 使用哪个版本的 GCC 重要吗?另一件事是应该使用哪个版本的QT/Embedded?

Q. Is it important to use which version of GCC with Qtopia? another thing is which version of QT/Embedded should be used?

是的,这很重要.不要混合使用新旧软件,因为它们不能很好地结合在一起.

Yes, it is important. Do not mix old and new softwares because they will not fit nicely together.

问.我是否必须像 Qtopia 一样使用旧版本的 QT/Embedded 或者我可以使用像 qt-everywhere-opensource-src-4.8.4 这样的较新版本?

Q. Do I have to use the old versions of QT/Embedded like Qtopia or I can use the newer versions like qt-everywhere-opensource-src-4.8.4?

没有.实际上,不要使用古老的Qtopia,尝试使用最近的Qt 版本,例如Qt 5.2.原因很简单,就是设计有缺陷,现在没有维护了.

No. In fact, do not use Qtopia the ancient, try to use a recent Qt release like Qt 5.2. The reason is simply the fact that is design flaws, and it gets no maintenance these days.

另一个问题是关于内核版本:重要吗 Q. 主机和目标计算机具有相同的内核编号 (x.y.z) 重要吗?

another problem is about kernel version: is it important Q. Is it important to host and target computers have the same kernel number (x.y.z)?

不,实际上几乎总是不同的.这是因为 Linux 内核种类繁多,被不同的发行版或发行版生成器使用.

No, it is almost always different, actually. That is due to the fact that there are so many varieties of the Linux kernel out there, used by different distributions or distribution generators.

最后,感谢您提供从 x86 GCC 到 FreindlyARM 平台的交叉编译的通用但实用的指南/技巧.

At last, I appreciate you to give a your general but practical guideline/tips to cross-compiling from x86 GCC to FreindlyARM platform.

如果您想为自己的目标构建 Qt,则需要注意 -platform-xplatform 选项.前者定义您的主机平台,后者定义嵌入式目标平台.

If you want to build Qt on your own for your target, you will need to pay attention to the -platform and -xplatform options. The former defines your host platform, and the latter the embedded target platform.

基本上,您需要以 mkspecs 文件的形式使 qmake 对您的板有适当的支持.如果没有,则在现有的基础上从头开始相对容易.

Basically, you need to make qmake has proper support for your board in form of mkspecs files. If it does not, it is relatively easy to get one from scratch based on the existing ones.

当您为嵌入式开发板构建软件时,您需要在基于 qmake 的项目中使用 -spec 选项来选择正确的目标.

When you build your software for the embedded board, you will need to use the -spec option in a qmake based project to select the right target.

我也建议考虑一下 QtCreator 作为新手,你可以正确配置工具包",自定义部署步骤等.它有很多内置的跨工具链开发支持.

I would also suggest to give some consideration to QtCreator as a newcomer where you can properly configure the "kits", and customize the deployment steps, etc. It has a lot of builtin cross-toolchain development support.

这篇关于C++/QT/ARM 处理器交叉编译/编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆