# GCC error on building firmware for linux-3.7.10-gentoo-r1

## MOROZ_FX

when i run make a get this.

```

linux-3.7.10-gentoo-r1 # LANG=EN make

make[1]: Nothing to be done for `all'.

make[1]: Nothing to be done for `relocs'.

  CHK     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  CALL    scripts/checksyscalls.sh

  CHK     include/generated/compile.h

make[3]: `arch/x86/realmode/rm/realmode.bin' is up to date.

  AS      firmware//lib/firmware/.gen.o

gcc: internal compiler error: Killed (program as)

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://bugs.gentoo.org/> for instructions.

make[1]: *** [firmware//lib/firmware/.gen.o] Error 4

make: *** [firmware] Error 2

```

gcc config

```
LANG=EN gcc -v

Using built-in specs.

COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc

COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper

Target: x86_64-pc-linux-gnu

Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.11, pie-0.5.2'

Thread model: posix

gcc version 4.6.3 (Gentoo 4.6.3 p1.11, pie-0.5.2)
```

----------

## eccerr0r

Is it repeatable at the same spot?

Did you run out of memory?  Was there a dmesg report about it?

----------

## MOROZ_FX

Yes it is repeatable

dmesg output is

```

[  192.527200] sshd invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0

[  192.527202] sshd cpuset=/ mems_allowed=0

[  192.527205] Pid: 4390, comm: sshd Not tainted 3.6.11-gentoo #2

[  192.527206] Call Trace:

[  192.527212]  [<ffffffff815a73ce>] ? dump_header.isra.9+0x6a/0x191

[  192.527216]  [<ffffffff8126bff4>] ? ___ratelimit+0x94/0x100

[  192.527218]  [<ffffffff810aaf66>] ? oom_kill_process+0x266/0x3a0

[  192.527221]  [<ffffffff8103ed52>] ? has_ns_capability_noaudit+0x12/0x20

[  192.527222]  [<ffffffff810ab6c5>] ? out_of_memory+0x465/0x4c0

[  192.527224]  [<ffffffff810aff62>] ? __alloc_pages_nodemask+0xa02/0xa20

[  192.527226]  [<ffffffff810df4e5>] ? alloc_pages_current+0xb5/0x130

[  192.527229]  [<ffffffff810a9edf>] ? filemap_fault+0x1af/0x470

[  192.527231]  [<ffffffff810c436f>] ? __do_fault+0x6f/0x490

[  192.527233]  [<ffffffff810c6eca>] ? handle_pte_fault+0x8a/0x810

[  192.527234]  [<ffffffff810c89fe>] ? handle_mm_fault+0x29e/0x340

[  192.527236]  [<ffffffff8102a1cf>] ? do_page_fault+0x11f/0x420

[  192.527238]  [<ffffffff810ef70e>] ? vfs_read+0x13e/0x170

[  192.527240]  [<ffffffff815af12f>] ? page_fault+0x1f/0x30

[  192.527240] Mem-Info:

[  192.527241] Node 0 DMA per-cpu:

[  192.527243] CPU    0: hi:    0, btch:   1 usd:   0

[  192.527244] CPU    1: hi:    0, btch:   1 usd:   0

[  192.527244] Node 0 DMA32 per-cpu:

[  192.527245] CPU    0: hi:  186, btch:  31 usd:   0

[  192.527246] CPU    1: hi:  186, btch:  31 usd:   0

[  192.527246] Node 0 Normal per-cpu:

[  192.527247] CPU    0: hi:   90, btch:  15 usd:   0

[  192.527248] CPU    1: hi:   90, btch:  15 usd:   0

[  192.527251] active_anon:693243 inactive_anon:154253 isolated_anon:0

 active_file:28 inactive_file:81 isolated_file:0

 unevictable:0 dirty:0 writeback:1430 unstable:0

 free:20641 slab_reclaimable:1099 slab_unreclaimable:2347

 mapped:5 shmem:3 pagetables:4069 bounce:0

[  192.527252] Node 0 DMA free:14268kB min:292kB low:364kB high:436kB active_anon:720kB inactive_anon:896kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15632kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:4kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:224 all_unreclaimable? yes

[  192.527255] lowmem_reserve[]: 0 3245 3497 3497

[  192.527257] Node 0 DMA32 free:63448kB min:62440kB low:78048kB high:93660kB active_anon:2695544kB inactive_anon:539248kB active_file:40kB inactive_file:96kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:3323072kB mlocked:0kB dirty:0kB writeback:5720kB mapped:8kB shmem:0kB slab_reclaimable:324kB slab_unreclaimable:592kB kernel_stack:8kB pagetables:14140kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:29758 all_unreclaimable? yes

[  192.527261] lowmem_reserve[]: 0 0 252 252

[  192.527262] Node 0 Normal free:4848kB min:4848kB low:6060kB high:7272kB active_anon:76708kB inactive_anon:76868kB active_file:72kB inactive_file:228kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:258048kB mlocked:0kB dirty:0kB writeback:0kB mapped:12kB shmem:12kB slab_reclaimable:4072kB slab_unreclaimable:8796kB kernel_stack:752kB pagetables:2132kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:35107 all_unreclaimable? yes

[  192.527265] lowmem_reserve[]: 0 0 0 0

[  192.527267] Node 0 DMA: 1*4kB 1*8kB 1*16kB 1*32kB 2*64kB 2*128kB 2*256kB 0*512kB 1*1024kB 2*2048kB 2*4096kB = 14268kB

[  192.527271] Node 0 DMA32: 212*4kB 69*8kB 50*16kB 15*32kB 9*64kB 3*128kB 4*256kB 3*512kB 2*1024kB 3*2048kB 12*4096kB = 63544kB

[  192.527275] Node 0 Normal: 175*4kB 18*8kB 0*16kB 1*32kB 1*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 4908kB

[  192.527279] 7450 total pagecache pages

[  192.527280] 7301 pages in swap cache

[  192.527281] Swap cache stats: add 1000081, delete 992780, find 13/17

[  192.527281] Free swap  = 0kB

[  192.527282] Total swap = 4000148kB

[  192.539320] 917488 pages RAM

[  192.539321] 33954 pages reserved

[  192.539321] 204 pages shared

[  192.539322] 862263 pages non-shared

[  192.539323] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name

[  192.539330] [ 1075]     0  1075     9004        1      22      116         -1000 udevd

[  192.539332] [ 1928]     0  1928     1580        3       9       22             0 ifplugd

[  192.539334] [ 2238]     0  2238     6708        0      17       55             0 syslog-ng

[  192.539336] [ 2239]     0  2239    15285       11      36      254             0 syslog-ng

[  192.539337] [ 2254]     0  2254     8337       17      20       95             0 hostapd

[  192.539339] [ 2270]     0  2270    29659       14      16       25             0 cron

[  192.539340] [ 2416]     0  2416     6492       57      15       62             0 pppd

[  192.539341] [ 2452]     0  2452    29669        1      15       44             0 agetty

[  192.539343] [ 2453]     0  2453    29669        1      15       44             0 agetty

[  192.539344] [ 2454]     0  2454    29669        1      15       45             0 agetty

[  192.539346] [ 2455]     0  2455    29669        1      15       45             0 agetty

[  192.539347] [ 2456]     0  2456    29669        1      15       43             0 agetty

[  192.539348] [ 2457]     0  2457    29669        1      15       43             0 agetty

[  192.539350] [ 2667]     0  2667     8008       15      20      103         -1000 sshd

[  192.539351] [ 2678]   101  2678     6536        6      15      134             0 openvpn

[  192.539353] [ 2694]   102  2694     6312     1983      15      258             0 dhcpd

[  192.539354] [ 2699]     0  2699     1583       29       9        0             0 pptp

[  192.539356] [ 2704]     0  2704     1583       30       9        0             0 pptp

[  192.539357] [ 2859]     0  2859    18006      190      41        0             0 sshd

[  192.539358] [ 2864]     0  2864    30541      129      19        0             0 bash

[  192.539360] [ 3321]     0  3321    27776      194      13        0             0 make

[  192.539361] [ 4390]     0  4390    18006      188      40        1             0 sshd

[  192.539362] [ 4611]     0  4611    30541      113      19       15             0 bash

[  192.539363] [ 5282]     0  5282    27708      120      14        0             0 make

[  192.539365] [ 5285]     0  5285    28402       71      14        6             0 sh

[  192.539366] [ 5286]     0  5286    26724        0      11       39             0 gcc

[  192.539368] [ 5289]     0  5289  1838943   836961    3597   998436             0 as

[  192.539369] Out of memory: Kill process 5289 (as) score 946 or sacrifice child

[  192.539370] Killed process 5289 (as) total-vm:7355772kB, anon-rss:3347844kB, file-rss:0kB

```

----------

## chithanh

So you ran out of memory. Add more swap.

----------

## eccerr0r

I do have to say...wow.

```
[  192.527281] Free swap  = 0kB

[  192.527282] Total swap = 4000148kB

[  192.539320] 917488 pages RAM 
```

~ 4GB RAM

~ 4GB swap

???

Something's not right here... Using a huge tmpfs?

----------

## MOROZ_FX

Solved

My fault.

I have a bad habbit to copy .config from the old kernel source to the new one. In this particular case this didn't work.

Configurating kernel from scratch eliminated the problem. Thanks everyone for help.

----------

