offsets.h No such file or directory

Hi, 

We have been using SDK version 2.1.1 and currently are in the process of migrating to SDK version 2.5.0.

Would be helpful to get some hint regarding what conditions can lead to the following error when building our application.

In file included from C:\ncs\v2.5.0\zephyr\include\zephyr\app_memory\app_memdomain.h:9,
from C:\ncs\v2.5.0\zephyr\include\zephyr\rtio\rtio.h:31,
from C:\ncs\v2.5.0\zephyr\include\zephyr\drivers\i2c.h:28,
from <our application.h>...
C:\ncs\v2.5.0\zephyr\include\zephyr\linker\linker-defs.h:26:10: fatal error: offsets.h: No such file or directory
26 | #include <offsets.h>
| ^~~~~~~~~~~

Thanks,

Mathi.

Parents
  • Hi,

    Can you explain the steps you did to update to v2.5.0? Both for the SDK and the application.

    Maybe most common is to forget to delete the build folder between versions.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Iam building an application that contains the child image mcuboot and hci_rpmsg.conf.
    I use vscode to install the new version of the SDK and toolchain.
    I can also confirm that the build error is seen only when upgrading from 2.4.2 to 2.5.0. i.e. 
    In order to re-create the problem we tried to incrementally upgrade from 2.1.1 to 2.5.0..
    i.e.
    Upgrade from 2.1.1 to 2.3.0 ==> No build error related to offsets.h generation.
    Upgrade from 2.3.0 to 2.4.0 ==> No build error related to offsets.h generation.
    Upgrade from 2.4.0 to 2.4.1 ==> No build error related to offsets.h generation.
    Upgrade from 2.4.1 to 2.4.2 ==> No build error related to offsets.h generation.
    Upgrade from 2.4.2 to 2.5.0 ==> Build fails due to offsets.h generation.

    Note: I always made sure to delete the build folder between versions.
    Please let me know if you need further information.

    Thanks,

    Mathi.

  • TBing said:
    - As described, doing a fresh build fails with the "offsets.h" error during compilation of app core application. Most times a secondary build will be successful, but sometimes restarting vscode is needed for the build to be successful...

    I missed that from earlier. Interesting! What exactly do you mean by "fresh build"?
    Does it help the problem to manually delete the build folder and build again?

  • Hi Sigurd

    With "fresh build" I meant, the situation where I create a new build configuration, using the nRF pluggin in vscode, and have the checkbox "Build after generating configuration" checked.

  • As an alternative to VS Code, it is possible to build with the command line. This can be done by creating a new Terminal in VS Code with the type nRF Connect and building the project with "west build -b <board_name>".  Are you able to test this, so we can see if the issue is related to VS Code building or the build system itself?

    And thanks for the answers so far!

  • I can answer this: I always build from the command line, so it's not related to VS Code building.

  • Agree already tried to build via West, but it fails with the same error.

Reply Children
  • Not a solution yet, but I found that someone else reported the same issue over at Zephyr issues. Worth watching that one as well I recon.

  • Hi Sigurd

    I managed to solve the problem in my build. Here is what I found out:

    The header file of our i2c abstraction included:

    #include <zephyr/drivers/i2c.h>

    This file ends up (through sub includes) to including "Offsets.h"

    If I instead move the inclusion of  <zephyr/drivers/i2c.h> to my related .cpp file - the the build is successful.
    It seems like the .h file preprocessing is done before Offsets.h is generated..
  • Hi Tonny,

    Great find. Thanks for the help. 
    I can repeat your fix. i.e. move the inclusion of the above header file into a .cpp file and it worked for me.

    Kind Regards,

    Mathi.

  • Hi Tonny,

    Great find. Thanks for the help. 
    I can repeat your fix. i.e. move the inclusion of the above header file into a .cpp file and it worked for me.

    Kind Regards,

    Mathi.

  • Surprisingly the ticket got closed when i clicked on "Verify Answer" and now iam unable to view all the discussions.
    For the benefit of other users - iam just pasting below the solution found by Tonny Bing (TBing)

    "

    Hi Sigurd

    I managed to solve the problem in my build. Here is what I found out:

    The header file of our i2c abstraction included:

    #include <zephyr/drivers/i2c.h>

    This file ends up (through sub includes) to including "Offsets.h"

    If I instead move the inclusion of  <zephyr/drivers/i2c.h> to my related .cpp file - the the build is successful.
    It seems like the .h file preprocessing is done before Offsets.h is generated..


    "