Question

Updating GCC on Centos 5.2

Asked by: JimMead

Hi,
I am attempting to update GCC on our CentOS 5.2 server to the latest version as it supports Core2 optimisation, which I intend to use when compiling MySQL.
The server is currently running GCC 4.1.2 20071124 (Red Hat 4.1.2-42), which seems to be latest pre-compiled release for this distro.

I attempted to download and compile the GCC 4.3.3 sources, they seemed to compile (with a few warnings but no errors), but when I ran the test, there were a number of FAILs.
See the code block for how I compiled.

Does anyone has any advice on how I can do this?
Thanks
Jim

tar -zxpf gcc-4.3.3.tar.gz
cd gcc-4.3.3
mkdir mkdist1
cd mkdist1
../configure --enable-threads
make
make -k check

                                  
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-03-13 at 03:07:57ID24227077
Tags

CentOS

,

GCC

,

Core2

,

Core2 Duo

,

Intel

,

compile

,

source

,

update

,

upgrade

,

Red Hat

,

Linux

,

MySQL

Topics

CentOS

,

Compilers for Software Development

,

Red Hat Linux

Participating Experts
2
Points
190
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. GCC
    I have just installed Red Hat Linux 6.2 but whenever I run the make command or something like that, it always has an error. It says that GCC comnmand cannot be found. Does Red Hat 6.2 come with GCC and if so, what is the package called? I have the free version on the one CD.
  2. gcc upgrade
    how can i upgrade my gcc from source code.Do i have to clean old gcc first? if so how? i use the distro RedHat 7.3 on a PentiumII 350
  3. Fedora gcc
    I installed fedora core #4 and gcc will not compile many things I use. Is there a way that I can install an older version of gcc in addition to version that comes with fedora core #4. I'm going to need good instructions on how to do this.
  4. Default headers location - gcc
    This is a beginners question I wanted to know where should i locate the gcc headers on a ubuntu distro I checked the /usr/include folder but nothing there and i keep on getting gcc error while trying to include stdio.h header Thanks

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: dfkPosted on 2009-04-03 at 05:46:40ID: 24059227

I suspect the answer to the problem will reside in your config.log file.
Could you post that please.

 

by: JimMeadPosted on 2009-04-03 at 06:08:54ID: 24059433

Sure, here you go.

 

by: dfkPosted on 2009-04-03 at 07:54:05ID: 24060572

It looks like you've not got the right things installed.
Your logs show complaints for g++

I dont have a CentOS 5.2 box to hand but my RHEL 5.2 box (should be very close) gives me an indication.



Check for, and install, gcc-c++

yum install gcc-c++


This should allow your compile to move on further but it may still 'bark'.
Remember to check your config.log if you experience problems during compilation.

Rgds
Mark

 

by: JimMeadPosted on 2009-04-03 at 09:09:49ID: 24061516

I have done yum install gcc-c++ as suggested, which has updated gcc to 4.1.2 20080704 (Red Hat 4.1.2-44).

I have compared the two log files and the output looks somewhat more promising, I am currently running make, but I suspect it may take a while to complete, so I will post an update tomorrow.

Have attached the new config.log for you to look at if you wish.

What cflags should I be using (if any) when building GCC? Seems we are using "-g -O2".

Since I have never built GCC before, I was wondering if it was a good/bad idea to build 4.3.3, and then re-build it (using itself) with the cflags/march optimized for a Core2 processor.

  • config.log
    • 24 KB

    config.log after installing updated g++ via yum

 

by: dfkPosted on 2009-04-04 at 06:02:03ID: 24067200

Jim

rebuilding gcc will take some time but please post any output later.

As for rebuilding to take advantage of additional optimisations, my only concern would be any requirements on glibc....if you need to start upgrading glibc, you may want to put the brakes on and wait for an updated CentOS.

Keep going but sound an alarm if glibc is mentioned!

Mark

 

by: JimMeadPosted on 2009-04-06 at 06:01:42ID: 24076865

My console session timed out so I was unable to confirm that it built successfully
 
I have updated binutils to the latest version (2.19.1), previous version was 2.17, although I suspect that it wont make a great deal of difference.
 
I am rebuilding with the following configure
../configure --prefix=/usr --enable-threads=posix
cc is currently installed in /usr/bin and I think make install would want install to /usr/local/bin by default, so is it correct to specify a --prefix=/usr?
 
