简体   繁体   English

用于arm linux的QT构建应用程序

[英]QT building applications for arm linux

I got a little confused when it comes to QT and cross compiling appliations for my arm-linux: 当谈到QT并为我的arm-linux交叉编译应用时,我有点困惑:

So far I have a linux running on my AT91SAM9263-EK and an appropriate filessystem including QT libs build via buildroot. 到目前为止,我在我的AT91SAM9263-EK上运行了一个linux,并且有一个适当的文件系统,包括通过buildroot构建的QT库。

Also I have build QT-4.8 on my ubuntu. 我也在我的ubuntu上构建了QT-4.8。

Now I want to build an example application: 现在我想构建一个示例应用程序:

  1. I created a makefile in an examples folder in QT on my ubuntu using qmake; 我使用qmake在我的ubuntu上的QT中的examples文件夹中创建了一个makefile; I used the given qmake.conf in mkspecs/qws/linux-arm-g++. 我在mkspecs / qws / linux-arm-g ++中使用了给定的qmake.conf。

  2. when executing make I get an error because it includes qatomic_i386.h and the message "error: impossible constraint in 'asm'". 当执行make时我得到一个错误,因为它包含qatomic_i386.h和消息“错误:'asm'中的不可能约束”。 this header file does obviously not match to my arm toolchain. 这个头文件显然与我的arm工具链不匹配。

my question: how to configure Qt on my ubuntu to build Qt binaries for my embedded linux on arm? 我的问题:如何在我的ubuntu上配置Qt来为我的嵌入式Linux构建Qt二进制文件? Do I need to include any libs build by the arm toolchain? 我是否需要包含arm工具链构建的任何库?

any help is appreciated! 任何帮助表示赞赏!

regards 问候

EDIT: I use the -spec flag and pass the path to "mkspecs/qws/arm-linux-g++" where a "qmake.conf" is located. 编辑:我使用-spec标志并将路径传递给“mkspecs / qws / arm-linux-g ++”,其中有“qmake.conf”。 I did not change anything in here because I dont know wich qmake variable are relevant to link to my arm related libs. 我在这里没有改变任何东西,因为我不知道qmake变量与链接到我的手臂相关的libs有关。 So the right compiler is used, which I could verify when the make process starts. 所以使用了正确的编译器,我可以在make进程启动时验证它。 But I observed that in a config file called qconfig.h there is an ARCH flag which is set to i386 but I didnt figure out how one can configure this. 但我观察到在一个名为qconfig.h的配置文件中有一个ARCH标志设置为i386,但我没弄明白如何配置它。 I dont think I should manually edit this file. 我不认为我应该手动编辑这个文件。

EDIT2: someone knows whats behind the file qconfig.h?? EDIT2:有人知道文件qconfig.h背后是什么? should I adjust it manually? 我应该手动调整吗?

I will solve it by myself :) 我会自己解决:)

After struggling a while and scanning the web I got a little deeper involved how everything works together. 经过一段时间的努力并扫描网络后,我深入了解了一切如何协同工作。 I did not understand how to generate an executable for my ARM target device. 我不明白如何为我的ARM目标设备生成可执行文件。 I figured out two things: 我想出了两件事:

  1. do not add your QT path for X11 at the beginning in your PATH variable. 不要在PATH变量的开头添加X11的QT路径。 this might mess up your cross compilation. 这可能搞乱你的交叉编译。

  2. edit the qmake.conf correspondingly. 相应地编辑qmake.conf。 add your libs build for the target device which in my case are located within buildroot. 添加你的libs build为目标设备,在我的情况下位于buildroot内。 Add theses lines to your qmake.conf file: 将这些行添加到qmake.conf文件中:
    QMAKE_CFLAGS += -O3 -march=armv5te QMAKE_CFLAGS + = -O3 -march = armv5te
    QMAKE_CXXFLAGS += -O3 -march=armv5te QMAKE_CXXFLAGS + = -O3 -march = armv5te
    QMAKE_INCDIR_QT = /home/user/arm/toolchain/buildroot-2010.11/output/staging/usr/include QMAKE_INCDIR_QT = /home/user/arm/toolchain/buildroot-2010.11/output/staging/usr/include
    QMAKE_LIBDIR_QT = /home/user/arm/toolchain/buildroot-2010.11/output/staging/usr/lib QMAKE_LIBDIR_QT = /home/user/arm/toolchain/buildroot-2010.11/output/staging/usr/lib

I got it running now. 我现在跑了。 thanks to everyone! 谢谢大家!

Yes, either you provide the Qt libraries in your toolchain or you tell qmake where to find them. 是的,要么在工具链中提供Qt库,要么告诉qmake在哪里找到它们。 Also, I suspect you're calling qmake without the -spec parameters. 另外,我怀疑你在没有-spec参数的情况下调用qmake。 If you are using the qmake you find in your distribution, it will use the default spec, which is not arm I guess. 如果您使用的是您在发行版中找到的qmake,它将使用默认规范,这不是我想的。 Add the -spec parameter and point it to the arm mkspec. 添加-spec参数并将其指向arm mkspec。 Also, make sure the generated g++ commands link to the correct Qt libs compiled for arm. 另外,确保生成的g ++命令链接到为arm编译的正确Qt库。

You shall install QtSDK for embedded linux befor you use it to build your application. 你应该为嵌入式Linux安装QtSDK因为你用它来构建你的应用程序。 I'm afraid you just have QtSDK for x86 right now. 我担心你现在只需要x86的QtSDK After QtSDK for embedded linux installed, it has qws/linux-arm-g++ as the default mkspace typically. QtSDK了嵌入式Linux的QtSDK之后,它通常将qws / linux-arm-g ++作为默认的mkspace。 If you don't have QtSDK for embedded linux, you can build it from source. 如果你没有嵌入式Linux的QtSDK ,你可以从源代码构建它。 Then run qmake to create Makefile for you application. 然后运行qmake为您的应用程序创建Makefile。

$QTDIR_FOR_ARM/qmake

Reference: Installing Qt for Embedded Linux and Cross-Compiling Qt for Embedded Linux Applications 参考: 为嵌入式Linux安装Qt为嵌入式Linux应用程序交叉编译Qt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM