Skip to content

[esp_matter][build] esp_matter.h not found when compiling native module in Moddable SDK #1525

@yoahnl

Description

@yoahnl

Context & Objective

I am building a Moddable SDK (XS) project on ESP32, intending to use the ESP-Matter component via the ESP Component Registry and Component Manager. My setup involves:
• A JS API (matter.js, matter.c) interacting with a native C++ implementation in matter_core.cpp.
• esp_matter ^1.4.0 declared under platforms.esp32.dependency in manifest.json.

I expect that adding the dependency should automatically make ESP-Matter’s headers (like esp_matter.h) available to my native module. This follows the described workflow in the Moddable blog [“Using the ESP Component Registry with the Moddable SDK”]  

Problem

Despite correct dependency resolution, the compiler fails with:
fatal error: esp_matter.h: No such file or directory

Reproduction Details

Manifest example (manifest.json):

{
  "include": ["$(MODDABLE)/examples/manifest_base.json"],
  "modules": {
    "*": ["./main", "./native/matter", "./native/matter_core"]
  },
  "platforms": {
    "esp32": {
      "dependency": [
        { "namespace":"espressif", "name":"esp_matter", "version":"^1.4.0" }
      ]
    }
  }
}

Directory structure:

Project/
├── main.js
├── manifest.json
├── native/
│   ├── matter.c
│   ├── matter.js
│   ├── matter_core.cpp
│   └── matter_core.h

“matter_core.cpp contains:
#include <esp_matter.h>

This inclusion fails during compilation because the header is not found in any search path.

What I’ve Verified
• The espressif/esp_matter component is downloaded to managed_components.
• I have run full clean builds and rebuilds.
• matter_core.cpp is listed in the build, but its compile command does not include any -I.../esp_matter/include.

Expected Behavior

According to the blog guide, listing a dependency under platforms.esp32.dependency should:
1. Download the component.
2. Add it to the build.
3. Make the component’s native header files available to native code.
All this works for ESP-IDF but seems to fail for modules compiled via modules in Moddable.

Could your team:
• Confirm if this use-case is intended to work?
• Share any documentation or example where a native module imports headers from managed components?
• Consider adding automatic propagation of include paths from components to modules, or document a workaround?

I’ve struggled for a week trying to build this — it’s been so close yet unreachable. It would be amazing if Moddable offered better support for using ESP-Matter (or other IDF components) from native modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions