简体   繁体   English

交叉编译问题

[英]Cross compiling problems

I have installed the cross compile tools in the ubuntu 16.04.And when I type arm-linux-gnueabihf-gcc -v in the command line.The command line shows that the cross compiler can work as follows: 我已经在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) 

But when I execute ./configure --host=arm-linux-gnueabihf ,the system cannot detect the arm-linux-gnueabihf tools. 但是当我执行./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

WHich reason could cause this problem? 哪个原因可能导致此问题? How can I solve it? 我该如何解决? Thanks 谢谢

Have you exported your toolchain path? 您是否已导出工具链路径? You need to do that. 您需要这样做。 In order to work. 为了工作。

How to know you exported or not? 如何知道您是否出口?

type echo $PATH in your terminal it will show the path. 在终端中输入echo $PATH ,它将显示路径。


Solution to your problem: export your toolchain path. 解决问题的方法:导出工具链路径。

Below is example toolchain path. 下面是示例工具链路径。 You need to give the right path of your toolchain. 您需要给出正确的工具链路径。

Example: 例:

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

Well, arm-linux-gnueabihf-gcc seems to be not part of the list printed by the configure script, does it? 好吧, arm-linux-gnueabihf-gcc似乎不属于configure脚本打印的列表的一部分,对吗? But I see a check for arm-linux-gnueabihf-g++ . 但是我看到了检查arm-linux-gnueabihf-g ++的方法 Is that one installed too? 也是那个吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM