简体   繁体   English

使用交叉编译器运行Makefile时出错

[英]Error in running Makefile using cross compiler

my Makefile is 我的Makefile是

obj-m := hello.o
PWD := $(shell pwd)
KERNELDIR := /lib/modules/4.4.0-130-generic/build#$(shell uname -r)/build/
default:
        make -C $(KERNELDIR) M=$(PWD) #ARCH=$(ARCH) CROSS_COMPILE=$(COMPILER) modules
clean:
        make -C $(KERNELDIR) M=$(PWD) #ARCH=$(ARCH) clean

I want to compile it using cross compiler. 我想使用交叉编译器进行编译。 I am compiling it using 我正在使用编译

 make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

It throws error: 它引发错误:

satya@satya-dev:~/Test/kernal$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make -C /lib/modules/4.4.0-130-generic/build M=/home/satya/Test/kernal #ARCH=arm CROSS_COMPILE= modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-130-generic'
Makefile:704: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[1]: arm-none-linux-gnueabi-gcc: Command not found
  LD      /home/satya/Test/kernal/built-in.o
/bin/sh: arm-none-linux-gnueabi-ar: command not found
scripts/Makefile.build:418: recipe for target '/home/satya/Test/kernal/built-in.o' failed
make[2]: *** [/home/satya/Test/kernal/built-in.o] Error 127
Makefile:1437: recipe for target '_module_/home/satya/Test/kernal' failed
make[1]: *** [_module_/home/satya/Test/kernal] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-130-generic'
Makefile:7: recipe for target 'default' failed
make: *** [default] Error 2
satya@satya-dev:~/Test/kernal$

When search in forum for it is mentioned that compiler is 32 bit, but my compiler is 64 bit. 在论坛中搜索时,提到编译器是32位的,但是我的编译器是64位的。

satya@satya-dev:~/Test/kernal$ uname -m
x86_64

Even gcc is updated one. 甚至gcc都更新了。

satya@satya-dev:~/Test/kernal$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.10' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)

Any suggestions to compile this? 有什么建议可以编译吗?

When search in forum for it is mentioned that compiler is 32 bit, but my compiler is 64 bit. 在论坛中搜索时,提到编译器是32位的,但是我的编译器是64位的。

 satya@satya-dev:~/Test/kernal$ uname -m x86_64 

The architecture of your running system doesn't have anything to do with your compiler. 您正在运行的系统的体系结构与您的编译器无关。 Adding to that, you're cross compiling (or, trying to), so your default compiler isn't relevant either. 除此之外,您正在交叉编译 (或尝试编译 ),因此您的默认编译器也不相关。

The error message is actually quite obvious: 该错误消息实际上非常明显:

 /bin/sh: arm-none-linux-gnueabi-gcc: command not found 

So, you just don't have a cross-compiler for arm installed, at least not in your search path. 所以,您只是没有为arm安装交叉编译器,至少在您的搜索路径中没有。

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

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