Sure, here you go.
Main Topics
Browse All TopicsHi,
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
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
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.
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.
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.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
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.
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
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.
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
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
../../gcc/expr.c:4567: warning: cast discards qualifiers from pointer target type
../../../libjava/interpret
../../../libjava/interpret
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)
Build has completed and I am currently running the check, unfortunately I have 8 fails so far.
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
FAIL: gcc.dg/torture/builtin-mat
Attached log, zipped as it is fairly large.
I will follow up with the complete log when the check is complete.
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
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.
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_
export CPLUS_INCLUDE_PATH=$CPLUS_
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-except
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
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/lim
This thread confirms that the structnest failures are a possible GCC bug, and don't affect code generation: http://www.mail-archive.co
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.
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
export CC=/usr/local/gcc433/bin/g
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).
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"
../con
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.
Business Accounts
Answer for Membership
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.