apple/swift-matter-examples

Error building Swift Matter smart light example for ESP32-C6

Closed this issue · 5 comments

Hi there,

I'm facing issues while trying to build the smart light matter project. See details below:

System Information

Swift Version

  • Swift Version: Apple Swift version 6.0-dev
  • Target: x86_64-apple-macosx14.0

Software Installed

  • Matter, IDF, etc. installed correctly

Environment Setup

  • export.sh from IDF and Matter executed successfully
  • TOOLCHAIN points to the correct version
  • Running idf.py set-target esp32c6 works fine and confirms the Swift compiler identification as Apple 6.0

Problem Description

When attempting to build the project using idf.py build, I encounter the following error:

Executing action: all (aliases: build)
Running ninja in directory /Users/<usr>/Code/swift-matter-examples/smart-light/build
Executing "ninja all"...
ninja: error: 'esp-idf/main/CMakeFiles/__idf_main.dir/Main.swift.obj', needed by 'esp-idf/main/libmain.a', missing and no known rule to make it
ninja failed with exit code 1, output of the command is in the [...]smart-light/build/log/idf_py_stderr_output_22173 and [...]/smart-light/build/log/idf_py_stdout_output_22173

The logs do not provide further information.

Additional Information

  • The toolchain is correctly set up and recognized.
  • Other examples, like the ESP32-IDF Blink example, work without issues.

Request

Any guidance or suggestions to resolve this build issue would be greatly appreciated.

Best regards,
Jannik

I could identify the problem. My terminal targeted the wrong CMake version. I checked it with the which cmake command wich targeted the right version, but something was messed up on my side.

Anyways one thing bothers me: The CMakeLists.txt in the smart light example requires CMake version 3.5. The newest version is 3.30. It seems as if this check is never performed.

Can anybody verify this?

Ah, that's exactly where the problem is, thanks! The minimum CMake requires is 3.29, the "empty-template" and "led-blink" examples have that right, but it seems like the "smart-light" example needs to be updated.

@yaJannik does this resolve it? I think now you should get a clear error if you accidentally use an old CMake.

Yes, it solved the problem or more specific: It helps identifying the problem a lot.

Currently I'm stuck on another problem, but I'll open another issue later. The issue is closed. Thank you for the pull request.

Issues can be re-openened (it's GitHub's behavior to auto-close any issue that's mentioned in a merged PR). But yes, if it's a separate issue, best to open a new one.