Linux asm/errno.h: 没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14795608/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:58:54  来源:igfitidea点击:

asm/errno.h: No such file or directory

linuxgcc

提问by mahmood

While building gcc, I get this error:

在构建 gcc 时,我收到此错误:

In file included from /usr/include/bits/errno.h:25,
             from /usr/include/errno.h:36,
             from ../.././gcc/tsystem.h:96,
             from ../.././gcc/crtstuff.c:68:
/usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory `/opt/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'

I am building gcc 4.1 from source. I think I have to install build-essential. However installing that package in ubuntu 12.04 will automatically download and install gcc 4.6 and I don't want that.

我正在从源代码构建 gcc 4.1。我想我必须安装build-essential. 但是,在 ubuntu 12.04 中安装该软件包将自动下载并安装 gcc 4.6,我不想要那样。

Is there any other way?

有没有其他办法?

回答by Dave

/usr/include/asm/errno.his part of the linux headers. I can't speak directly to Ubuntu 12.04, but in general you can download the linux sources as a package for your distro and it shouldn't require you to download/install gcc. Failing that, you can manually download the linux headers for the version of your kernel (uname -a) and use an include directive to CFLAGS to specify the directory to look for those.

/usr/include/asm/errno.h是 linux 头文件的一部分。我无法直接与 Ubuntu 12.04 对话,但通常您可以将 linux 源代码作为发行版的软件包下载,并且不需要您下载/安装 gcc。如果失败,您可以手动下载内核版本 ( uname -a)的 linux 头文件,并使用 CFLAGS 的包含指令来指定要查找这些文件的目录。

Edit: sudo apt-get install linux-headers-genericmay work for you.

编辑:sudo apt-get install linux-headers-generic可能适合你。

回答by Tiago Matias Rogério

I had this issue while compiling Asterisk 1.8.24.0 and solved it with:

我在编译 Asterisk 1.8.24.0 时遇到了这个问题,并通过以下方式解决了它:

mkdir /usr/include/asm-generic
cp /usr/include/asm/errno-base.h /usr/include/asm-generic/

Don't know if it is the "right way" but i've read the comments above and that gave me the idea... and it worked :)

不知道这是否是“正确的方式”,但我已经阅读了上面的评论,这给了我这个想法......它奏效了:)

回答by jrr

I think the package you want is linux-libc-dev. I encountered this when building 32-on-64; so I needed linux-libc-dev:i386.

我想你想要的包是linux-libc-dev. 我在构建 32-on-64 时遇到了这个问题;所以我需要linux-libc-dev:i386.

回答by vonbrand

You are missing part of the development packages. I don't know Ubuntu, but you should be able to ask it's package management system to install the package containing /usr/include/asm/errno.h.

您缺少部分开发包。我不知道 Ubuntu,但你应该可以要求它的包管理系统安装包含/usr/include/asm/errno.h.

Do notcopy some file with a similar name from somewhere on your system (or, even worse, from somewhere else). Missing files might mean that some package is damaged; again, ask your package manager to check everything and (re)install missing/broken pieces.

不要从系统上的某个地方(或者更糟的是,从其他地方)复制一些具有相似名称的文件。丢失文件可能意味着某些软件包已损坏;再次,请您的包管理器检查所有内容并(重新)安装丢失/损坏的部分。

Unless you are running some LTS release, upgrade. Your Ubuntu is some 2 years old, i.e., ancient.

除非您正在运行某些 LTS 版本,否则请升级。您的 Ubuntu 已有 2 年历史,即古老的。

While we are at this, why on this beautiful planet are you building such an ancient compiler? Current GCC is just released 4.9.0, anything before 4.7 is ancient history, not longer supported.

当我们在这里时,为什么要在这个美丽的星球上构建如此古老的编译器?当前的 GCC 刚刚发布 4.9.0,4.7 之前的任何东西都是古老的历史,不再支持。

回答by Kurt

If you can find:

如果你能找到:

usr/include/asm-generic/errno.h

usr/include/asm-generic/errno.h

by executing:

通过执行:

find /usr/include -name errno.h

find /usr/include -name errno.h

then try to execute:

然后尝试执行:

cp --archive /usr/include/asm-generic /usr/include/asm

cp --archive /usr/include/asm-generic /usr/include/asm

It may fix that problem.

它可能会解决这个问题。

回答by user2348442

This worked for me:

这对我有用:

ln -s /usr/include/asm-generic /usr/include/asm

回答by nkigen

This worked for me:

这对我有用:

sudo ln -s /usr/include/asm-generic /usr/include/asm

The reason being that what GCC expects to be called /usr/include/asmis renamed to /usr/include/asm-genericin some distros.

原因是 GCC 期望被调用的/usr/include/asm内容/usr/include/asm-generic在某些发行版中被重命名为。

回答by Todd Carnes

This fixed it for me.

这为我修好了。

sudo apt-get install linux-libc-dev:i386

回答by Lamb Tan

On Ubuntu 16.04 x86_64 you could try this:

在 Ubuntu 16.04 x86_64 上你可以试试这个:

ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm

This works on my server.

这适用于我的服务器。

回答by Poussy

If you want to use errno.h that is in the asm file, simply go to /usr/(ctrl + l, type /usr/) and then search for errno.h and errno-base.h. Once you did find them, copy the code in these two files, and place them in your include folder. And be careful, in "errno.h" the file includes "errno-base.h" as:

如果要使用 asm 文件中的 errno.h,只需转到 /usr/(ctrl + l,键入 /usr/),然后搜索 errno.h 和 errno-base.h。找到它们后,复制这两个文件中的代码,并将它们放入包含文件夹中。并且要小心,在“errno.h”文件中包含“errno-base.h”为:

#include <asm-generic/errno-base.h>

Either create a directory with the same name above or change the code above to something different which is suitable for you to use.

要么创建一个与上面相同名称的目录,要么将上面的代码更改为适合您使用的不同内容。