gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 10:07:10 25 4
gpt4 key购买 nike

我的 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

连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)

有什么编译建议吗?

最佳答案

When search in forum for it is mentioned that compiler is 32 bit, but my compiler is 64 bit.

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

您正在运行的系统的体系结构与您的编译器没有任何关系。除此之外,您正在交叉编译(或尝试这样做),因此您的默认编译器也不相关。

错误信息其实很明显:

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

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

关于c - 使用交叉编译器运行 Makefile 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51626387/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com