# kgcc and kernel compiling ...

## Kibab

The short version: How do I compile a kernel with kgcc?

The long drawn-out-too-many-details version:

I have recently been experiencing random crashes (instantaneous reboots) so I've started looking at my kernel configuration.  As far as I know, I have only installed two new things since this started happening, neither of which is the cause of the problem.

First, I did a `cat /proc/version` then I noticed that it said the following:

Linux version 2.4.20 (root@(none)) (gcc version 3.2.1) #1 SMP Sun Dec 22 09:12:58 PST 2002

Ok.... gcc version 3.2.1 -- definitely not supported, so I'll look into installing an older version of gcc.

A quick emerge -s gcc reveals kgcc. Oooh, exactly what I need, or so I think.  I'm using the vanilla sources and went in an modified /usr/src/<linux-version>/Makefile so that HOSTCC points to kgcc, good, I thought.  I'm set.  After recompiling the kernel, I thought I would check to see what it said.

strings /usr/src/<linux-version>/vmlinux | grep gcc... only to reveal:

Linux version 2.4.20-r1 (root@main.sys) (gcc version 3.2.1) #3 SMP Thu Jan 2 17:07:59 PST 2003

Ok... it's still compiling with the newer compiler.  I briefly looked through some of the process.  In about half the places it is using gcc and in the other half it's using kgcc.  Ok, now I have a mess!  I looked through the Makefiles and then at /usr/src/<linux-version>/Rules.make to find that they are incrementally changing some things and lo-and-behold, it is using $CC in some places and $CPP in other places.

I went ahead and tried pointing all the obvious references to $HOSTCC and then 95% of it came up as kgcc, but there are still some that don't and, furthermore, I made the problem worse as modules can't be insmoded.

I have gcc-config installed, but it doesn't recognize any profiles and I don't see manpages on it.  What do I do next?

--Kaleb

----------

## Kibab

Ok..... I got the kernel to compile with kgcc.  There were only two entries that had to be changed in the root level Makefile and I missed one of them.  I set HOSTCC, which is required, but I missed CC.  All the other misc rules rely on either one of those.  Then, there is CPP which is $CC -E.  Anway, now it compiles fine with kgcc.  Hopefully that will take care of the reboots.

--Kaleb

----------

## Forge

I'd look to my power supply long before I blamed my kernel compiler.

Are you sure the problem is software and not hardware?

----------

## Kibab

I'm mostly positive it isn't hardware.  I used to have problems with my power supply but I replaced that with a very nice one about 6 months ago.  Ever since then, everything has been extremely stable, even Windows.  Another reason I presume it isn't hardware is that Windows is still extremely stable.  Even over four hours of compiling and doing other miscellaneous things  in Windows doesn't result in a reboot, while in 45 minutes of work this morning under Linux resulted in 3 different reboots.  Two while I was in the middle of things and another while it was just sitting there idle.

I ran through a couple iterations of memtest86 last night and everything passed successfully.  If anyone has suggestions on other programs that I can run to test hardware I would love to hear them.  Unfortunately, all my problems are only happening under Linux; I'd much rather have Windows not working....

--Kaleb

----------

## rac

How many CPUs in your computer?

----------

## Kibab

It has two processors, a Microstar 694D-Pro-AR.

--Kaleb

----------

## Forge

Quite odd. That's a rather unique situation you've gotten into.

Has kgcc helped?

----------

## Kibab

No.  The kernel appears no more stable that it was before I compiled it with kgcc.  The first day it appeared more stable, but then yesterday it rebooted 3 times in a 45 minute period.  Yet, it worked in Windows for 4-6 hours without a problem.  One of the times it rebooted, it was just sitting  in console mode waiting for a login?

--Kaleb

----------

