powerpete
powerpete

Reputation: 3052

stdint.h "no such file or directory" error on yocto sdk

I'm building an System with Yocto/poky (morty branch). Building the image and the sdk works fine.

I've installed the SDK on an machine (other than the build machine) to cross compile a tool.

I've loaded the environment with

source /opt/mydistro/2.2.1/environment-setup-cortexa7hf-neon-vfpv4-poky-linux-gnueabi

Building a test file with

arm-poky-linux-gnueabi-gcc test.cpp

will fail with message

/opt/mydistro/2.2.1/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.2.0/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>

Compilation with explicit sysroot

arm-poky-linux-gnueabi-gcc test.cpp --sysroot=/opt/mydistro/2.2.1/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/

fails with

... include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory ...

Why is this not working? What is missing?

Upvotes: 2

Views: 7431

Answers (2)

Anders
Anders

Reputation: 9011

Well, that you can't directly use the cross-compiler is due to sysroot-poising. See yocto built tool chain search path issue.

Thus, you should always use $CC instead of directly using the cross-compiler. Using $CC will not only specify the sysroot, but also specify things like -march=..., -mfloat-abi=..., -mtune=..., etc (the exact number of options is depending on what machine you're building for). That should have solved all your problems.

Upvotes: 3

powerpete
powerpete

Reputation: 3052

In my case one solution to compile and link my example was to use the following command:

arm-poky-linux-gnueabi-gcc --sysroot=/opt/mydistro/2.2.1/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/ -mfloat-abi=hard

Upvotes: 0

Related Questions