# [SOLVED] Kernel compilation issue

## tylerd75

I'm trying to compile a new kernel (gentoo-sources, kernel 2.6.30-gentoo-r7), although I have tried compiling an earlier release as well (also failed)...

This is during the kernel compilation on a clean install from the latest Gentoo-Minimal CD.

It fails every time with these errors:

```
 (chroot) livecd linux # make

  CHK     include/linux/version.h

  CHK     include/linux/utsrelease.h

  SYMLINK include/asm -> include/asm-x86

  CALL    scripts/checksyscalls.sh

  CC      init/main.o

In file included from include/linux/device.h:423,

                 from include/linux/rtc.h:111,

                 from include/linux/efi.h:19,

                 from init/main.c:45:

include/linux/pm_wakeup.h:19: error: stray '\16' in program

include/linux/pm_wakeup.h:19: error: stray '#' in program

include/linux/pm_wakeup.h:19: error: stray '\4' in program

include/linux/pm_wakeup.h:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_LINUX_PM_WAKEUP_H'

In file included from include/linux/device.h:423,

                 from include/linux/rtc.h:111,

                 from include/linux/efi.h:19,

                 from init/main.c:45:

include/linux/pm_wakeup.h:59:23: warning: null character(s) ignored

include/linux/pm_wakeup.h:75:2: error: #endif without #if

In file included from include/linux/skbuff.h:29,

                 from include/linux/netlink.h:157,

                 from include/linux/genetlink.h:5,

                 from include/net/genetlink.h:4,

                 from include/linux/taskstats_kern.h:12,

                 from init/main.c:48:

include/linux/dmaengine.h: In function 'dma_chan_name':

include/linux/dmaengine.h:156: error: implicit declaration of function 'dev_name'

include/linux/dmaengine.h:156: warning: return makes pointer from integer without a cast

make[1]: *** [init/main.o] Error 1

make: *** [init] Error 2

```

I'm trying to compile with this make.conf:

```
CHOST="i686-pc-linux-gnu"

CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j5"

#USE="-X dbus hal dvd cdr -alsa -ipv6 mmx sse sse2"

USE="-ipv6 -X"

```

My computer has an Intel Q6600 Quadcore CPU (thus the -j5).  This will be a pure x86 environment, as I only have 2GB of RAM.

I can't seem to figure out what I should remove from the kernel config, as the same config has been used on the same computer before.  I've also tried genkernel with the /proc/config.gz config, but still the same issue.

If I were to guess, I'd say there's something with the make options that is doing this, but I can't seem to see what.

I've also tried -j2, but the same error happens.

Please help me?

Martin

----------

## Jaglover

cd /usr/src/linux

make mrproper

make menuconfig

make

BTW, 64-bit runs great with 2 GB of RAM.

----------

## Zhaozhou

The linux kernel compilation doesn't use your make.conf, just to note.

----------

## tylerd75

Thank you for your replies.

It looks like mrproper did help things a little bit along, but it still fails:

```

(chroot) livecd linux # make

  HOSTLD  scripts/kconfig/conf

scripts/kconfig/conf -s arch/x86/Kconfig

  CHK     include/linux/version.h

  UPD     include/linux/version.h

  CHK     include/linux/utsrelease.h

  UPD     include/linux/utsrelease.h

  SYMLINK include/asm -> include/asm-x86

  CC      kernel/bounds.s

  GEN     include/linux/bounds.h

  CC      arch/x86/kernel/asm-offsets.s

  GEN     include/asm/asm-offsets.h

  CALL    scripts/checksyscalls.sh

  HOSTCC  scripts/genksyms/genksyms.o

  SHIPPED scripts/genksyms/lex.c

  SHIPPED scripts/genksyms/parse.h

  SHIPPED scripts/genksyms/keywords.c

  HOSTCC  scripts/genksyms/lex.o

  SHIPPED scripts/genksyms/parse.c

  HOSTCC  scripts/genksyms/parse.o

  HOSTLD  scripts/genksyms/genksyms

  CC      scripts/mod/empty.o

  HOSTCC  scripts/mod/mk_elfconfig

  MKELF   scripts/mod/elfconfig.h

  HOSTCC  scripts/mod/file2alias.o

  HOSTCC  scripts/mod/modpost.o

  HOSTCC  scripts/mod/sumversion.o

  HOSTLD  scripts/mod/modpost

  HOSTCC  scripts/kallsyms

  HOSTCC  scripts/pnmtologo

  HOSTCC  scripts/conmakehash

  HOSTCC  scripts/bin2c

  CC      init/main.o

In file included from include/linux/device.h:423,

                 from include/linux/rtc.h:111,

                 from include/linux/efi.h:19,

                 from init/main.c:45:

include/linux/pm_wakeup.h:19: error: stray '\16' in program

include/linux/pm_wakeup.h:19: error: stray '#' in program

include/linux/pm_wakeup.h:19: error: stray '\4' in program

include/linux/pm_wakeup.h:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_LINUX_PM_WAKEUP_H'

In file included from include/linux/device.h:423,

                 from include/linux/rtc.h:111,

                 from include/linux/efi.h:19,

                 from init/main.c:45:

include/linux/pm_wakeup.h:59:23: warning: null character(s) ignored

include/linux/pm_wakeup.h:75:2: error: #endif without #if

In file included from include/linux/skbuff.h:29,

                 from include/linux/netlink.h:157,

                 from include/linux/genetlink.h:5,

                 from include/net/genetlink.h:4,

                 from include/linux/taskstats_kern.h:12,

                 from init/main.c:48:

include/linux/dmaengine.h: In function 'dma_chan_name':

include/linux/dmaengine.h:156: error: implicit declaration of function 'dev_name'

include/linux/dmaengine.h:156: warning: return makes pointer from integer without a cast

make[1]: *** [init/main.o] Error 1

make: *** [init] Error 2

```

