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

C 使用交叉编译器运行Makefile时出错,c,linux,makefile,cross-compiling,C,Linux,Makefile,Cross Compiling,我的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 $(KERNEL

我的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
我想用交叉编译器编译它。我正在使用

 make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
它抛出错误:

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$
在论坛中搜索时提到编译器是32位的,但我的编译器是64位的

satya@satya-dev:~/Test/kernal$ uname -m
x86_64
satya@satya-dev:~/Test/kernal$ uname -m
x86_64
甚至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)
有什么建议来编辑这个吗

在论坛中搜索时提到编译器是32位的,但我的编译器是64位的

satya@satya-dev:~/Test/kernal$ uname -m
x86_64
satya@satya-dev:~/Test/kernal$ uname -m
x86_64
运行系统的体系结构与编译器无关。此外,您正在交叉编译(或尝试交叉编译),因此您的默认编译器也不相关

错误信息实际上非常明显:


因此,您只是没有安装用于
arm
的交叉编译器,至少在您的搜索路径中没有安装。

您没有编译
Makefile
。您可以使用它(通过
make
)来编译东西。还可以与
-x
一起使用来调试
Makefile
。我的错误是,我试图使用注释部分中的“make ARCH=arm CROSS\u COMPILE=arm none linux gnueabi-”命令运行make file