Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel compilation somehow picking-up wrong headers [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 768
Location: Queensland

PostPosted: Fri Jul 01, 2016 12:17 am    Post subject: Kernel compilation somehow picking-up wrong headers [SOLVED] Reply with quote

I've been building Gentoo for ten years on various machines and have never encountered this before.

The build commences:

make:
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
...

which rapidly goes wrong because include/linux/log2.h contains the line #include <linux/types.h> which somehow resolves to include/uapi/linux/types.h rather than include/linux/types.h. Then symbol phys_addr_t is undefined and the build fails.

gcc-config -l shows version 5.4.0 and the kernel tree is pristine; the machine had been switched to gcc-5.4.0 and rebooted several times before I first attempted to build this version (4.6.3) of the kernel.

The same problem existed with kernel 4.6.2. I built that version successfully while installing from SystemRescueCD by not chrooting but just cding to /mnt/gentoo/usr/src/linux and make.

This doesn't apply, since there, the user changed gcc version mid-way.

So the question is why SystemRescueCD is able to build the kernel but the installed Gentoo system is not able. The installed Gentoo system has kernel-headers-4.6 installed.
_________________
Michael Mounteney


Last edited by mounty1 on Sun Jul 03, 2016 3:51 am; edited 1 time in total
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 225

PostPosted: Fri Jul 01, 2016 6:30 am    Post subject: Reply with quote

Let's do some sanity checks. Does include/linux/types.h really exist? What's gcc's include path? Does it differ from the one on SystemRescueCD?

You can check the include path with
Code:
echo | cpp -Wp,-v
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 768
Location: Queensland

PostPosted: Fri Jul 01, 2016 9:27 am    Post subject: Cracked it Reply with quote

Thanks bstaletic for the hints. The problem is that /etc/env.d/55gnat-i686-pc-linux-gnu-gnat-gcc-4.9 defines COMPILER_PATH=/usr/libexec/gnat-gcc/i686-pc-linux-gnu/4.9:/usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9:.

unset COMPILER_PATH and everything works correctly again.

With it set,
echo | cpp -Wp,-v:
ignoring duplicate directory "/usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory "/usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9/include-fixed"
ignoring nonexistent directory "/usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9/include
 ./include
 /usr/lib/gnat-gcc/i686-pc-linux-gnu/4.9/include-fixed
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"

and with it cleared/unset:
echo | cpp -Wp,-v:
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/5.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/5.4.0/include
 /usr/lib/gcc/i686-pc-linux-gnu/5.4.0/include-fixed
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"

That fixes the problem with the kernel build. Reported.
_________________
Michael Mounteney
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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