I used the /proc/config.gz from the minimal CD (I didn't change any thing in it), and it still fails with the exact same errors!?

----------

## Jaglover

 *Quote:*   

> I used the /proc/config.gz from the minimal CD (I didn't change any thing in it), and it still fails with the exact same errors!?

 

You are supposed to generate new .config by yourself, not to copy over .config from some other kernel. It doesn't work like that, even make oldconfig is very limited help and can cause trouble when moving from one kernel version to another.

----------

## Zhaozhou

 *Jaglover wrote:*   

>  *Quote:*   I used the /proc/config.gz from the minimal CD (I didn't change any thing in it), and it still fails with the exact same errors!? 
> 
> You are supposed to generate new .config by yourself, not to copy over .config from some other kernel. It doesn't work like that, even make oldconfig is very limited help and can cause trouble when moving from one kernel version to another.

 

Granted, kernel should still compile, shouldn't it?

----------

## tylerd75

I know using an old kernel config can cause problems.

But the /proc/config.gz (from the Minimal CD) uses the latest kernel in gentoo-sources.  Which means the kernel config is for the same kernel as I'm using (2.6.30-gentoo-r7).

No matter if I use my old kernel .config (for an earlier kernel, 2.6.29 if I'm not mistaken) or the /proc/config.gz from the install-x86-minimal-20091020.iso, the compilation always fails.

The make procedure seems to have some problems in the pm_wakeup.h file?

```

include/linux/pm_wakeup.h:19: error: stray '\16' in program 

include/linux/pm_wakeup.h:19: error: stray '#' in program 

include/linux/pm_wakeup.h:19: error: stray '\4' in program 

include/linux/pm_wakeup.h:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_LINUX_PM_WAKEUP_H'

```

Is there a way to exclude this from the kernel config?  I just can't seem to find what option to remove, although it looks like it has something to do with the ACPI settings?

----------

## NeddySeagoon

tylerd75,

The errors mean that the file include/linux/pm_wakeup.h is corrupt at line 19. 

The kernel may be corrupt at other places too.

Remove the kernel tree from /usr/src - save the .config if you want to.

Remove the kernel tarball from /usr/portage/distfiles

emerge the kernel again.  It will fetch a new copy of the tarball

----------

## tylerd75

Thank you!  That seems to have helped, although it still fails.

The reason I reinstall from scratch on this PC is that I thought the old HDD was failing, as I had file corruptions all over the place.

I bought a new HD and tried installing.  Obviously the corruptions are still happening.

Any ideas as to what can cause this?

On my previous install I moved my RAM from Channel 0 to channel 1 (changed RAM slots), which seemed to help, but  I'm thinking there could be some fault on one of my RAM sticks/slots.  Could file corruption be a symptom of bad RAM?

----------

## NeddySeagoon

tylerd75,

File corruption can be caused by almost anything.

Boot a CD and run the memtest86 option.

Errors at the same address may indicate RAM errors, random errors indicate other issues.

----------

## tylerd75

Thank god!  I seem to have a problem with one of my two RAM sticks.  48000 errors in the first 10 sec. of memtest86...

The other one seems fine, and the RAM slots are obviously not the problem.

Thank you for all the input!  I consider this problem to be solved!

----------

