C++ 交叉编译问题

C++ 交叉编译问题,c++,linux,arm,cross-platform,C++,Linux,Arm,Cross Platform,我已经在ubuntu 16.04中安装了交叉编译工具。当我在命令行中键入arm linux gnueabihf gcc-v时,命令行显示交叉编译器可以按如下方式工作: Using built-in specs. COLLECT_GCC=arm-linux-gnueabihf-gcc COLLECT_LTO_WRAPPER=/home/nju/ti-processor-linux-sdk/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/../lib

我已经在ubuntu 16.04中安装了交叉编译工具。当我在命令行中键入
arm linux gnueabihf gcc-v
时,命令行显示交叉编译器可以按如下方式工作:

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/nju/ti-processor-linux-sdk/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/../libexec/gcc/arm-linux-gnueabihf/6.2.1/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/gcc-linaro-6.2-2016.11/configure SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap --with-cloog=no --with-ppl=no --with-isl=no --disable-nls --enable-c99 --enable-gnu-indirect-function --disable-multilib --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-multiarch --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/sysroots/arm-linux-gnueabihf --enable-lto --enable-linker-build-id --enable-long-long --enable-shared --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran,lto --enable-checking=release --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) 
但是当我执行
/configure--host=arm-linux-gnueabihf
时,系统无法检测到arm-linux-gnueabihf工具

configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-gnueabihf-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-gnueabihf-g++... no
checking for arm-linux-gnueabihf-c++... no
checking for arm-linux-gnueabihf-gpp... no
checking for arm-linux-gnueabihf-aCC... no
checking for arm-linux-gnueabihf-CC... no
checking for arm-linux-gnueabihf-cxx... no
checking for arm-linux-gnueabihf-cc++... no
checking for arm-linux-gnueabihf-cl.exe... no
checking for arm-linux-gnueabihf-FCC... no
checking for arm-linux-gnueabihf-KCC... no
checking for arm-linux-gnueabihf-RCC... no
checking for arm-linux-gnueabihf-xlC_r... no
checking for arm-linux-gnueabihf-xlC... no
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for arm-linux-gnueabihf-gcc... no
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for pthread_rwlock_init in -lpthread... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for unistd.h... (cached) yes
checking gtk/gtk.h usability... no
checking gtk/gtk.h presence... no
checking for gtk/gtk.h... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
哪个原因可能导致此问题?我怎样才能解决它?
谢谢

您是否导出了工具链路径?你需要这样做。为了工作

如何知道你是否出口

在终端中键入
echo$PATH
,它将显示路径


问题的解决方案:导出工具链路径

下面是工具链路径的示例。您需要给出工具链的正确路径

示例:

export PATH=/opt/your_toolchains/path/arm-unknown-linux-gnu/bin/:$PATH

是否已导出工具链路径?你需要这样做。为了工作

如何知道你是否出口

在终端中键入
echo$PATH
,它将显示路径


问题的解决方案:导出工具链路径

下面是工具链路径的示例。您需要给出工具链的正确路径

示例:

export PATH=/opt/your_toolchains/path/arm-unknown-linux-gnu/bin/:$PATH

嗯,arm-linux-gnueabihf-gcc似乎不在配置脚本打印的列表中,是吗?但是我看到了一个对arm-linux-gnueabihf-g++的检查。这个也安装了吗?

嗯,arm-linux-gnueabihf-gcc似乎不在配置脚本打印的列表中,是吗?但是我看到了一个对arm-linux-gnueabihf-g++的检查。这个也安装了吗?

谢谢你的建议。arm-linux-gnueabihf-g++也安装了。arm-linux-gnueabihf-g++和arm-linux-gnueabihf-gcc来自同一个工具链。谢谢你的建议。arm-linux-gnueabihf-g++也安装了。arm-linux-gnueabihf-g++和arm-linux gnueabihf-gcc来自同一个工具链。非常感谢。我在命令行中键入
echo$PATH
,该命令返回安装arm linux gnueabihf gcc和arm-linux-gnueabihf-g++的工具链路径。但是在配置项目时,命令行仍然提示我没有arm-linux-gnueabihf-g++。还有其他原因可能导致此问题吗?arm-linux-gnueabihf-g++位于工具链的bin文件夹中。如果你打开bin文件夹,它会列出所有的实用程序,比如
ld
gcc
g++
ar
as
,等等。你需要在你的主机
sudo-apt-install g++
非常感谢。我在命令行中键入了
echo$PATH
,并且该命令返回了安装arm-linux-gnueabihf-gcc和arm-linux-gnueabihf-g++的工具链路径。但是在配置项目时,命令行仍然提示我没有arm-linux-gnueabihf-g++。是否还有其他原因可能导致此问题?arm-linux-gnueabihf-g++位于工具链的bin文件夹中。如果你打开bin文件夹,它将列出所有实用程序,如
ld
gcc
g++
ar
as
,等等。你需要在你的主机
sudo-apt-install g++