/home/shakir

GCC 4 in Gentoo

Posted on 04 Jan, 2006, categorized under Information Insemination



Last weekend I managed to try GCC 4 on my Gentoo box. My inspiron 6000 comes with Pentium M, but with gcc version of <3.4, I can only use pentium3 optimisation flag instead of pentium-m, whic is not very nice. My Pentium M 1.86 outperforms Pentium 4 2.8 (ht) by 40% in a test program compiled with pentium3 (my laptop at that time) and the Pentium 4 desktop compiled the same program without cpu optimisation. Later when we tried it with -march pentium3 and -march pentium4 respectively, my Inspiron 6000 + gentoo was just 3%-5% slower than the Pentium 4 2.8 running SuSe :) That gives the idea that this is not just for fun but might as well give performance benefit at the end. Driven by that, I wish to see if my machine can outperform the much higher clocked Pentium 4 when compiled with gcc 4 and get the pentium-m flag to work.

Methodology:

Currently my gentoo is installed with GCC 3.3.6. With gentoo upgrading the compiler and glibc was easy. First of all, unmask the to be installed gcc and glibc version.

#echo "~sys-devel/gcc-4.0.2 -*" >> /etc/portage/package.keywords #echo "~sys-lib/glibc-2.3.6 -*" >> /etc/portage/package.keywords

Sure, we’ll need to emerge:

#emerge binutils glibc gcc

Next up, choose the gcc version that we would like to use.

To get the listing of available versions:

#gcc-config -l
[1] i686-pc-linux-gnu-3.3.6 *
[2] i686-pc-linux-gnu-3.3.6-hardened
[3] i686-pc-linux-gnu-3.3.6-hardenednopie
[4] i686-pc-linux-gnu-3.3.6-hardenednopiessp
[5] i686-pc-linux-gnu-3.3.6-hardenednossp
[6] i686-pc-linux-gnu-3.4.4
[7] i686-pc-linux-gnu-3.4.4-hardened
[8] i686-pc-linux-gnu-3.4.4-hardenednopie
[9] i686-pc-linux-gnu-3.4.4-hardenednopiessp
[10] i686-pc-linux-gnu-3.4.4-hardenednossp
[11] i686-pc-linux-gnu-4.0.2

The one marked with an asterisk is the one currently used. Now, choose the desired version:

#gcc-config i686-pc-linux-gnu-4.0.2

and then rebuild the whole system..

#emerge -e system && emerge -e world

Don’t forget to also change the cpu type in kernel configuration to pentium-m, and we’re done. Ah yes, do re-compile the kernel..

Results and Discussion:

Many programs failed to compile during the emerge -e world. gcc 4 is more strict when it comes to adhering to the letter of the C/C++ specifications, and that might be the reasons for some kde package and ati-drivers, among many others, failed to compile. As some of the failed to compile packages are essential packages, I chose not to go on with gcc 4.

I need to switch to earlier version of gcc and hope everything to work as normal again. As pentium-m flag works with gcc 3.4 and above, I fall back to gcc 3.4 instead of the original 3.3.6.

#gcc-config i686-pc-linux-gnu-3.4.4
#emerge -e system && emerge -e world

Things compiled flawlessly. I couldn’t find the original program that we used to benchmark my laptop and the other desktop previously, and so I just test if the flag and gcc really boost some speed with glxgears. It managed to get the gears to rotate at 1900+ fps on average, as previously it was only rotating at the average of 1800+ fps. 100 fps (frame per second) increase is not so bad after all.





Looking for something else? Search Google.

No Responses to "GCC 4 in Gentoo"

Comment Form


  • si perda: wah.. boleh kasi need for speed test power skali... boleh layan network race ni...
  • Faiz: wah....harganya berapa?
  • shakir: Hmm, I have no lab and that actually was my living room :D Sure I'll move them to one of my available rooms at home and make it a lab, but that'll be
  • peja: whoaaa..at least u have ur own lab...look interesting!
  • Qing Ru: He looks really cute! Fatherhood must have been quite rewarding :)
  • shakir: Chris: Thanks, I've updated the post.
  • shakir: tak cukup banyak guinea pig yang dah try and comment on the wimax service, and so I'll just wait :D
  • shakir: Vadim: Yup, but I prefer to just install dosbox and play the game rather than re-installing my system with 32 bit Linux :D
  • Vadim: 2shakir: wine doesn't support 64-bit linux. You have to use 32-bit linux if you want to use wine.
  • kevler: yerp ...dalam 2 hari nih jer ..aku dah kesan 2 BMW X6 , kat puchong dan jalan ampang ..giler laa lawa



Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my own personal opinion. Inappropriate comments will be deleted at the authors discretion. All code samples (if any, ever) are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Personal (Blogs) - TOP.ORG