执行 make 命令时出错

执行 make 命令时出错

我创建了简单的内核模块,但执行make命令时遇到错误。

在此处输入图片描述

zeeshan@zeeshan-Y11C:~/modules$ make

make -C/lib/modules/5.0.0-31-generic/build/ M=/home/zeeshan/modules modules

make[1]: Entering directory '/usr/src/linux-headers-5.0.0-31-generic'

arch/x86/Makefile:146: CONFIG_X86_X32 enabled but no binutils support

./scripts/gcc-version.sh: line 26: gcc: command not found
./scripts/gcc-version.sh: line 27: gcc: command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
  CC [M]  /home/zeeshan/modules/simple.o

/bin/sh: 1: gcc: not found
scripts/Makefile.build:291: recipe for target '/home/zeeshan/modules/simple.o' failed

make[2]: *** [/home/zeeshan/modules/simple.o] Error 127
Makefile:1608: recipe for target '_module_/home/zeeshan/modules' failed
make[1]: *** [_module_/home/zeeshan/modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.0.0-31-generic'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2

答案1

您没有安装 C 编译器。安装软件包build-essential,它将安装 C 编译器和一些您通常需要用来构建用 C 编写的程序的其他东西。

相关内容