Redhat EL4 install GCC 4.2

Source: Internet
Author: User

Running file prompt:
/Usr/local/tools/fetion:/lib/libgcc_s.so.1: Version 'gcc _ 4.2.0 'not
Found (required by/usr/local/tools/fetion/lib/libstdc ++. so.6)
Check whether the/lib/libgcc_s.so.1 file exists. It is a link.
[Root @ localhost tools] # ll/lib/libgcc_s.so.1
Lrwxrwxrwx 1 Root 28 March 14 08:16/lib/libgcc_s.so.1-> libgcc_s-3.4.3-20041213.so.1
Check that the GCC version of the system is GCC (GCC) 3.4.3.
[Root @ localhost ~] # GCC -- version
GCC (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9. EL4)
So I wanted to upgrade GCC, but I didn't find the RPM package of gcc_4.2.0. I downloaded the source package directly.

I. Pre-upgrade information
[Root @ localhost ~] # Gcc-V
Reading specs from/usr/lib/GCC/i386-redhat-linux/3.4.3/specs
Configured with: ../configure -- prefix =/usr -- Mandir =/usr/share/man
-- Infodir =/usr/share/info -- enable-shared -- enable-threads = POSIX
-- Disable-checking -- With-system-zlib -- enable-_ cxa_atexit
-- Disable-libunwind-exceptions -- enable-Java-AWT = GTK
-- Host = i386-redhat-linux
Thread model: POSIX
GCC version 3.4.3 20041212 (Red Hat 3.4.3-9. EL4)
[Root @ localhost ~] # GCC -- version
GCC (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9. EL4)
Copyright (c) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is no
Warranty; not even for merchantability or fitness for a particle purpose.
Ii. Upgrade process
[Root @ localhost ~] # Wget http://ftp.gnu.org/pub/pub/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2
[Root @ localhost ~] # Tar jxf gcc-4.2.0.tar.bz2
[Root @ localhost ~] # Mkdir/usr/gcc4
[Root @ localhost ~] # Gcc-4.2.0/CD
[Root @ localhost gcc-4.2.0] #./configure -- prefix =/usr/gcc4
[Root @ localhost gcc-4.2.0] # Make clean
[Root @ localhost gcc-4.2.0] # Make
A long time, after several hours of compilation (the materials said that all components should be compiled almost once) for the next step
[Root @ localhost gcc-4.2.0] # Make check
Is it a test? After a long compilation, I learned how to prompt for errors in the course of watching laruence.
Make [1]: Entering directory '/root/gcc-4.2.0'
Make [2]: Entering directory '/root/gcc-4.2.0/host-i686-pc-linux-gnu/fixeredes'
Autogen-T http://www.cnblogs.com/./fixincludes/check.tpl http://www.cnblogs.com/./fixincludes/inclhack.def
Make [2]: autogen: Command not found
Make [2]: *** [Check] Error 127
Make [2]: Leaving directory '/root/gcc-4.2.0/host-i686-pc-linux-gnu/fixgatedes'
Make [1]: *** [Check-fixdocumdes] Error 2
Make [1]: Leaving directory '/root/gcc-4.2.0'
Make: *** [Do-check] Error 2
[Root @ localhost gcc-4.2.0] # make install
........
----------------------------------------------------------------------
Libraries have been installed in:
/Usr/gcc4/lib
If you ever happen to want to link against installed Libraries
In a given directory, libdir, you must either use libtool, and
Specify the full pathname of the library, or use the '-llibdir'
Flag during linking and do at least one of the following:
-Add libdir to the 'LD _ LIBRARY_PATH 'environment variable
During execution
-Add libdir to the 'LD _ run_path 'environment variable
During linking
-Use the '-wl, -- rpath-wl, libdir' linker flag
-Have your system administrator add libdir to '/etc/lD. So. conf'
See any operating system documentation about shared libraries
More information, such as the LD (1) and LD. So (8) manual pages.
----------------------------------------------------------------------

Check the version or the old version. If you think about it later, you will find that the above operation is to install GCC instead of upgrading. Next, point to the newly installed Library Link and delete the old library link.
....
The old version is installed with the source code. Check the path of which GCC or whereis GCC.
[Root @ localhost bin] # Which gcc
/Usr/bin/GCC
[Root @ localhost bin] # whereis gcc
GCC:/usr/bin/GCC/usr/lib/GCC/usr/libexec/GCC/usr/share/man/Man1/gcc.1.gz
Replace the old/usr/lib folder with the newly installed GCC, G ++, and gcj files in/usr/gcc4/lib /.
[Root @ localhost ~] # Cd/usr/lib
[Root @ localhost bin] # mv GCC gcc_bak
[Root @ localhost bin] # mv g ++ _ Bak
[Root @ localhost bin] # mv gcj gcj_bak
[Root @ localhost bin] # ln-SV/usr/gcc4/bin/GCC gcc
[Root @ localhost bin] # ln-SV/usr/gcc4/bin/g ++
[Root @ localhost bin] # ln-SV/usr/gcc4/bin/gcj
Ldconfig-V re-load the library? I understood it later.
[Root @ localhost bin] # ldconfig-V
[Root @ localhost bin] # gcc-V
Use built-in specs.
Goals: i686-pc-linux-gnu
Configuration:./configure -- prefix =/usr/gcc4
Thread model: POSIX
GCC version 4.2.0
OK. The GCC version is updated. Run it later. Program Check
/Usr/local/tools/fetion:/lib/libgcc_s.so.1: Version 'gcc _ 4.2.0 'not
Found (required by/usr/local/tools/fetion/lib/libstdc ++. so.6)
Xxd. If you have been tossing for so long, you still get an original error.
[Root @ localhost ~] # Find/-name libgcc *
/Lib/libgcc_s-3.4.3-20041213.so.1 (linked files)
/Lib/libgcc_s.so.1 (File prompted)
......
/Usr/gcc4/lib/libgcc_s.so.1 (file in the new installation directory)
The libgcc_s.so.1 file is also available in the directory with the same structure as gcc4.
[Root @ localhost ~] # Mv/lib/libgcc_s.so.1/lib/libgcc_s.so.w.bak
[Root @ localhost ~] # Ln-S/usr/gcc4/lib/libgcc_s.so.1/lib/libgcc_s.so.1
Run the program again.

Iii. Postscript
1. gcc4 should be installed in the/usr/local/gcc4 directory
2, a friend suggested red hat with rpm-IVH gcc-4.1.2-33.i386.rpm this installation will be better
3. I can solve the same problem on centos4 by using the yum update GCC command.

4. Related Links
Instructions on installing the flying mail robot in centos4

Http://hi.baidu.com/addcn/blog/item/8fc75461ef47ced78cb10d8b.html

Problems with installing GCC in Linux

Http://zhidao.baidu.com/question/51816308.html

GCC upgrade

Http://coolangelan.blog.163.com/blog/static/104161247200904502222/

How to install gcc4.2. * in Linux

Http://coolangelan.blog.163.com/blog/static/10416124720090453314726/

Notes on upgrading Gentoo to GCC 4.2.0
-A reply to the question is worth trying.

Http://markmail.org/message/lyzrlvmwc53tdob7

Gentoo GCC upgrade Guide
-Emerge-uav gcc or something. I knocked a few prompts on the command and didn't read it.

Http://www.gentoo.org/doc/zh_cn/gcc-upgrading.xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.