raspberry pi cross compiler(linaro)找不到包含

时间:2017-03-24 23:01:47

标签: gcc cmake raspberry-pi

我按照这个问题的答案(Installing Raspberry Pi Cross-Compiler)设置了一个工具链,用于从linux(Mint 18.1)编译到raspberry pi 3。

我设置了所有内容但是当我创建项目时,它找不到我看到的标题确实已复制到本地计算机中。

例如,

我的cmake交叉编译项目的工具链文件如下所示:

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER $ENV{HOME}/workspace/pi/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER $ENV{HOME}/workspace/pi/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/workspace/pi/pilibs/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  • $HOME/workspace/pi/xtools是git://github.com/raspberrypi/tools.git repo。
  • $HOME/workspace/pi/pilibs包含我的/lib/usr dirs。而且我可以确认我是否会制作'程序直接在pi上,它编译得很好。

但是,当我做'在我的Linux机器上,在使用cmake生成makefile后(使用cmake-qt-gui;选择上面的工具链文件),它无法找到标题:

fede@fede-mbp ~/workspace/mt/mt-build-pi $ make
Scanning dependencies of target cguittfont
[  0%] Building CXX object src/cguittfont/CMakeFiles/cguittfont.dir/xCGUITTFont.cpp.o
In file included from /home/fede/workspace/pi/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/cstdlib:72:0,
                from /home/fede/workspace/pi/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/bits/stl_algo.h:59,
                from /home/fede/workspace/pi/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/include/c++/4.8.3/algorithm:62,
                from /home/fede/workspace/mt/minetest/src/cguittfont/xCGUITTFont.h:4,
                from /home/fede/workspace/mt/minetest/src/cguittfont/xCGUITTFont.cpp:4:
/home/fede/workspace/pi/pilibs/usr/include/stdlib.h:760:34: fatal error: bits/stdlib-bsearch.h: No such file or directory
# include <bits/stdlib-bsearch.h>
                                ^
compilation terminated.

虽然我确实有/home/fede/workspace/pi/pilibs/usr/include/arm-linux-gnueabihf/bits/stdlib-bsearch.h

1 个答案:

答案 0 :(得分:0)

显然,我还必须将CMAKE_SYSROOT设置为与CMAKE_FIND_ROOT_PATH相同的路径。