# Kernel Upgrade Build Problems

## mardin1234

Something very strange has happened to my gentoo install, I can no longer compile any kernel > linux -2.6.10-gentoo-r6.  I can still compile the kernel i'm using now, but nothing newer.  I also tried upgrading the kernel headers, but the compile fails at the exact same point as with the kernel:

```

  SPLIT   include/linux/autoconf.h -> include/config/*

  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/conmakehash

  CHK     include/linux/version.h

  UPD     include/linux/version.h

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

In file included from include/asm/system.h:5,

                 from include/linux/preempt.h:11,

                 from include/linux/spinlock.h:9,

                 from include/linux/capability.h:45,

                 from include/linux/sched.h:7,

                 from arch/i386/kernel/asm-offsets.c:7:

include/linux/kernel.h:10:20: stdarg.h: No such file or directory

In file included from include/asm/system.h:5,

                 from include/linux/preempt.h:11,

                 from include/linux/spinlock.h:9,

                 from include/linux/capability.h:45,

                 from include/linux/sched.h:7,

                 from arch/i386/kernel/asm-offsets.c:7:

include/linux/kernel.h:84: error: syntax error before "va_list"

include/linux/kernel.h:87: error: syntax error before "va_list"

include/linux/kernel.h:90: error: syntax error before "va_list"

include/linux/kernel.h:94: error: syntax error before "va_list"

include/linux/kernel.h:104: error: syntax error before "va_list"

distcc[26526] ERROR: compile arch/i386/kernel/asm-offsets.c on localhost failed

make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1

make: *** [arch/i386/kernel/asm-offsets.s] Error 2

!!! ERROR: sys-kernel/linux-headers-2.6.11-r2 failed.

!!! Function compile_headers, Line 389, Exitcode 2

!!! prepare failed

!!! If you need support, post the topmost build error, NOT this status message.

```

Any ideas?

----------

## dwblas

Which kernel, gentoo-sources, vanilla, etc.  The only thing I can think of is to check for bugs for the type of kernel you are trying to compile.  Also, since in appears that it is a headers problem, check the forum for problems with headers.  Sorry, that's all I have.

----------

## mardin1234

I am using gentoo-sources.  I couldn't see anything in bugzilla or forums to do with this problem....

----------

## dwblas

Here is the same problem via google.  It appears to be a gcc libs installed incorrectly problem.  Have you done revdep-rebuild lately?  Try that first.  If it doesn't work, then try an emerge -e system.  I have never had a problem like this so don't have any specific ideas.

http://www.linuxquestions.org/questions/showthread.php?threadid=339498

http://www.google.com/search?hl=en&lr=&biw=616&q=include%2Flinux%2Fkernel.h%3A+syntax+error+va_list&btnG=Search

----------

## mardin1234

The revdep-rebuild ran fine.  Only one link broken and that was an X11 library, nothing to do with gcc.

I will try and do an emerge -e system again,  I only did that last week, because I was not able to compile xorg-x11.

I'm guessing that the two problems might be related.

----------

## mardin1234

Tried to do the emerge -e system but it fails when it reaches the point that it wants to install the latest kernel headers.

----------

## dwblas

Here is the same problem via google.  It appears to be a gcc libs installed incorrectly problem.  Have you done revdep-rebuild lately?  Try that first.  If it doesn't work, then try an emerge -e system.  I have never had a problem like this so don't have any specific ideas.

http://www.linuxquestions.org/questions/showthread.php?threadid=339498

http://www.google.com/search?hl=en&lr=&biw=616&q=include%2Flinux%2Fkernel.h%3A+syntax+error+va_list&btnG=Search

----------

## dwblas

What does the error message say?  You will probably have to introduce yourself to gcc-config or fix_libtool_files.sh.

----------

## mardin1234

The error message is the same as in original post.

I have tried to run fix_libtool_files.sh 3.3.5 and it fixed a few broken links for imagemagic but nothing substantially important.  I have double checked my gcc-config and it is set to the correct profile.

I then tried to downgrade my gcc to the previous version and I still can't compile the kernel.

Here is a dump of my gcc-config:

```

vanquish include # gcc-config -E

export PATH="/usr/i686-pc-linux-gnu/gcc-bin/3.3.5:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin"

vanquish include # gcc-config -l

[1] i686-pc-linux-gnu-3.3.5 *

[2] i686-pc-linux-gnu-3.3.5-hardened

[3] i686-pc-linux-gnu-3.3.5-hardenednopie

[4] i686-pc-linux-gnu-3.3.5-hardenednopiessp

[5] i686-pc-linux-gnu-3.3.5-hardenednossp

vanquish include # gcc-config -c

i686-pc-linux-gnu-3.3.5

vanquish include # gcc-config -B

/usr/i686-pc-linux-gnu/gcc-bin/3.3.5

vanquish include # gcc-config -L

/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5

vanquish include # gcc-config -X

/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include/g++-v3

```

