Search code examples
yocto

Patch a C header file in sysroot?


I am trying to compile an apps. The compilation failed with this error below.

recipe-sysroot/usr/include/linux/stat.h:59:2: error: declaration does not declare anything [-fpermissive]
|    59 |  __s32 __reserved;

This can be easily fixed by modifying __s32 __reserved into __s32 reserved in the stat.h file.

Now I want to make a "proper fix" of this C header file in sysroot. Note that I have figured that my stat.h file (and sysroots files in general) is a hardlink. Considering the last statements, is a patch the way to fix my issue? If so, how to patch a sysroot file?

Thank you


Solution

  • No, we can't patch sysroot. However i let the original code an I just added the following in my .bb recipe:

    TARGET_CFLAGS += " -fpermissive "