Avatar of JimMead
JimMeadFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Updating GCC on Centos 5.2

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

Open in new window

SoftwareLinux Distributions

Avatar of undefined
Last Comment
JimMead
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

I suspect the answer to the problem will reside in your config.log file.
Could you post that please.
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Sure, here you go.

config.log
SOLUTION
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

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
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

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)
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

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
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

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

Mark
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

make check didnt make it to the end.
13 fails (including the 8 previously mentioned) and 1 unexpected pass.
Full log attached.

gcc-term.zip
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of dfk
dfk
Flag of United Kingdom of Great Britain and Northern Ireland image

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
SOLUTION
Avatar of brianverre
brianverre

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of brianverre
brianverre

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
SOLUTION
Avatar of brianverre
brianverre

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
Avatar of JimMead
JimMead
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Software
Software

Software is any set of instructions that directs a computer to perform specific tasks or operations. Computer software consists of programs, libraries and related non-executable data (such as documentation). Computer software is non-tangible, contrasted with computer hardware, which is the physical component of computers. Software written in a machine language is known as "machine code". However, in practice, software is usually written in high-level programming languages than machine language. High-level languages are translated into machine language using a compiler or interpreter or a combination of the two.

43K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo