GCC 2.95.3 Guide

This simple gcc howto will help most users out there to get source distributions to compile properly. As you might know, latest versions of gcc do have compilation problems. mySQL, vmailmgr and some other programs will simply refuse to compile on newer versions of gcc. After doing some research, I found out that the best and most stable version of gcc is 2.95.3. In this quick howto you will configure and install the best gcc version.


GCC 2.95.3 Guide
or
A simple GCC howto for beginners

1) Who should use this guide?
Those of you who need mySQL and other sources to compile properly.

2) On what operating systems has this guide been tested on?
This guide should work on any Linux, FreeBSD and OpenBSD system. I have successfully compiled gcc on Redhat Linux 7.3 and 8.0. If you make it work on any other platform, please let me know.

3) Downloading gcc 2.95.3 source
Download the following source into /usr/local/src:
- GCC v2.95.3 from http://gcc.gnu.org

3) Configuring gcc
The most important part of gcc installation is configuration. You have to make sure that the values passed to configure script correspond to your system. For Redhat Linux, issue the following commands:

# cd /usr/local/src
# tar zxf gcc-2.95.3.tar.gz
# cd gcc-2.95.3
# ./configure –host=i686-redhat-linux –build=i686-redhat-linux –enable-multilib
–enable-shared –with-system-zlib –prefix=/usr –enable-threads=posix

Configure will take a while and create the necessary makefile. Of course, if your OS is not Redhat, you have to change –host and –build lines accordingly.

4) Compiling and testing gcc
Now all we need to do is compile gcc and install it:

# make
# make install

The compilation process for gcc is very long (depends on your CPU speed). On my system it took a while, so I just went to have my dinner :-)

Now let’s see how the installation went by testing gcc version:

# gcc -v
Reading specs from /usr/lib/gcc-lib/i686-redhat-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)

If you get a similar output, it means that everything went smoothly! If not, something is wrong. Try to locate your gcc executable ([color=red]locate gcc | more[/color]) and see if you have gcc installed somewhere other than /usr/bin. If you have multiple gcc instances, it is best to get rid of those. Simply rename them (just in case).

That’s it! You’re done! Congratulations :-)

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Diigo
  • email
  • LinkedIn
  • Live
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. Guide updates
  2. Russian GD 2.0.33 Guide
  3. Russian GD 1.8.4 Guide
  4. Guide Updates
  5. Apache, PHP, GD & Mod_Perl Guide

Nasim Mansurov
is a professional photographer based out of Denver, Colorado. He is the author and founder of The Mansurovs, along with a number of other online resources. Read more about Nasim here.

Comments

  1. robertn

    Another site (Linux from Scratch) had other compile options such as –enable-languages-c,c++;
    Is this available or necessary if one does not enable it as above. Also, my kernel compiles of mandrake linux 2.4.21-0.32 kernel are not automatically providing a kernel.h updated as in

    ls -l /boot/kernel.h-2.4.21-0.32mdk
    -rw-r–r– 1 root root 441 Jul 27 21:16 /boot/kernel.h-2.4.21-0.32mdk

    this demonstrates that I still have this old build kernel.h and hence it seems I will never boot mk custom kernel which is labelled 2.3.21-0.32mdkcustom in the Makefile

    A parting note; I think it would be helpful for newbies to have it noted that the gcc package that comes with the distribution must be used to build this older gcc version and that some recommend setting a further scripting enabler of –prefix=/opt/gcc-2.95.3 so as to load this version away from the newer version (in /opt/gcc-2.95.3 directory) to not confuse things. Alas some linking of libraries may be necessary here and so perhaps this is just another layer of confusion..

    for i in /opt/gcc-2.95.3/lib/*.so*; do mv -f $i /usr/lib;
    ln -sf /usr/lib/`basename $i` /opt/gcc-2.95.3/lib; done

    I do not know if this accomplishes it but it describes the idea.

    If this is done; the make command using the early gcc is

    make CC=/opt/gcc.2.95.3/bin/gcc dep && clean && bzImage ; for example

    http://www.tldp.org/LDP/lfs/html/chapter06/gcc-2953.html isthe reference link

  2. Luis

    following your instructions to install gcc-2.95.3 getting the error message:
    ***The command ‘cc -o conftest -g conftest’ failed
    ***You must set the environment variable CC to a working compiler
    I removed the gcc-4.3 version from the system (Fedora Core7), what othe compiler can be used to get the gcc-2.95.3 properly installed?
    Thanks
    Luis

  3. Ali

    All is ok until I write the make command
    I obtain the following error:

    …/../gcc-2.95.3/libio/libio.h:167,
    from
    …/../gcc-2.95.3/libio/iolibio.h:1,
    from
    …/../gcc-2.95.3/libio/libioP.h:47,
    from
    …/../gcc-2.95.3/libio/iogetline.c:26:
    /usr/include/bits/stdio-lock.h:24: lowlevellock.h: No
    such file or directory
    make[2]: *** [iogetline.o] Error 1
    make[2]: Leaving directory
    `/tmp/objdir/i686-pc-linux-gnu/libio’
    make[1]: *** [all-target-libio] Error 2
    make[1]: Leaving directory `/tmp/objdir’
    make: *** [bootstrap] Error 2

    can you help me plz

    • Ali, looks like you are missing a header file called “lowlevellock.h”. I believe you are running a more recent version of Linux with newer headers. Why do you need to go back to 2.95.3? I would suggest using the latest version that came with your linux distribution.

  4. Ali

    First of all, tanks a lot for your quick response,
    You have reason, I am running a more recent version of Linux with newer headers,
    In fact I am a new Linux user, I am a PhD student in networking in the first year,
    I need to simulate using ns2 (Network Simulator 2),
    An old version of ns, the ns2.26 needs the gcc version 2.95.3
    Actually, I have installed the latest version of ns, the ns2.34 and all is ok,
    Maybe after I will be obliged to use ns2.26 for academic reasons, in this case I will return to you to ask my questions,
    Finally, tanks for your response

Speak Your Mind

*