Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"Internal compiler error": Hardware & faulty / bad RAM
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Retired Dev
Retired Dev

Joined: 21 Dec 2004
Posts: 1129
Location: Germany

PostPosted: Thu Jul 20, 2006 9:47 pm    Post subject: "Internal compiler error": Hardware & faulty / Reply with quote

"Internal compiler error" and how to analyse it - Hardware & faulty / bad RAM

Version history:
  • 20. 06. 2006 - Initial revision
  • 21. 06. 2006 - Added a reference to tuam's patch for ck-sources.

Lately, I've seen quite a lot of "internal compiler errors" and instead of using the same text block all the time, I decided to post some information on how to analyse them.

A typical "internal compiler errors" looks like this:

internal compiler error:Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:> for instructions
The bug is not reproducible, so it's most likely a hardware or OS problem.

Take special note of the statement that the bug is not reproducable. This usually means it's not your compiler's fault.

Next steps:

You should try to emerge the package that failed before again and see if it fails at the same point. (It usually doesn't.)
If it fails at another point with a similar error message, you might have a hardware problem.

Step 1 - Check your RAM

First of all, test your RAM using sys-apps/memtest86 which can be found on recent Gentoo installation CDs (at least from 2005.0 on). If you use a Gentoo CD, boot from it and press <F1> to see the kernels. There should be "memtest86" among the possible choices. Boot that.
memtest86 will run for several hours. It would probably be a good idea to start it before you go to bed and check the next day if any errors were found.

If memtest86 found errors, you basically have two possible courses of action:

  1. Replace the defective RAM. This is what I recommend.
  2. Use the BadRAM kernel patch. This is what I do for one of my machines.

If you want to try the BadRAM patch, here's a list of what to do (I'll post more specific instructions if need be. Keep in mind, though, that if these instructions seem to complicated you might want to buy new RAM instead.):

  1. Check which kernel versions are currently supported by the BadRAM kernel patch. tuam currently kindly provides the BadRAM patches for several sys-kernel/ck-sources. cf. the next post in this thread.
  2. Emerge a compatible kernel and download the patch from the URL.
  3. Patch the kernel. How to do that is described in the kernel howto.
  4. Configure and compile the kernel and its modules. This is desribed in the Gentoo Handbook here.
  5. Use memtest86 again to find the so-called BadRAM pattern. After memtest86 has started, press "c", "5", "2", "0". Then wait till the "badram=" line(s) start to appear. Write those down exactly as they are. Do not make any mistake. The badram lines will be identical but may be repeated a few times.
  6. Boot into your system again and configure your bootlader for the new kernel including the pattern you got in the previous step.
  7. Install the new kernel.
  8. Reboot and check for a line like this:
    Memory: 187568k/196544k available (2562k kernel code, 6396k reserved, 1652k data, 144k init, 0k highmem, 2048k BadRAM)

If all went well so far, you should be fine - for now. Faulty RAM can get worse over time so be prepared.

A good tests to see if there are still RAM problems would be to compile a complete Linux kernel from scratch.

Step 2 - Check for other hardware problems

Other possible causes for "internal compiler errors" include overheating of
  • motherboard
  • memory
  • CPU

Motherboard and CPU temperatures can most easily be checked using sys-apps/lm_sensors
It's (currently) beyond the scope of this document to describe how to use lm_sensors but you'll find a good QuickStart document here.

Using lm_sensors you can check the temperature of your CPU (and usually your motherboard as well) during compilation and see if it gets too hot. (The definition of "too hot" is dependent on your CPU and I currently don't have any tables on this subject.) As a rule of thumb I would really start worrying if the temperature rises above 90°C.

Note on overclocking: If you overclocked any component of your system, anything can happen. Simply don't do it.

To check for other hardware problems, you can use either of the following packages to perform a general torture test of your hardware:

Be warned, though, that these programs will really stress your system. Here's the disclaimer from the cpuburn site:

*** WARNING *** This program is designed to heavily load CPU chips. Undercooled, overclocked or otherwise weak systems may fail causing data loss (filesystem corruption) and possibly permanent damage to electronic components. Nor will it catch all flaws.


I cannot stress (sic!) this warning enough.

Furthermore, even temporary power spikes can cause "internal compiler errors". (I don't really know how to check for those. If you know, dear reader, please post about it and I'll update this post.)

If you have any additions, comments, etc. you would like to see here, please let me know.
If you feel the issues discussed in this thread have been resolved, please add a "[Solved]" to the subject of your original posting.

Last edited by Philantrop on Fri Jul 21, 2006 7:16 pm; edited 2 times in total
Back to top
View user's profile Send private message

Joined: 04 May 2004
Posts: 765
Location: CGN, Germany

PostPosted: Fri Jul 21, 2006 6:35 am    Post subject: Reply with quote

I took the hard way to patch BadRAM into the current ck-sources (I took the harder way currupting my ext3 partition twice because of RAM glitches...). If anybody is interested, you can download this patch from my homepage. Apply it with
# cd /usr/src/linux
patch -p 1 < /path/to/patchfile

I will update the patch as I update my kernel. Currently, it works with


Logic clearly dictates that the needs of the many outweigh the needs of the few. - Spock
The needs of the one outweigh the needs of the many. - Kirk
I refuse to let arithmetic decide questions like that. - Picard
Back to top
View user's profile Send private message

Joined: 21 Jul 2006
Posts: 1
Location: Netherlands

PostPosted: Fri Jul 21, 2006 1:08 pm    Post subject: Other occurrences of bad RAM Reply with quote

In addition to the problem patterns reportesd above, my original experience (I am the author of the BadRAM patch) were single characters that had changed in source files (!) during compilation. The compilation from scratch of a complete Linux kernel is usually a good test to see if there are (still) memory problems.

Daniel Peters wrote that he was keeping a separate BadRAM-for-Gentoo page, which I consider a sound approach. There are too many distributions to keep track of them on the central BadRAM page, so one that follows it is best left under the distribution's control.

If anyone has the patience, s/he is welcome to try inclusion in the main kernel sources. After some discussion that led nowhere I have decided to spend my time differently.

For reference's sake, the central site for BadRAM, including an RSS feed to follow new updates on it, is:

Back to top
View user's profile Send private message

Joined: 25 Feb 2004
Posts: 404

PostPosted: Sat Jul 22, 2006 10:22 am    Post subject: Reply with quote

Running out of resources can also cause these errors. What I've seen"
1) Not enough RAM, usually anything with 80Mib or lower needs 200+ meg of swap. 96 meg seems to compile most things
2) Not enough CPU cycles. Don't even think about compiling if you have anything less than 233, then go compile via distcc or something. The lowest I have seen successfully is 120 Mhz.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum