问题是什么
几天来,我一直在寻找一种方法来交叉编译Qt,因为我最近得到了一个,并想学习如何编写一些基本的嵌入式应用程序。
我正在遵循这里的教程:http://visualgdb.com/tutorials/raspberry/qt/embedded/
- 我使用了一个干净的系统,唯一需要安装的是一些依赖项:
apt-get install libudev-dev libinput-dev libts-dev libxcb*
(第一次运行时,configure
提示缺少库文件) - 从这里获取了Raspbian镜像和工具链,分别为
2015-11-21-raspbian-jessie
和raspberry-gcc-4.9.2-r2.exe
- Qt源码也来自于上面教程中的链接(
qt-everywhere-opensource-src-5.5.0.tar.xz
) - 我使用了相同的文件路径等,所以所有命令都应该没问题,包括
configure
:../qt-everywhere-opensource-src-5.5.0/configure -platform win32-g++ -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-rasp-pi2-g++ -sysroot C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5 -device-option CROSS_COMPILE=C:/SysGCC/Raspberry/bin/arm-linux-gnueabihf- -qt-xcb
几个小时后,所有的东西都建好了,应该没有错误。(我的输出与教程中的截图基本相同)
然而,尝试运行任何已构建的示例,结果只有一行:非法指令
我能提供什么更多的信息...
Following the thread I mentioned at the beginning, here's the
file
output:root@raspberrypi:/usr/local/qt5/examples/opengl/cube# file cube cube: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=e4c51318d4ca583ace647510c9b4cddd06a34e19, stripped
I tried to run the app with gdb using
gdb ./cube
and thenrun
. The output is:(gdb) run Starting program: /usr/local/qt5/examples/opengl/cube/cube [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". Program received signal SIGILL, Illegal instruction. 0xb6249734 in QMutex::lock() () from /usr/local/qt5/lib/libQt5Core.so.5 (gdb) Quit
The compiler itself work as cross-compile - I'm able to build C++ Hello World on windows, compile using
C:\SysGCC\Raspberry\bin\arm-linux-gnueabihf-g++.exe
and then run it on RaspberryI was even able to configure Qt Creator properly, using
arm-linux-gnueabihf-g++.exe
as a compiler andC:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\local\qt5\bin\qmake.exe
as qmake - Basic opengl project builds fine, even remote deploying to raspi works :) ... pity about the "Illegal instruction"Raspbian:
Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
root@raspberrypi:/# lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie
Windows 7 64 bit
感谢您提前的任何帮助。当然,如果需要,我会提供任何必要的信息。
认真地说,我已经尝试了一个星期,在wiki.qt.io和wiki.qt.io上失败了,这些都是类似于Linux的东西。但我仍然非常期待在Windows上为我的Raspberry创建一个强大的、交叉编译的、远程部署的Qt环境,以便未来开发。 :)