# Random crashes during compilation



## Oxyd (Dec 20, 2008)

Hi,

I installed FreeBSD 7.0 a few days ago, but when I try to do something intensive like kernel compilation, I get random crashes -- most often Internal Compiler Error: Segmentation Fault.

Now, this is usually a sign of some sort of hardware problem.  The only thing that puzzles me is that my Linux installation on the same box can compile away for hours without a single ICE or anything of that sort.  I tried the usual: checking RAM, underclocking CPU, cleaning the dust from the case, twiddling with BIOS settings, unplugging almost everything I don't necessarily need, and checking the disk.  None of these helped in any way.

So I'm wondering if this could perhaps be a software error after all -- FreeBSD is the only OS that's having this kind of problems on this hardware.  Perhaps it's just some driver misbehaving that could easily be fixed by changing its settings or something.

The box is an AMD Athlon 64 3000+ on M2NPV-MX motherboard with two 512 MB Kingston DDRAM sticks, two PATA HDDs and nVidia GeForce 7300 GT.  It's a 32-bit installation so that I can have nVidia graphics drivers even though the CPU is 64-bit.

Anyway, I'd love to hear some suggestions -- are there any known problems with that set of hardware?  Any tips on system settings that could help tracking the problem down?  I'm really out of ideas what to try with the hardware itself...


----------



## SaveTheRbtz (Dec 20, 2008)

# cat /etc/make.conf


----------



## Oxyd (Dec 20, 2008)

SaveTheRbtz said:
			
		

> # cat /etc/make.conf



I don't have that file -- I didn't mess with compilation flags at all.


----------



## brd@ (Dec 20, 2008)

Try running memtest86 on the machine, I have seen where FreeBSD is much more picky about the memory in a machine.

http://www.memtest86.com/memtest86-3.4a.iso.gz


----------



## papanyanz (Aug 4, 2009)

I have SAME problem - only when compilink kernel. After "make" it crashes 4-5 times (same way),but RANDOMLY (source is ok,it fails every time compiling different files). Only thing that helps - runnung "make" again (not cleaning dir,etc) continues build from that point - so finally it can be completed (i don't know - if this is very BAD way to do such things).
I'm running on old PIII AMD Duron 800MHZ with 384MB SDRAM (to be honest - cpu was overclocked to 921MHz, but when i turned it back - it doesn't help) FreeBSD 7.2. 
I tried to run in bash instead of csh - the same. I even tried to set "sysctl kern.maxfiles=65000" (ever thinked about this?) - the same.
is there way to try compile with an other compiler ? Would system run after it ?
And second - why application can run long (uptime = 10hours on my desktop) without any "fault" but compiler fails every 10 minutes ?
it's important for me to complete resolution of this problem.
And again one question - when compiling kernel - i can set cpu tu 686, but i don't know howto enable features like 3dnow,mmx (thereis several lines on console when running make - someting like tish"cc ........ --mno-mmx --mno-3dnow ... --mNO-OTHER_THINGS.... /../XXX.c")
Thanks


----------



## Oxyd (Aug 4, 2009)

Oh, I didn't really expect anyone to revive this thread.  But I sorted it out already, and can happily compile away for hours on end now.

My problem was -- surprise! -- faulty CPU.  More concretely, my L2 cache was bad -- it was ECC checked, so I guess about 90% of the time, the CPU corrected the invalid data from the cache, but the remaining 10% caused these crashes.  I got suspicious that my CPU may be faulty when I saw lots of messages like "Machine check events logged" in dmesg on my previous Debian.  (I still wonder how it managed to run on a failed CPU for months without problems...)  I replaced the CPU and all is working now.

I can't tell you if this is your case too.  From what I read CPU failures are rather rare, but if memtest turns up nothing already, I guess it can't hurt to try and diagnose the CPU (and its caches) somehow.


----------



## SirDice (Aug 4, 2009)

Good you've solved it. And thanks for sharing the solution 




			
				papanyanz said:
			
		

> And second - why application can run long (uptime = 10hours on my desktop) without any "fault" but compiler fails every 10 minutes ?


This is simply because compiling is a very intensive process that uses a lot of memory, processor power and I/O. Especially when building world or the kernel.

Since it's a rather old computer, check if the temperature is still ok (fans still running and clean? etc). Compiling tends to heat up pretty much everything and this might be the cause of the crashes.


----------



## papanyanz (Aug 8, 2009)

I've solved problem too - just to downgrade RAM bus frequency (it was running at maximum speed (but allowed)). And second thing - some errors disappeared after it (like checksum errors when trying to install apps from packages - what is interesting ,that these errors were not RANDOM - for examples gnome-screensaver package ALWAYS caused error - others were working fine...)

Never minded that hardware can do such  a STRANGE thing.
I'll be carefull next time.
Thanks to all.


----------



## fender0107401 (Aug 8, 2009)

Interesting, very very interesting.

Thanks everyone for the sharing and discussion.


----------

