首页 > 解决方案 > centos系统无法编译lkm

问题描述

我安装了 Linux 头文件并创建了 Makefile 并尝试构建它,但出现了我在互联网上找不到的错误,这是错误

make -C /lib/modules/4.18.0-147.el8.x86_64/build M=/home/daniel modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-147.el8.x86_64'
arch/x86/Makefile:184: *** Compiler lacks asm-goto support..  Stop.
make[1]: Leaving directory '/usr/src/kernels/4.18.0-147.el8.x86_64'
make: *** [Makefile:5: all] Error 2

这是我的 Makefile

 obj-m :=   hook.o
 export-objs := hook.o

 all:
         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

标签: linuxmakefilekernel

解决方案


尝试运行这个:

yum group install "Development Tools"

推荐阅读