交叉编译C++报错
编译命令:arm-linux-gnueabihf-g++ -std=c++11 -o gpio gpio.cpp -lgpiod -L/usr/local/lib -I/usr/local/include -I/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1 --sysroot=/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf报错:
:~/code$ arm-linux-gnueabihf-g++ -std=c++11 -o gpio gpio.cpp -lgpiod -L/usr/local/lib -I/usr/local/include -I/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1 --sysroot=/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf
In file included from /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/bits/c++config.h:533:0,
from /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/iostream:38,
from gpio.cpp:1:
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/bits/os_defines.h:39:10: fatal error: features.h: No such file or directory
#include <features.h>
-lgpiod: 指定链接的库,这里是 libgpiod。
-L/usr/local/lib: 指定编译器在链接时查找libgpiod库文件的路径为 /usr/local/lib。
-I/usr/local/include: 指定编译器在编译时查找libgpiod头文件的路径为 /usr/local/include。gpiod.h在这个路径下
-I/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1: 指定编译器在编译时查找 C++ 标准库头文件的路径为 /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1。
--sysroot=/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf: 指定编译器在查找标准系统头文件和库文件时的根路径,即交叉编译环境的根路径。
<features.h>明明是存在这个路径下的子文件夹,下面倒数第三行。
:~/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/parallel$ ls
algobase.h for_each_selectors.hpartition.h
algo.h iterator.h queue.h
algorithm list_partition.h quicksort.h
algorithmfwd.h losertree.h random_number.h
balanced_quicksort.h merge.h random_shuffle.h
base.h multiseq_selection.hsearch.h
basic_iterator.h multiway_merge.h set_operations.h
checkers.h multiway_mergesort.hsettings.h
compatibility.h numeric sort.h
compiletime_settings.hnumericfwd.h tags.h
equally_split.h omp_loop.h types.h
features.h omp_loop_static.h unique_copy.h
find.h parallel.h workstealing.h
find_selectors.h par_loop.h
详细的错误输出:
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-g++
COLLECT_LTO_WRAPPER=/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/7.4.1/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --with-system-zlib --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --with-float=hard --with-fpu=vfpv3-d16 --with-mode=thumb --with-tune=cortex-a9 --with-arch=armv7-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/sysroots/arm-linux-gnueabihf --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-gnueabihf/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 7.4.1 20181213 (Linaro GCC 7.4-2019.02)
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-o' 'gpio' '-L/usr/local/lib' '-I' '/usr/local/include' '-I' '/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1' '-shared-libgcc' '-march=armv7-a' '-mtune=cortex-a9' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mthumb' '-mtls-dialect=gnu'
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/7.4.1/cc1plus -quiet -v -I /usr/local/include -I /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1 -imultilib . -imultiarch arm-linux-gnueabihf -iprefix /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/ -isysroot /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf -D_GNU_SOURCE gpio.cpp -quiet -dumpbase gpio.cpp -march=armv7-a -mtune=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb -mtls-dialect=gnu -auxbase gpio -std=c++11 -version -o /tmp/cc9B2mTH.s
GNU C++11 (Linaro GCC 7.4-2019.02) version 7.4.1 20181213 (arm-linux-gnueabihf)
compiled by GNU C version 4.8.4, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1"
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/."
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1/backward"
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/include"
ignoring nonexistent directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/usr/local/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/usr/local/include"
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/../../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include"
ignoring nonexistent directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/usr/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/usr/include"
ignoring duplicate directory "/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/.
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include/c++/7.4.1/backward
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/include
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/include
End of search list.
GNU C++11 (Linaro GCC 7.4-2019.02) version 7.4.1 20181213 (arm-linux-gnueabihf)
compiled by GNU C version 4.8.4, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 92bf6b5e79f37491ed145911db6703d5
In file included from /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/bits/c++config.h:533:0,
from /home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/iostream:38,
from gpio.cpp:1:
/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf/bits/os_defines.h:39:10: fatal error: features.h: No such file or directory
#include <features.h>
^~~~~~~~~~~~
如果在加多一行-I/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/parallel去指向<features.h>的路径,交叉编译器就找不到上一级路径/home/eke/linux/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1下的头文件。
求助大佬们,谢谢!
页:
[1]