Qt交叉编译Raspi3 - 致命错误:unistd.h:没有这样的文件或目录

时间:2016-12-14 09:48:35

标签: linux qt raspberry-pi cross-compiling

我正在关注指南wiki.qt.io/RaspberryPi_Beginners_Guide,在构建Qtbase时,我运行了一个命令make并收到以下错误:

http://pastebin.com/a2cXFGbC

locate unistd.h的输出:

http://pastebin.com/F656G0eG

一些细节:PC Debian Jessie,Raspberry Pi 3,安装了Raspbian的SD卡(如指南)。

1 个答案:

答案 0 :(得分:0)

我的configre命令行(忽略所有sysroot / prefix / hostprefix / extprefix选项):

./configure -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -sysroot "$R" -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -make tools -prefix /usr/lib/arm-linux-gnueabihf/qt5 -extprefix /usr/lib/arm-linux-gnueabihf/qt5 -hostprefix /usr/lib/arm-linux-gnueabihf/qt5

(注意pi2,也可能是pi3的配置)

和qtbase中文件的补丁(更改为匹配您的gcc版本和路径):

---------------- mkspecs/devices/linux-rasp-pi2-g++/qmake.conf ----------------
index 9be3f40..fcef488 100644
@@ -11,11 +11,11 @@ QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/opt/vc/include \
                           $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
                           $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
 QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}

 QMAKE_LIBS_EGL          = -lEGL -lGLESv2
-QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux
+QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux -I$$[QT_SYSROOT]/usr/include/c++/4.9/ -I$$[QT_SYSROOT]/usr/include/arm-linux-gnueabihf/c++/4.9
 QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS

 DISTRO_OPTS += hard-float

 # Preferred eglfs backend