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.

  • In which file do you have add_subdirectory?

    If you have a look at https://github.com/nrfconnect/ncs-example-application, you can see that add_subdirectory is used in the "top directory" and the driver/ directory, but not in the app/ directory.

    Maybe you have add_subdirectory in your app/ directory while you should instead use the same structure as the example application?

  • In my case, the add_directory is in the CMakeLists at the top level, which calls up add_directory in a drivers folder, and so on down the tree. The core source files themselves are included in the same top level CMakeLists using target_sources instead.

    I'm not sure the example is a useful structure in this case - it's specifically designed to demonstrate modules (which is what the top level CMakeLists is for), and requires the developer to specify the app directory explicitly when building the app. The app itself doesn't actually use add_directory as far as I can tell.

  • I think I solved both of my issues with a simple solution, and not having to refactor for using the structure demonstrated in the ncs-example-application, by simply adding following line in my root makefile:

    list(APPEND EXTRA_ZEPHYR_MODULES
      ${CMAKE_CURRENT_SOURCE_DIR}/custom_mp2731_driver
    )

    I previously had add_subdirectory() in that makefile.

    BR

  • Does this work  even if your driver is not a module, as such? If so, maybe that method should always be used instead of add_directory, for code with its own CMakeLists.txt that targets Zephyr?

  • This works for me, but my driver does follow now (to my besto knowledge) the structure of a module.

    I have `custom_mp2731_driver\dts\bindings\drivers\custom,mp2731.yaml`, which defines the component.

    Then, under `custom_mp2731_driver\zephyr` I placed the driver's code (.c/.h), Kconfig, module.yml and a CMakeLists.txt file which basically contains:

      zephyr_include_directories(.)

      zephyr_library()
      zephyr_library_sources(
        custom_mp2731_driver.c
        )

    I think I need to adapt the CMakeLists.txt for introducing conditional inclusion/compilation in case the module is not enabled in the project file, but it became now TODO.

Reply
  • This works for me, but my driver does follow now (to my besto knowledge) the structure of a module.

    I have `custom_mp2731_driver\dts\bindings\drivers\custom,mp2731.yaml`, which defines the component.

    Then, under `custom_mp2731_driver\zephyr` I placed the driver's code (.c/.h), Kconfig, module.yml and a CMakeLists.txt file which basically contains:

      zephyr_include_directories(.)

      zephyr_library()
      zephyr_library_sources(
        custom_mp2731_driver.c
        )

    I think I need to adapt the CMakeLists.txt for introducing conditional inclusion/compilation in case the module is not enabled in the project file, but it became now TODO.

Children
No Data
Related