Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 09-21-2006, 01:43 AM   #1
LQ Newbie
Registered: May 2004
Location: Middletown CT
Distribution: Debian Etch (Testing)
Posts: 28

Rep: Reputation: 15
Gcc version for compiling kernel 2.6.18

I'm going to be compiling a 2.6.18 kernel for some new Core Duo 2 machines we got in the lab. I'm reasonably sure the kernel will compile with gcc 3.3 but I was wondering if I should use 4.0 or 4.1? I did a quick search for kernel performance benchmarks, but didn't find much. Anyone case to provide links or personal experience?

Also, even with 2.6.18 there is no Core processor type to select. Currently my 2.6.16 stock Debian kernel detects the processor as an Athlon MP which results in much poorer performance than I know is possible. Which processor type should I select, I'm assuming Pentium III or Pentium M, but would greatly appreciate it if somebody could provide an answer instead of me having to compile everything multiple times and benchmark myself. If nobody has done this, I will post my findings here so they might be of some help to others migrating to Core systems.
Old 10-02-2006, 11:30 AM   #2
Registered: Jun 2006
Posts: 94

Rep: Reputation: 16
It tells you in the Changes file which versions of what to use. Most of the software it refers to has to be the version they list or higher. Except for gcc it recommends that you stick closely to the version they recommend.

Like here is what it says in my Changes for 2.6.8.
The gcc version requirements may vary depending on the type of CPU in your
computer. The next paragraph applies to users of x86 CPUs, but not
necessarily to users of other CPUs. Users of other CPUs should obtain
information about their gcc version requirements from another source.

The recommended compiler for the kernel is gcc 2.95.x (x >= 3), and it
should be used when you need absolute stability. You may use gcc 3.0.x
instead if you wish, although it may cause problems. Later versions of gcc
have not received much testing for Linux kernel compilation, and there are
almost certainly bugs (mainly, but not exclusively, in the kernel) that
will need to be fixed in order to use these compilers.
In any case, using
pgcc instead of plain gcc is just asking for trouble.

The Red Hat gcc 2.96 compiler subtree can also be used to build this tree.
You should ensure you use gcc-2.96-74 or later. gcc-2.96-54 will not build
the kernel correctly.

In addition, please pay attention to compiler optimization. Anything
greater than -O2 may not be wise. Similarly, if you choose to use gcc-2.95.x
or derivatives, be sure not to use -fstrict-aliasing (which, depending on
your version of gcc 2.95.x, may necessitate using -fno-strict-aliasing).
I've compiled 2.4 kernels with gcc version 3.3.5 and never had any problems that I could tell. The system was solid as a rock. However, it's probably better to stick to their recommendation. Afterall, whoever is writing that, is telling us this for a reason. I suspect their reasoning is that the "recommended" gcc version is the one in which they've coded in mind for. There's the possibility for some subtle changes in newer versions of gcc, as well as some unknown bugs that may interact somehow in a manner that may not end up being good. The bottom-line is they're probably telling us all of that because their recommended version is proven and what has been tested against extensively. Other versions of gcc is going into the unknown. May not have problems with some other version, but on the other hand, you might and there isn't really any sort of well tracked and documented testing with them, that I know of. If in doubt, go with the recommendations of the people who have spents many man hours already taking on the headaches for us (kernel devs and/or your distro).

Even though in my case my build went without a hitch, and my system seems rock solid, I still have my reservation about using a non-recommended version of gcc to build with. In the back of my mind I wonder if there is the possibility for there to be some issues that don't make themselve's very known. For instance, features of the kernel being semi-broken in operation that it goes under the radar and allows bad things to creep up. In other words, the very subtle bugs that could be introduced that could have been avoided. This I don't know, but it doesn't seem like it's out of the realm of possibilities to me.

You should check your Changes file to see what they specifically recommend. It may also be a good idea to check and see what your distro recommends if you're compiling a kernel that is their sources. It's actually probably best to follow your distro's recommendation if that is the case. I guess which recommendation to go with is who you put more stock on being more accurate with their facts. However, there may be some "gotchas" that the distro people know about that is specific to their tweaks that may not be an issue to the same version of vanilla kernel.

I just tend to put more stock on distro and the kernel devs recommendations over my own judgement since they've had alot more people testing things than just one person (me).

Last edited by PingFloyd; 10-02-2006 at 11:48 AM.
Old 10-02-2006, 12:27 PM   #3
Registered: Aug 2006
Distribution: Slackware
Posts: 802

Rep: Reputation: 101Reputation: 101
As far as the core selection is concerned, i would just make sure you have smp enabled in your kernel. That should cover your multi-core.
Old 10-02-2006, 06:20 PM   #4
LQ Newbie
Registered: May 2004
Location: Middletown CT
Distribution: Debian Etch (Testing)
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks for the help. However, this is a bit of an old post. I found a good performance benchmark for the Core Duo 2 systems under Linux on LinuxHardware, Basically you use PentiumM for 32-bit and Nocona (Xeon) for 64-bit. The 64-bit performs rather poorly as a result since the two architectures (Netburst Xeon and Core Duo 2) are quite different. However, since 64-bit distros are having problems (Debian's testing lacks working versions of a lot of programs necessary to get a basic desktop), I decided to just run in 32-bit for now.

As far as compiler, 2.95 is the baseline, all new kernels will compile with anything higher. Around 2.6.16 they attempted to phase out 2.95 requiring 3.1 as a baseline and there was a lot of resistance. However, gcc 4.0 has surpassed 3.3.x in terms of optimized running speed (the only thing I really care about). While the early 3.xs were slower than 2.95, 3.3 and later are faster. Debian and other distros have now moved to using 4.0 for their kernels due to performance improvements. 2.95 gives the advantage that the compiling time is less (useful if you have a slow processor), and it has some better space optimizing options (important if you are on an embedded system), and there is a minor stability argument since it has been out longer.

Basically I would say use 2.95 if stability, size, or compile time is much more important than speed. Use 3.3 is stability is very important, but you want running speed too (i.e. a server) and use 4.0 or 4.1 if speed is important and stability is not as much (i.e. a desktop). In my experience 4.1 gives more than enough stability for a desktop. I think after getting the configurational bugs out of my 2.6.18 kernel I only had one crash and that might be due to a PCI card not being properly retained.

The results of my compile with 4.1 were small performance improvements over the statistics on LinuxHardware for like benchmarks I could run. Generally most of my scores were better, though since many of the benchmarks were influenced if not GPU dependent since I have a better card, this may be skewed. The benchmark that comes closest to what they present is my results of 1 minute 32 seconds on my E6700 for the Mencode benchmark.

Last edited by TemplaraPheonix; 10-02-2006 at 06:21 PM.


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
help, gcc version and kernel version mismatch akanitkar Linux - Newbie 1 05-06-2006 07:02 AM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 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
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 10:39 AM.

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