No errors yet, but I am getting a few warnings, for example:
../../gcc/config/i386/i386.md:19425: warning: operand 1 missing mode?
../../gcc/expr.c:4567: warning: cast discards qualifiers from pointer target type
../../../libjava/interpret-run.cc: In static member function 'static void _Jv_InterpMethod::run(void*, ffi_raw*, _Jv_InterpMethod*)':
../../../libjava/interpret-run.cc:2352: warning: label 'invokeinterface_resolved' defined but not used
 
Once the make is complete I will run make -k check and post the results (hopefully the test takes less than 3 hours to run)

 

by: JimMeadPosted on 2009-04-06 at 07:32:50ID: 24077652

Build has completed and I am currently running the check, unfortunately I have 8 fails so far.

FAIL: gcc.dg/torture/builtin-math-4.c  -O0  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O1  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O2  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -O3 -g  (test for excess errors)
FAIL: gcc.dg/torture/builtin-math-4.c  -Os  (test for excess errors)

Attached log, zipped as it is fairly large.
I will follow up with the complete log when the check is complete.

  • gcc-term.zip
    • 237 KB

    Results of the configure, make and part of the check

 

by: dfkPosted on 2009-04-06 at 07:33:19ID: 24077658

Yeah, I normally wouldnt have specified the prefix....but it wont make any difference to the compile....just the "make install" part.

Mark

 

by: JimMeadPosted on 2009-04-06 at 08:09:52ID: 24078120

make check didnt make it to the end.

13 fails (including the 8 previously mentioned) and 1 unexpected pass.

Full log attached.

 

by: dfkPosted on 2009-04-07 at 08:36:54ID: 24088453

Wow...thats a huge log to try to go through. I've just downloaded it and will try to get a look through it later today

 

by: dfkPosted on 2009-04-07 at 08:50:25ID: 24088631

Nothing obvious is jumping out at me here.
If you have the ability, I'd suggest you put the zip file up onto a webserver somewhere and post your question to the gcc list.
I'm sure that one of the developers will see the problem far quicker than I could given the 10 minute speed read I've just done.

The GCC mailing list - gcc-help@gcc.gnu.org may offer you greater assistance.

Best of luck....sorry I couldnt be of more assistance in this case; always difficult without the shell :-)

Mark

 

by: brianverrePosted on 2009-04-08 at 11:35:21ID: 24100384

Hi, I'm about to try the same gcc upgrade in CentOS 5.2 this weekend. It will be on a new quad core, the current CentOS 5.2 install is on a P4, so I will not be building gcc on that.

The first thing I noticed in your log is:

"The following languages will be built: c,c++,fortran,java,objc"

You may be running into build errors on these extraneous langauges. Set your targets for just C & C++ to begin with. Plus, you should cut down the build time.

Try a make clean, and start fresh. I will be following the thread, and posting my results from a clean CentOS install soon.

 

by: brianverrePosted on 2009-04-08 at 18:07:05ID: 24103383

Good news. Got GCC 4.3.3 to build on CentOS 5.2. I don't consider myself an expert, but here are my thoughts, and what I did:

Don't replace the system GCC setup, libs, etc. I think it is actually a bad idea to use --prefix=/usr. If you are installing newer libraries/apps you should consider that CentOS packages are dependant on the SYSTEM released version not your LOCAL version. So let things go to /usr/local. To quote the MPFR FAQ:

"The best solution is to add /usr/local/include to your C_INCLUDE_PATH environment variable and to add /usr/local/lib to your LIBRARY_PATH and LD_LIBRARY_PATH environment variables (and/or LD_RUN_PATH)."

GCC needs the math libraries GMP and MPFR to build. These are included on CentOS, but GCC config said the version installed was buggy. So I downloaded both, compiled and installed them to /usr/local. Took 5 minutes.

However, in CentOS/Redhat, the usr/local paths are not searched for C_INCLUDE_PATH, LD_LIBRARY_PATH, etc as other systems generally do. A bug some say.

To add your newly installed /usr/local/libs under Redhat/CentOS, there are a few tricks:

Add your library-paths (in this case /usr/local) to
# /etc/ld.so.conf
and run
# /sbin/ldconfig -v
Your paths will be recognized

I *didn't* do the following, but I should have. Luckily the installed math headers and the new local ones were close enough. Perhaps the "--with-mpfr" gcc config options took care of this, but I have also read they aren't 100% reliable. So add the paths to be sure. Assuming you are running bash, add these to your profile:

export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local

Here is my build:

In gcc source directory, mkdir objdir, cd objdir, then config:

../configure --with-cpu=i686 --enable-shared --enable-threads=posix --with-system-zlib --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local

From further reading, next time I may do this (as these extra options are very common in full builds I have googled):

../configure --with-cpu=i686 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local

Full build completed without errors.

Caveat!

I haven't run make check nor tested the build, since it is late. Plan on doing so tomorrow. I'm posting because I got it to work without errors, and maybe you want to replicate it so we can compare notes. Hope this helps!

-Brian

 

by: brianverrePosted on 2009-04-08 at 21:10:14ID: 24103960

I made a mistake in the above documentation. When editing "/etc/ld.so.conf" the line I actually had added was "/usr/local/lib", not "/usr/local". The latter may actually work, but I haven't tested it.

On further reflection, updating LD_LIBRARY_PATH like I did will affect any future builds, overriding the CentOS libraries with the newer local ones. I'm not sure if runtime executables will now use the local libraries, but I suspect this is a link time only setting. Maybe someone can comment.

Also, I want to be clear that I did not update glibc, binutils, or anything else from standard CentOS 5.2 releases. The only updates were the latest MPFR and GMP libraries from source provided by the respective homepages.

TESTING:
With the above instructions, I could not run "make -k check" just yet.

I had to "yum install dejagnu tcl" to get the appropriate testing frameworks from CentOS repositories.

Running "make -k check" resulted in 4 unexpected "gcc" failures, which thankfully turn out to have been simple out of memory errors on "gcc.c-torture/compile/limits-structnest.c" (a recursive test). The machine for this build is a dual core AMD with only 1 GB ram. Available memory ran out, and the kernel killed those compile processes.

This thread confirms that the structnest failures are a possible GCC bug, and don't affect code generation: http://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg220061.html

Next, "libmudflap" had 5 unexpected failures, all on "pass41-frag.cxx" execution test under various optimizations.

Checking the official GCC build statistics page (http://gcc.gnu.org/gcc-4.3/buildstat.html) confirms that this commonly happens to the i686-pc-linux-gnu target under 4.3.x. From what I've been able to find, this is an 'acceptable' test suite failure.

INSTALLING:
Under CentOS, the CC env variable seems to be empty. So I executed "export CC=/usr/local/bin/gcc"

Caveat: I've run into a minor snag. While I feel I was correct in suggesting not to overwrite the CentOS GCC, building GCC 4.3.3 with defaulting to /usr/local presents an issue you will have to consider.

The default CentOS PATH has /usr/local/bin preceding /usr/bin, so by default any use of GCC will be your new version, not the CentOS GCC compiler. This may not be what you want.

Instead, you may want to build GCC in /usr/local/gcc433. Then, you would set the GCC 'configure' prefix to that directory.

To use the new compiler:

export PATH=/usr/local/gcc433/bin:$PATH
export CC=/usr/local/gcc433/bin/gcc

Then, when you are done using the new GCC install, and want to revert to the system GCC, simply remove gcc433 from PATH and reset CC to CentOS default. Switch back whenever you wish.

Let me know this works for you. For now, it looks like I have a working GCC 4.3.3 on CentOS 5.2 (latest).

 

by: JimMeadPosted on 2009-04-17 at 09:39:07ID: 24169589

I am not sure why, but when I installed the preview version of GCC 4.3 by doing

yum install gcc43
yum install gcc43-c++

And doing
export CC_FOR_BUILD="gcc43"
../configure --prefix=/usr --enable-threads=posix
make
make -k check
make install

Almost everything seens to test perfectly, with the exception of  "libmudflap" which had several of errors, and one unexpected pass, although I cannot remember what lib that occurred in (is an XPASS good or bad? surely a pass is good or not whether it is expected or not?)

I am not sure why upgrading from GCC 4.1.2 20080704 to the preview GCC 4.3.2 20081007 would allow me to build GCC 4.3.3 without problems, but it seems to be working OK so far as I have used the new install to build MySQL and PHP with Core2 optimizations and they both seem to be working OK so far, although I have yet to put any real presure on them.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...