在Ubuntu 14.04上的交叉编译器上生成Makefile时出错

时间:2017-03-29 05:33:41

标签: qt ubuntu-14.04 cross-compiling qmake yocto

我在电脑上使用qt5.5。 当我制作Makefile时,我遇到了问题。

我将通过发送此代码获得Makefile。

qmake -spec ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/devices/linux-imx6-g++/ -o Makefile test.pro

它没有问题但是当发送“make”来构建我的程序时,它会向我显示这个错误。

arm-poky-linux-gnueabi-g++ -c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=softfp -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -I../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/devices/linux-imx6-g++ -o main.o main.cpp
In file included from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui/qwindowdefs.h:37:0,
             from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/qwidget.h:37,
             from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/qmainwindow.h:37,
             from ../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets/QMainWindow:1,
             from mainwindow.h:4,
             from main.cpp:1:
../../sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore/qglobal.h:39:21: fatal error: cstddef: No such file or directory
compilation terminated.
make: *** [main.o] Error 1

在另一种方法中,我可以执行此命令来获取Makefile。

qmake test.pro

在这种情况下,当我制作Makefile时,它做得很好。

但是如果我使用-spec指向我想要的qmake.config那么就会得到如上所述的错误。

我不知道为什么会这样。

我正在使用meta-toolchain-qt5进行交叉编译。

我错过了什么,或者是因为gcc版本太旧了?

请帮助!

1 个答案:

答案 0 :(得分:0)

使用OpenEmbedded构建的交叉编译器时,不应直接调用arm-poky-linux-gnueabi-g++。相反,您应该致电$CXX。原因是交叉编译器中的内置sysroot中毒(它指向不存在的路径)。例如,参见gcc reports sysroot is /not/exist中的解释。此更改在Yocto Project 1.8版中引入,请参阅Default Sysroot Poisoning