title: Yocto nativesdk-ncurses fails to build because of include paths not prefixed with sysroot
body: <p>I'm trying to build an SDK for the Yocto "dizzy" branch for the imx6qsabresd board.
  I've followed the instructions at <a href="https://github.com/Freescale/fsl-community-bsp-platform/blob/jethro/README.adoc" rel="nofollow">https://github.com/Freescale/fsl-community-bsp-platform/blob/jethro/README.adoc</a>, the only difference is that I used the dizzy branch instead of jethro.</p>
  
  <p>Running <code>bitbake meta-toolchain</code> now gives me the following error:</p>
  
  <pre><code>| echo | gawk -f /mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/base/MKunctrl.awk bigstrings=1 &gt;unctrl.c
  | x86_64-pokysdk-linux-gcc  --sysroot=/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux -DHAVE_CONFIG_H -I../ncurses -I/mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses -isystem/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -D_GNU_SOURCE -DNDEBUG -I. -I../include -I/mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/../include -I/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -isystem/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -O2 -pipe  --param max-inline-insns-single=1200 -fPIC -DUSE_TERMLIB -c /mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/tinfo/access.c -o ../obj_s/access.o
  | cc1: error: /opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include: Permission denied
  [..]
  ERROR: Task 1368 (virtual:nativesdk:/mnt/space1/yocto-dizzy-imx6/sources/poky/meta/recipes-core/ncurses/ncurses_5.9.bb, do_compile) failed with exit code '1'
  </code></pre>
  
  <p>The relevant arguments from above are:</p>
  
  <ul>
  <li><code>-I/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include</code></li>
  <li><code>--sysroot=/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux</code></li>
  </ul>
  
  <p>ncurses is one of the first packages getting built, I guess the problem is not specific to ncurses.</p>
  
  <p>Apparently the compiler tries to access the absolute include dir <code>/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include</code>, without considering the sysroot prefix <code>/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux</code>. Both together, <code>/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include</code>, would be the correct include path.</p>
  
  <p>Now, who is at fault here? The compiler for not considering the <code>--sysroot</code> argument when looking at the <code>-I</code> include dirs? Or is there a mistake in the Yocto recipes somewhere? Maybe it was Yocto's job to prefix the include path? Any other hints?</p>