LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-14-2009, 11:42 AM   #1
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Rep: Reputation: 15
What version of GCC do you use?


Hi all,

I am starting a new Linux project in C++, and i was wondering what GCC version to use.
I was hoping people would share their thoughts about which GCC version is best to use in terms of stability, performance, portability, compliance with language extension, etc.
Do you have a specific version you use for your work and prefer to stay with it, or do you like to use the latest available release (or even development versions)? When is it a good time to upgrade to a newer version?

TIA.
 
Old 06-15-2009, 11:31 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
4.3.3
 
Old 06-15-2009, 12:39 PM   #3
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,083

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
Quote:
Originally Posted by Sergei Steshenko View Post
4.3.3
Any particular reason you prefer it? Or it is just what you happen to use?

Quote:
Originally Posted by fuzzyBuzz View Post
I am starting a new Linux project in C++
32 bit x86 or x86_64? I think that might affect the choice of compiler version.

What kind of project also might affect the choice.

Do you really want to select a different version than the default for your Linux distribution? GCC makes it pretty easy to install and use a different version than the distribution default and/or have multiple versions installed and usable on one Linux system. But that isn't totally trivial, so I wouldn't do so without a reason.

Currently I use GCC heavily only for x86_64 Linux. I also use a closed source compiler from Intel heavily on all four combinations of Windows/Linux and 32/64 bit. On 32 bit GCC is much worse than the Intel compiler. On 64 bit that comparison is more complicated and no really clear winner. I expect you need an open source compiler, so even in 32 bit you're stuck with GCC.

I mainly use GCC 4.3.2 and I'm pretty happy with it. I also use GCC 4.1.2 and did a fair about of playing with GCC 4.4.0.

I do a moderate amount of profiling with Oprofile and a moderate amount of debugging. My source code has deep templating and deep inlining. The underlying tools that read the debugging info (for either profiling or debugging) get very confused. They get a LOT more confused by the GCC 4.3.2 generated debug info than the GCC 4.1.2 generated debug info, even in places where the generated asm code is the same. But I don't know if that is really a 4.3.2 vs. 4.1.2 difference or something uniquely weird about my source code or something wrong in the way I built binutils.

I also use OpenMP, which is supported by 4.3.2 and not by 4.1.2.

I'm trying to learn various optimizer hints because performance is very important in my code. I noticed some optimizer hints work in 4.4.0 that don't work in 4.3.2. I also noticed some optimizer hints supposedly present in 4.4.0 that I really want to use, but they don't actually work. I haven't had the time to follow up as much as I should on that kind of investigation. Clearly there is continuing improvement in the support of optimizer hints. That matters a lot to me and may justify moving closer to the cutting edge (or bleeding edge) version. But I don't know enough to make that decision well myself much less advise you.

Last edited by johnsfine; 06-15-2009 at 04:45 PM.
 
Old 06-15-2009, 03:09 PM   #4
noctilucent
Member
 
Registered: Jun 2009
Distribution: slackware
Posts: 123

Rep: Reputation: 25
I'd rather worry more about correctness, clarity, cleanliness, stability, security, portability and eventually algorithm optimization [speed] at this point [or, heck, indeed - just getting the damned thing to work in the first place] rather than optimization by means of the compiler.. or using features which depend on a certain version of a certain compiler for a certain architecture. On Linux I just use whichever compiler the distribution in question ships at that point in time [this machine: gcc 4.4.0]
 
Old 06-15-2009, 03:25 PM   #5
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,083

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
Quote:
Originally Posted by johnsfine View Post
Do you really want to select a different version than the default for your Linux distribution?
Maybe I buried that too deep in my first long post.

Quote:
Originally Posted by noctilucent View Post
On Linux I just use whichever compiler the distribution in question ships at that point in time
For most situations that is the right answer to the question of this thread.

That is very much not my answer at home, because I'm very interested in playing with compiler behavior. At home, I'm as likely to be using the application source code to see how the compiler behaves as using the compiler to build the application.

It is also very much not my answer at work, because we have several people working on a closed source product and several Linux computers (not all the same version of Linux) and we need to have consistent (behavior and performance) output from compilers. Until we explicitly qualify a new compiler, all behavior and performance differences should be attributable to our code changes and never to which Linux server some developer chose to run the build process on. (Before I became involved in that decision process here, build details did depend heavily on which server was used for the build. That was an ongoing nightmare until I fixed it.)

But in both those cases, what is right for me is not likely right for the OP. So you need a reason to deviate from the obvious answer of "whichever compiler the distribution in question ships".

Last edited by johnsfine; 06-15-2009 at 03:27 PM.
 
Old 06-15-2009, 04:39 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by johnsfine View Post
Any particular reason you prefer it? Or it is just what you happen to use?

...

The last I built - I routinely build 'gcc', and I have a number of versions.

Seems good enough.

I'm reluctant to build 4.4.0, but will probably build 4.4.1 - let's give the developers a chance to fix some bugs.

Last edited by Sergei Steshenko; 06-15-2009 at 09:38 PM.
 
Old 06-16-2009, 01:01 PM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
just use the one installed on your system.
 
  


Reply

Tags
gcc, version


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding distribution + kernel version + gcc version + glib version. JCipriani Linux - General 8 04-19-2008 02:54 PM
Installed GCC version doesn't match the version the kernel was compiled with AlucardZero Linux - Software 2 02-07-2008 10:24 AM
redhat fedora gcc version (compiled for 2.4.20) doesn't match kernel version 2.4.22 start1000 Linux - Software 0 03-16-2004 08:17 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM
Sample Driver Module incompatibility with Kernel version (or gcc version) jvs Linux - General 1 06-07-2002 01:40 AM


All times are GMT -5. The time now is 01:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration