# Can not compile any kernel!!!!

## Phancy Physicist

So I don't know what happened but I 

```

emerge --clean gentoo-sources

```

Now I can't compile any kernel source.

I tried

```

emerge -DNu world

emerge -DN gentoo-sources

revdep-rebuild

```

the kernel compile hangs like this

```

  CHK     include/linux/version.h

  CHK     include/linux/utsrelease.h

  SYMLINK include/asm -> include/asm-x86

  CALL    scripts/checksyscalls.sh

  CHK     include/linux/compile.h

```

I am at a loss here. Any help? Please.

----------

## Veldrin

have you run a make mrproper inside the kernel directory? My guess is leftovers from an old installation.

does /usr/src/linux point to the correct source tree (ls -la /usr/src/linux should give you a hint.)

----------

## Phancy Physicist

 *Veldrin wrote:*   

> have you run a make mrproper inside the kernel directory? My guess is leftovers from an old installation.
> 
> does /usr/src/linux point to the correct source tree (ls -la /usr/src/linux should give you a hint.)

 

I ran 

```
make mrproper
```

then a 

```

make

```

no good ...

and yes the link is pointing to the right place

----------

## John R. Graham

 *Veldrin wrote:*   

> have you run a make mrproper inside the kernel directory? My guess is leftovers from an old installation.

 Alas, one of the leftovers was his .config file, since erased by "make mrproper".  

@Phancy Physicis, you might be able to recover your existing kernel config, depending on your previous kernel options.  If "/proc/config.gz" exists,

```
# ls /proc/config.gz

/proc/config.gz
```

then you can recover your current kernel config by copying it from there:

```
zcat /proc/config.gz >/usr/src/linux/.config
```

If it doesn't exist, then I'm afraid you'll have to start over making a new kernel config with

```
# make menuconfig
```

After that, retry the make.   :Smile: 

- John

----------

## Phancy Physicist

 *john_r_graham wrote:*   

> If it doesn't exist, then I'm afraid you'll have to start over making a new kernel config with
> 
> ```
> # make menuconfig
> ```
> ...

 

I did but it still hangs on 

```

CHK        include/linux/compile.h

```

----------

## monsm

Strange.  So you have tried to compile something else?  And that works?

If so try again to remove and re-emerge the gentoo-sources.  Also, try Pappy's kernel seeds for the config.

Mons

----------

## John R. Graham

 *Phancy Physicist wrote:*   

> I did but it still hangs on 
> 
> ```
> 
> CHK        include/linux/compile.h
> ...

 Could you please post the output of

```
equery list -i gentoo-sources

ls -l /usr/src
```

And, did you have a /proc/config.gz or not?

- John

----------

## Phancy Physicist

Okay I just 

```

emerge -C gentoo-sources

rm -r linux*

emerge gentoo-sources

```

to make sure everything is gone.

and again it hung

```

# make

  HOSTCC  scripts/basic/fixdep

  HOSTCC  scripts/basic/docproc

  HOSTCC  scripts/basic/hash

  HOSTCC  scripts/kconfig/conf.o

  HOSTCC  scripts/kconfig/kxgettext.o

  SHIPPED scripts/kconfig/zconf.tab.c

  SHIPPED scripts/kconfig/lex.zconf.c

  SHIPPED scripts/kconfig/zconf.hash.c

  HOSTCC  scripts/kconfig/zconf.tab.o

  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

  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/selinux/mdp/mdp

  HOSTCC  scripts/kallsyms

  HOSTCC  scripts/pnmtologo

  HOSTCC  scripts/conmakehash

  CC      init/main.o

  CHK     include/linux/compile.h

```

 *john_r_graham wrote:*   

> Could you please post the output of
> 
> ```
> equery list -i gentoo-sources
> 
> ...

 

```

linux # equery list -i gentoo-sources

[ Searching for package 'gentoo-sources' in all categories among: ]

 * installed packages

[I--] [  ] sys-kernel/gentoo-sources-2.6.30-r4 (2.6.30-r4)

linux # ls -l /usr/src

total 8

drwxr-xr-x  2 root root 4096 Jun 22 21:31 ati

lrwxrwxrwx  1 root root   22 Sep  4 09:50 linux -> linux-2.6.30-gentoo-r4

drwxr-xr-x 23 root root 4096 Sep  4 09:51 linux-2.6.30-gentoo-r4

```

 *john_r_graham wrote:*   

> 
> 
> And, did you have a /proc/config.gz or not?
> 
> 

 

No I don't have /proc/config.gz

----------

## John R. Graham

Could you tell me what you did in the way of setting up your kernel .config file before running make?  Also, do yourself a favor and set

```
     -> General setup

       -> Kernel .config support (IKCONFIG [=y])
```

in your kernel config so that you'll always have a copy of the kernel .config file the running kernel was built with.

Finally, could you post the output of

```
gcc-config -l
```

please?

- John

----------

## Phancy Physicist

 *john_r_graham wrote:*   

> Could you tell me what you did in the way of setting up your kernel .config file before running make?  Also, do yourself a favor and set
> 
> ```
>      -> General setup
> 
> ...

 

I always save a copy of .config to the boot drive. Setup wise just the usual; picked the chip type(amd), file systems, usb, networking etc. Nothing fancy.

 *john_r_graham wrote:*   

> 
> 
> Finally, could you post the output of
> 
> ```
> ...

 

$ gcc-config -l

 [1] x86_64-pc-linux-gnu-4.3.2 *

----------

## John R. Graham

Okay, one more thing and then I'm stumped.  Could you run "make oldconfig" and then retry your make?

Okay, actually two more things.    :Wink:   First, what kernel are you currently running?  Use "uname -r" to find out.  If it's different from 2.6.30-r4, then you might want to emerge that version and try again.  For instance

```
# emerge -v =sys-kernel/gentoo-sources-2.6.29*
```

- John

----------

## Phancy Physicist

 *john_r_graham wrote:*   

> Okay, one more thing and then I'm stumped.  Could you run "make oldconfig" and then retry your make?
> 
> Okay, actually two more things.     First, what kernel are you currently running?  Use "uname -r" to find out.  If it's different from 2.6.30-r4, then you uname -rmight want to emerge that version and try again.  For instance
> 
> ```
> ...

 

```

 $ uname -r

2.6.30-gentoo-r4

```

I'm fairly certain that the problem is not in my .config.

The make is checking compile.h but I can't figure where it comes from. How is it generated?

----------

## Mike Hunt

post the output of 

```
eselect python list
```

and your  emerge --info please.

----------

## Phancy Physicist

 *Mike Hunt wrote:*   

> post the output of 
> 
> ```
> eselect python list
> ```
> ...

 

```

$ eselect python list

Available python interpreters:

  [1]   python2.6 *

```

```

$ emerge --info

Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.30-gentoo-r4 x86_64)

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

System uname: Linux-2.6.30-gentoo-r4-x86_64-AMD_Turion-tm-_X2_Ultra_Dual-Core_Mobile_ZM-85-with-gentoo-1.12.11.1

Timestamp of tree: Fri, 04 Sep 2009 10:30:01 +0000

app-shells/bash:     3.2_p39

dev-java/java-config: 2.1.8-r1

dev-lang/python:     2.6.2-r1

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.13, 2.63-r1

sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2

sys-devel/binutils:  2.18-r3

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.27-r2

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O3 -fomit-frame-pointer -pipe -march=athlon64-sse3 -mmmx -msse -msse2 -msse3"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"

CXXFLAGS="-O3 -fomit-frame-pointer -pipe -march=athlon64-sse3 -mmmx -msse -msse2 -msse3"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="ftp://gentoo.mirrors.pair.com ftp://gentoo.llarian.net/pub/gentoo"

LANG="C"

LDFLAGS="-Wl,-O1"

LINGUAS="en_US en ja_JP ja ru"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X Xaw3d a52 aac aalib accessibility acl acpi alsa amd64 ansi ao apache2 apm audiofile avahi avi bash-completion bcmath berkdb blas bluetooth branding browserplugin bzip2 cairo canna cdda cdinstall cdio cdr cjk clamav cli cracklib crypt css cups dbus dga divx divx4linux dri dts dv dvb dvd dvdr dvdread encode exif fam fbcon ffmpeg fftw firefox flac fortran freetype freewnn ftp gd gdbm gif gimp ginac glut gmp gnome gnome-keyring gnuplot gnutls gpm graphviz gsl gstreamer gtk gzip hal hddtemp httpd iconv ieee1394 imagemagick immqt-bc ipod ipv6 isdnlog jack java java6 javascript jpeg jpeg2k kerberos lame latex ldap libcaca libedit libnotify libwww lm_sensors loop-aes mad matroska mime mmx motif mp3 mpeg mudflap multilib mysql ncurses networkmanager nls nocd nowin nptl nptlonly nsplugin oav ogg openal opengl openmp pam pcmcia pcntl pcre pdf perl php plotutils png posix ppds pppd python quicktime rar rdesktop readline reflection samba sasl scanner sdl session slp smartcard smp sockets spell spl sse sse2 sse3 ssl stream sysfs tcl tcpd tetex theora threads tiff tk truetype unicode usb v4l v4l2 vcd vlm vnc vorbis wifi winbind wxwindows xanim xml xorg xpm xscreensaver xv xvid zlib" ALSA_CARDS="usb-audio atiixp atiixp-modem hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse wacom joystick synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en ja_JP ja ru" USERLAND="GNU" VIDEO_CARDS="radeon radeonhd vesa fbdev fglrx"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

----------

## Mike Hunt

Never mind about eselect python (I had brain freeze). 

But what if you try this:

Compile gcc with 

CFLAGS="-march=native -O2 -pipe"

CXXFLAGS="${CFLAGS}"

Then try again to build your kernel.

----------

## Hu

Perhaps it would be instructive to know what, if anything, is running at the time make hangs?  Try adding V=1 to make the build more verbose, and examine the process tree to see what process is stuck.

----------

## Phancy Physicist

 *Hu wrote:*   

> Perhaps it would be instructive to know what, if anything, is running at the time make hangs?  Try adding V=1 to make the build more verbose, and examine the process tree to see what process is stuck.

 

```

# make V=1

rm -f include/config/kernel.release

echo 2.6.30-gentoo-r4 > include/config/kernel.release

set -e; : '  CHK     include/linux/version.h'; mkdir -p include/linux/;    (echo \#define LINUX_VERSION_CODE 132638; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < /usr/src/linux-2.6.30-gentoo-r4/Makefile > include/linux/version.h.tmp; if [ -r include/linux/version.h ] && cmp -s include/linux/version.h include/linux/version.h.tmp; then rm -f include/linux/version.h.tmp; else : '  UPD     include/linux/version.h'; mv -f include/linux/version.h.tmp include/linux/version.h; fi

set -e; : '  CHK     include/linux/utsrelease.h'; mkdir -p include/linux/;    if [ `echo -n "2.6.30-gentoo-r4" | wc -c ` -gt 64 ]; then echo '"2.6.30-gentoo-r4" exceeds 64 characters' >&2; exit 1; fi; (echo \#define UTS_RELEASE \"2.6.30-gentoo-r4\";) < include/config/kernel.release > include/linux/utsrelease.h.tmp; if [ -r include/linux/utsrelease.h ] && cmp -s include/linux/utsrelease.h include/linux/utsrelease.h.tmp; then rm -f include/linux/utsrelease.h.tmp; else : '  UPD     include/linux/utsrelease.h'; mv -f include/linux/utsrelease.h.tmp include/linux/utsrelease.h; fi

set -e; if [ -L include/asm ]; then asmlink=`readlink include/asm | cut -d '-' -f 2`; if [ "$asmlink" != "x86" ]; then echo "ERROR: the symlink include/asm points to asm-$asmlink but asm-x86 was expected"; echo "       set ARCH or save .config and run 'make mrproper' to fix it"; exit 1; fi; test -e $asmlink || rm include/asm; elif [ -d include/asm ]; then echo "ERROR: include/asm is a directory but a symlink was expected"; exit 1; fi

if [ ! -L include/asm ]; then : '  SYMLINK include/asm -> include/asm-x86'; if [ ! -d include/asm-x86 ]; then mkdir -p include/asm-x86; fi; ln -fsn asm-x86 include/asm; fi

mkdir -p .tmp_versions ; rm -f .tmp_versions/*

make -f scripts/Makefile.build obj=scripts/basic

(cat /dev/null; ) > scripts/basic/modules.order

make -f scripts/Makefile.build obj=.

(cat /dev/null; ) > modules.order

mkdir -p kernel/

mkdir -p arch/x86/kernel/

make -f scripts/Makefile.build obj=. missing-syscalls

  /bin/sh scripts/checksyscalls.sh gcc -Wp,-MD,./.missing-syscalls.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include -Iinclude  -I/usr/src/linux-2.6.30-gentoo-r4/arch/x86/include -include include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -fno-delete-null-pointer-checks -O2 -m64 -march=k8 -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow   -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(missing_syscalls)"  -D"KBUILD_MODNAME=KBUILD_STR(missing_syscalls)" 

make -f scripts/Makefile.build obj=scripts

make -f scripts/Makefile.build obj=scripts/mod

(cat /dev/null; ) > scripts/mod/modules.order

make -f scripts/Makefile.build obj=scripts/selinux

make -f scripts/Makefile.build obj=scripts/selinux/mdp

(cat /dev/null; ) > scripts/selinux/mdp/modules.order

(cat /dev/null; ) > scripts/selinux/modules.order

(cat /dev/null; ) > scripts/modules.order

make -f scripts/Makefile.build obj=init

/bin/sh /usr/src/linux-2.6.30-gentoo-r4/scripts/mkcompile_h include/linux/compile.h \

   "x86_64" "y" "y" "gcc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -fno-delete-null-pointer-checks -O2 -m64 -march=k8 -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow    -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow "

```

----------

## Hu

I see nothing in the script that looks like it would hang.  Try running that last line through bash by hand, with -x to print the individual commands.

----------

## Phancy Physicist

 *Hu wrote:*   

> I see nothing in the script that looks like it would hang.  Try running that last line through bash by hand, with -x to print the individual commands.

 

I ran

```

/usr/src/linux-2.6.30-gentoo-r4/scripts/mkcompile_h -x include/linux/compile.h "x86_64" "y" "y" "gcc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -fno-delete-null-pointer-checks -O2 -m64 -march=k8 -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow    -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow " 

```

and it produced another hang.

However it got me checking files again and it seems I have no file /usr/src/linux/include/linux/compile.h. I checked before I posted but not since I did the source uninstall/reinstall mentioned in the posts above.

Where does the file, /usr/src/linux/include/linux/compile.h come from? It seems that this file is the cause of all my misery. 

In an effort to get this file somehow, I

```

emerge -D world

```

which completed successfully, but gdm is now broken. 

I think it is because my modules are all messed up since I can't make a new kernel or modules to go with it. 

I am using windows to post this!!!! Please help save me from Mircosoft hell. My punishment does not fit the crime.

----------

## Phancy Physicist

 *Mike Hunt wrote:*   

> Never mind about eselect python (I had brain freeze). 
> 
> But what if you try this:
> 
> Compile gcc with 
> ...

 

I recompiled everything with -O2 but still no good.

----------

## John R. Graham

Well, one thing to note is that your kernel scripts appear to think that you're compiling for an ancient AMD  K8 CPU.  Might want to do a "make clean" and a "make menuconfig" and confirm that your processor type is set correctly.

- John

----------

## Hu

 *Phancy Physicist wrote:*   

>  *Hu wrote:*   I see nothing in the script that looks like it would hang.  Try running that last line through bash by hand, with -x to print the individual commands. 
> 
> I ran
> 
> ```
> ...

 

Your invocation passes -x as an argument to the script.  I wanted you to run bash -x scripts/mkcompile_h ..., so that the -x is passed to bash.

 *Phancy Physicist wrote:*   

> 
> 
> However it got me checking files again and it seems I have no file /usr/src/linux/include/linux/compile.h. I checked before I posted but not since I did the source uninstall/reinstall mentioned in the posts above.
> 
> Where does the file, /usr/src/linux/include/linux/compile.h come from? It seems that this file is the cause of all my misery.

 

It comes from successful completion of this script.  :Smile: 

----------

## Phancy Physicist

 *Hu wrote:*   

> 
> 
> Your invocation passes -x as an argument to the script.  I wanted you to run bash -x scripts/mkcompile_h ..., so that the -x is passed to bash.
> 
> 

 

Opps.  :Embarassed:  . But I did like you said. Though I'm on windows so I don't want to type out all the text. However the script hangs on dnsdomainname.

I ran

```

dnsdomainname

```

but it returned nothing and it never ends. Giving the hang I guess. Any ideas on how to fix dnsdomainname?  I use networkmanager, if it matters.

----------

## Mike Hunt

You need to configure your /etc/hosts file correctly something like this will do

```
127.0.0.1 mybox.at.myplace mybox localhost
```

and /etc/conf.d/hostname

```
mybox
```

and run

```
# hostname mybox

# hostname -f

mybox.at.myplace

# dnsdomainname

at.myplace
```

----------

## Phancy Physicist

I'm using Links right now. I checked my /etc/hosts and it looks fine.

I wanted to clarify though. dnsdomainname doesn't fail to resolve, it freezes. What could break dnsdomainname like this and how can i reinstall it?

----------

## Mike Hunt

Ah, got it.  I don't know networkmanager - never used it. Could it break dnsdomainname?

dnsdomainname belongs to package sys-apps/net-tools

----------

## Hu

Now that we know dnsdomainname is the culprit, run strace on it to find what system call is blocking it.

----------

