【问题标题】:How to fix : No rule to make target?如何解决:没有制定目标的规则?
【发布时间】:2017-04-06 18:26:23
【问题描述】:

我正在尝试构建一个演示内核模块,但是当我制作时,我得到了关注,

make[1]: Entering directory '/usr/src/linux-headers-4.4.0-47-generic'
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h'. Stop.
arch/x86/Makefile:199: recipe for target 'archheaders' failed                                                                                      
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-47-generic'
Makefile:4: recipe for target 'all' failed

我正在跨 linux 内核构建模块 - 4.4.0-47 版本 - 64 位操作系统。谁能帮我理解为什么我会遇到这个错误。提前谢谢你。

【问题讨论】:

  • 你试过谷歌吗?错误No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl' 非常流行,可能有几个下划线问题。 究竟如何你编译内核模块(你使用哪个makefile或哪个命令行)?

标签: linux linux-kernel kernel system-calls kernel-module


【解决方案1】:

确保您有正确的 make 文件。这是一个非常普遍的问题。 或者您也可以在 makefile 中使用以下语句。

 obj-m += your_module_name.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

它应该可以工作。

【讨论】:

  • 我使用上面相同的代码仍然遇到问题中提到的错误
  • @GomteshHatgine 能否请您发布 makefile 内容以防您仍然遇到问题。
猜你喜欢
  • 1970-01-01
  • 2011-06-02
  • 1970-01-01
  • 1970-01-01
  • 2021-05-28
  • 2011-09-08
  • 1970-01-01
  • 2017-10-13
相关资源
最近更新 更多