Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 23844  / 1 Year ago, mon, january 2, 2023, 5:16:41

I'm trying to install gcc 4.8.1 at the moment. Currently 4.8.2 and 4.9.1 are installed. I downloaded an 4.8.1 from here http://gcc.cybermirror.org/releases/gcc-4.8.1/ . After extracting the files I did a ./configure and then tried make. At the end of make, I get this error



/usr/include/linux/errno.h:1:23: fatal error: asm/errno.h: No such file or directory
#include <asm/errno.h>


I am new to linux so I do not know how to find or add this header file.



Edit: Steps I made:




  1. Extract gcc-4.8.1.tar.gz to a folder

  2. Open terminal window

  3. cd gcc-4.8.1

  4. ./configure --build=x86_64-linux-gnu

  5. make -j4



I don't know what I did differently but it finally compiled. After that I did make install. My question now how do I use this instead of 4.8.2 which using the command gcc-4.8
still defaults to.


More From » compiling

 Answers
5

The asm/errno.h header is provided by a variety of packages. Odd that gcc would require it, but you can try:



sudo apt-get install linux-libc-dev


You also need to tell GCC to look for an architecture and OS specific location for the headers:



../configure --build=x86_64-linux-gnu 


(or i386-linux-gnu for 32-bit Ubuntu).






It's highly recommended when building stuff from source that you use --prefix flag (and with GCC, the --program-suffix flag) while configuring. Since you haven't, try running /usr/bin/gcc.



Thus:



tar xf gcc-4.8.1.tar.gz 
mkdir gcc
cd gcc
../gcc-4.8.1/configure --build=x86_64-linux-gnu --prefix=/usr/local --program-suffix=-4.8.1
make -j
sudo make install


Now your GCC binaries will be installed to /usr/local/bin/, and other things in other folders in /usr/local.



For example:



$ /usr/local/bin/gcc-4.8.1  # or simply gcc-4.8.1, since this folder is in your PATH


Note how I'm running configure and make from a different directory, outside of where the GCC source is? That's how the GCC docs recommend that GCC be built.


[#23009] Tuesday, January 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
velelf

Total Points: 395
Total Questions: 115
Total Answers: 107

Location: Sudan
Member since Mon, Jun 1, 2020
4 Years ago
velelf questions
Sat, Nov 6, 21, 05:08, 3 Years ago
Fri, Sep 24, 21, 01:23, 3 Years ago
Sun, Oct 9, 22, 07:37, 2 Years ago
Mon, Oct 10, 22, 08:55, 2 Years ago
;