Any more ideas?

----------

## dwblas

 *Quote:*   

> distcc[26526] ERROR: compile arch/i386/kernel/asm-offsets.c on localhost failed

 

Note the i386.  Are you compiling with a 386 or a 686 architecture?  You probably should do a fix_libtool_files.sh with the -- oldarch parameter equal to i386-pc-linux-gnu.  That is, if you are compiling for a 686 machine.  Also, do the same thing but with i586 just for good measure.  Somehow, during certain types of installs, different archs get installed.  If you are compiling for a 386, I'm not quite sure what to do next.

----------

## mardin1234

Thanks for the reply, but no still have the same problem.  I looked in the kernel sources and they only have i386, not anything higher.   I think architecture only changes for gcc/glibc stuff.  Yeah i'm beginning to think my install is in big trouble....  Funny thing is that everything else (excluding xorg) can compile fine.....

----------

## mardin1234

Just an update:

To check the integrity of my gcc install I compiled a C "Hello World" application with the suposed missing header file:

```

#include <stdarg.h>

#include <stdio.h>

int main(void)

{

  printf("Hello World!\n");

  exit(0);

}

```

It worked fine! what on earth is going on with the kernel build script and my install........

----------

## dwblas

Check to make sure that /etc/make.profile points to /usr/portage/profiles/default-linux/x86/2005.0 or 2005.1, and not to a 2004 or a 2.4 profile.

----------

## dwblas

The only other thing that I can think of is to back up /bin, /sbin, /etc, and anything else you might need; unmerge system, then emerge -e system.  Make sure you have Knoppix handy in case nothing runs and you have to copy the files back.  That will rebuild the system but is not really a solution.

----------

## mardin1234

I'm not too keen on unmerging my system, if it comes to that i'll format and just re-install from scratch to be safe.

Anyway I'm sure it just has to be a simple configuration issue because absolutely everything else on the system emerges fine (providing it does not contain kernel modules)......

I haven't posted my emerge info yet, here it is:

```

vanquish scripts # emerge info

Portage 2.0.51.22-r1 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.10-gentoo-r6 i686)

=================================================================

System uname: 2.6.10-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz

Gentoo Base System version 1.6.12

distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]dev-lang/python:     2.2.3-r5, 2.3.5

sys-apps/sandbox:    1.2.10

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.18-r1

virtual/os-headers:  2.6.8.1-r4

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=pentium4 -mmmx -msse2 -mfpmath=sse"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/lib/jboss /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -pipe -march=pentium4 -mmmx -msse2 -mfpmath=sse"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="ftp://planetmirror.com/pub/gentoo/ ftp://mirror.pacific.net.au/linux/Gentoo"

LANG="en_US"

LC_ALL="en_US"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://monaro/gentoo-portage"

USE="x86 X aalib acpi alsa apache2 avi berkdb bidi bitmap-fonts bonobo cdr crypt cups curl dga divx4linux dts edl eds emboss encode esd evo faac faad fam fbcon flac foomaticdb fortran gd gdbm ggi gif gimpprint gnome gnutls gphoto2 gpm gstreamer gtk gtk+ gtk2 gtkhtml guile hal hald howl icu imagemagick imap imlib ipv6 java javascript jikes jpeg junit kerberos krb4 ldap libcaca libg++ libwww live lzo mad mikmod mmx motif mozilla mp3 mpeg mythtv nas ncurses network nls nptl ogg oggvorbis opengl openntpd oss pam pdflib perl pic png postgres ppds python quicktime readline real rtc samba scanner sdk sdl slang slp softmmu sox spell sse sse2 ssl svg svga tcltk tcpd tga theora threads tiff truetype truetype-fonts type1-fonts usb v4l v4l2 vorbis wxwindows xine xml xml2 xmms xosd xv xvid xvmc zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LDFLAGS, LINGUAS

```

----------

## dwblas

I agree that it has to be a configuration issue, but don't have any idea what it is.  fix_libtool_files.sh always fixed those kinds of problems for me.  And you did check /etc/make.profile to make sure it is pointing to 2005.0 right?

----------

## mardin1234

Yes it is pointing at the correct profile

----------

