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

南楼画角 提交于 2020-03-22 10:25:30

问题


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?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/43187384/stdint-h-no-such-file-or-directory-error-on-yocto-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!