Cross Development using the linaro 5.2 toolchain

I have been struggling with this issue for longer then I care to admit. I followed the directions to install the toolchain from the page:

https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-ARMCrossCompiler:GCC

with the toolchain:

gcc-linaro-``5.2``-``2015.11``-x86_64_arm-linux-gnueabihf.tar.xz

When I attempt to build an application I am getting the following error message:

/usr/local/arm/arm-linux-gnueabihf/include/c++/5.2.1/arm-linux-gnueabihf/bits/os_defines.h:39:22: fatal error: features.h: No such file or directory compilation terminated.

I looked at the include search and saw several entries like:

ignoring nonexistent directory “/usr/local/arm/bin/…/arm-linux-gnueabihf/libc/usr/local/include/arm-linux-gnueabihf

I tried to follow this path and it breaks because the path:

/usr/local/arm/…/arm-linux-gnueabihf/libc only has the directory arm-linux-gnueabihf and no directory usr. the directory arm-linux-gnueabihf does have the directory usr.

if the nonexistent directory were:

"/usr/local/arm/bin/…/arm-linux-gnueabihf/libc/arm-linux-gnueabihf/usr/local/include/arm-linux-gnueabihf" instead of

"/usr/local/arm/bin/…/arm-linux-gnueabihf/libc/usr/local/include/arm-linux-gnueabihf"

then it would find the features.h include. This error is replicated in several other nonexistent directory error messages.

What could I be doing to cause this?

Thanks for your help.

Solved:

The problem is with the toolchain sysroot. The sysroot pointed to the wrong place so the includes couldn’t be found. It was also a problem for the linker. To solve the problem I moved the directories from the sysroot to the place where the sysroot pointed and everything works correctly now. Not the best answer and will have to solve it better at another time.

Can you put more details on the solution?

Many thanks,
Kevin