为树莓派pi交叉编译Qt时出错 [英] Error while cross compiling Qt for a raspberry pi3

查看:1792
本文介绍了为树莓派pi交叉编译Qt时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想交叉编译Qt为树莓派开发一个GUI。我一直在关注本教程: https://wiki.qt.io/RaspberryPi2EGLFS

I want to cross compile Qt to develop a gui for a raspberry pi. I have been following this tutorial: https://wiki.qt.io/RaspberryPi2EGLFS

我正在使用此配置命令:

I am using this configure command:

./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option \
CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- \
-sysroot ~/raspi/sysroot -opensource -confirm-license \
-make libs -no-use-gold-linker -prefix /usr/local/qt5pi \
-extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v

这是我回来的错误:

/home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/vbox/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/vbox/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/vbox/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/vbox/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o    
/home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
 collect2: error: ld returned 1 exit status
 Makefile:66: recipe for target 'verifyspec' failed
 make: *** [verifyspec] Error 1
Note: Also available for Linux: linux-clang linux-icc
ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.`

这是config.log:

This is the config.log:

vbox@vbox:~/qtbase$ cat config.log
Command line: -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/vbox/raspi/sysroot -opensource -confirm-license -make libs -no-use-gold-linker -prefix /usr/local/qt5pi -extprefix /home/vbox/raspi/qt5pi -hostprefix /home/vbox/raspi/qt5 -v
executing config test machineTuple
+ /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -dumpmachine
 arm-linux-gnueabihf
test config.qtbase.tests.machineTuple succeeded
executing config test verifyspec
+ cd /home/vbox/qtbase/config.tests/verifyspec && /home/vbox/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/vbox/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/vbox/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/vbox/raspi/sysroot" -early "CONFIG += cross_compile" /home/vbox/qtbase/config.tests/verifyspec
 Info: creating stash file /home/vbox/qtbase/config.tests/.qmake.stash
+ cd /home/vbox/qtbase/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
 /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/vbox/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/vbox/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o verifyspec.cpp
 /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/vbox/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/vbox/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/vbox/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/vbox/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o    /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
 /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
 /home/vbox/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
 collect2: error: ld returned 1 exit status
 Makefile:66: recipe for target 'verifyspec' failed
 make: *** [verifyspec] Error 1

我不确定从这里去哪里,我还不知道如何开始调试此问题。是否有备用工具链可用?还是QMakeSpec的问题?有关尝试的事情的任何建议都将非常有帮助。

I'm not sure where to go from here, I don't know enough to start debugging this issue. Are there alternate toolchains available? Or is the issue with the QMakeSpec? Any suggestions on things to try would be very helpful.

推荐答案

此博客文章似乎更具体地针对RPi3,并且可能也是如此。 (2017年1月12日):

This blog post seems more specific to RPi3, and probably does it too (last Jan 12, 2017):

https://medium.com/@amirmann/how-to-cross-compile-qt-for-raspberry -pi-3-on-linux-ubuntu-for-beginners-75acf2a078c

sudo apt-get upgrade
sudo apt-get update
sudo apt-get install libgl1-mesa-dev
...
sudo apt-get build-dep qt5-default
sudo apt-get install libxcb-xinerama0-dev
sudo apt-add-repository ppa:u-szeged/sedkit
sudo apt-get update
sudo apt-get install sedkit-env-qtwebkit
sudo apt-get install build-essential perl python git
sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison
sudo apt-get install libbz2-dev libgcrypt11-dev libdrm-dev libcups2-dev libatkmm-1.6-dev
sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

请注意您正在查看的Wiki上他们为使它在较新的版本上可用而进行的一些操作。以下是该Wiki页面的一些历史记录:

There is a note on the wiki you are looking at of some things they did to get it to work on newer builds. Here is some of the history of that wiki page:

https://wiki.qt.io/index.php?title=RaspberryPi2EGLFS&type=revision&diff=31538&oldid=30634

然后是Qt的设备创建许可版本,那么您将使用以下说明:

And then there is the device creation licensed version of Qt then you would use these instructions:

< a href = http://doc.qt.io/QtForDeviceCreation/qtee-preparing-hardware-rasberrypi.html rel = nofollow noreferrer> http://doc.qt.io/QtForDeviceCreation/qtee-preparing-hardware -rasberrypi.html

在研究Scratch上有关Linux的文章时,我一直学到很多东西。在我最近没有建立Qt的过程中,它们非常有帮助。

I have always learned a lot while digging into the articles on Linux from Scratch. In my recent building of Qt with nothing, they have been super helpful.

http://www.linuxfromscratch.org/blfs/view/8.0/x/qt5.html

希望这些链接有所帮助。

Hope those links help.

这篇关于为树莓派pi交叉编译Qt时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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