【问题标题】:fatal error: linux/mount.h: No such file or directory致命错误:linux/mount.h:没有这样的文件或目录
【发布时间】:2020-11-09 01:49:48
【问题描述】:

我正在运行 make 命令来构建从 here 下载的源代码。在运行make 时,它总是抛出同样的错误:

In file included from criu/cgroup.c:29:0:
criu/include/linux/mount.h:8:10: fatal error: linux/mount.h: No such file or directory
 #include <linux/mount.h>
          ^~~~~~~~~~~~~~~
compilation terminated.

我已多次检查该文件确实存在于我正在尝试构建的源代码中。但我不明白为什么编译器找不到它?处理这些类型的错误的解决方案是什么?

编辑:此源代码在criu/include/linux/mount.h目录中包含另一个mount.h文件,在该文件中,他们使用了#include &lt;linux/mount.h&gt;

EDIT2mount.h 文件不在/usr/include/linux/ 目录中,因此我将文件从主机的文件复制到 VM。现在我已经成功构建了包并安装了二进制文件,但我仍然想问一个问题是为什么mount.h 没有出现在 VM 上。

【问题讨论】:

  • 你的内核版本是多少?

标签: c makefile compilation include


【解决方案1】:

我不明白为什么编译器找不到它?

因为它不应该。应该使用

#include "linux/mount.h"

而不是

#include <linux/mount.h>

包含项目中的文件。

【讨论】:

  • 嗨,我应该直接更改他们的源代码吗?即使我更改每个#include &lt;mount.h&gt; 也不会进一步造成问题?
  • 现在我想知道它是作为一个完整的软件包发布来安装的,在发布之前他们没有测试过它并发现了同样的错误。
  • 在我的主机 hernel 上,mount.h 存在于 /usr/include/linux/mount.h 目录中,但在我的 VM 中,该文件不存在于该目录中。
猜你喜欢
  • 1970-01-01
  • 2020-07-27
  • 2014-05-25
  • 2017-05-09
  • 2021-05-15
  • 2014-10-31
  • 2022-01-11
  • 2021-09-19
相关资源
最近更新 更多