Home » Linux » asm/errno.h: No such file or directory

asm/errno.h: No such file or directory

Posted by: admin November 30, 2017 Leave a comment

Questions:

While building gcc, I get this error:

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.

Is there any other way?

Answers:

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 .

Questions:
Answers:

This worked for me:

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

Questions:
Answers:

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/asm is renamed to /usr/include/asm-generic in some distros.

Questions:
Answers:

/usr/include/asm/errno.h is 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.

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

Questions:
Answers:

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.

Do not copy 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.

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.

Questions:
Answers:

If you can find:

usr/include/asm-generic/errno.h

by executing:

find /usr/include -name errno.h

then try to execute:

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

It may fix that problem.

Questions:
Answers:

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

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 🙂