Bug 6216

Summary: Building modules outside the kernel uses linux-libc-headers not actual kernel headers (hello-mod)
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: David Peverley <pev>
Component: layersAssignee: David Peverley <pev>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, richard.purdie
Version: 1.5   
Target Milestone: 1.8   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description David Peverley 2014-04-23 16:25:45 UTC
When you build a kernel module out of tree (e.g. as with the hello-mod example) the build system uses the linux-libc-headers instead of the headers of your preferred kernel. If you're depending on the changes then this is a significant problem...

In my case I can show the search path to be :
  bitbake linux-imx -c devshell
... devshell ...
  `arm-oe-linux-gnueabi-gcc -print-prog-name=cc1` -v
  ignoring nonexistent directory "/workdrive/projects/vibe/src/fsl-community-bsp/build/tmp-eglibc/sysroots/pevmachine/usr/local/include"
  ignoring nonexistent directory "/workdrive/projects/vibe/src/fsl-community-bsp/build/tmp-eglibc/sysroots/x86_64-linux/usr/lib/cortexa9hf-vfp-neon-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/../../../../../arm-oe-linux-gnueabi/include"
  #include "..." search starts here:
  #include <...> search starts here:
   /workdrive/projects/vibe/src/fsl-community-bsp/build/tmp-eglibc/sysroots/x86_64-linux/usr/lib/cortexa9hf-vfp-neon-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/include
   /workdrive/projects/vibe/src/fsl-community-bsp/build/tmp-eglibc/sysroots/x86_64-linux/usr/lib/cortexa9hf-vfp-neon-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/include-fixed
   /workdrive/projects/vibe/src/fsl-community-bsp/build/tmp-eglibc/sysroots/pevmachine/usr/include
  End of search list.

So this means it picks up the includes from sysrootfs i.e. the linux-libc-headers.
Comment 1 Darren Hart 2014-11-14 18:48:40 UTC
Bruce, I'm going to toss this one over to you - at least for your initial thoughts.
Comment 2 Bruce Ashfield 2014-11-14 19:06:58 UTC
When you actually build the module, it will use the kernel build system, which sets its own include paths and hence will find
the sysroot/kernel source headers first.

Do you have a specific build problem, or another test that shows this without devshell ?
Comment 3 Richard Purdie 2015-01-08 16:00:38 UTC
The hello-mod recipe uses module.bbclass and does not use linux-libc-headers. If you do things from the devshell, you will hit issues like this. I you have a proper recipe which doesn't work and more info, please reopen, otherwise I can't see the issue here.