swift-embedded-examples icon indicating copy to clipboard operation
swift-embedded-examples copied to clipboard

Can't build basic examples doing step-by-step from guide

Open truebest opened this issue 8 months ago • 4 comments

Hi folks,

Once I failed with ubuntu docker, taken my MacBook Apple Silicon and tried to build default examples based on apple example docs

Current swift snapshot: swift-DEVELOPMENT-SNAPSHOT-2025-03-28-a-osx.pkg

TOOLCHAINS=org.swift.62202503281a swift --version swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) Target: arm64-apple-macosx15.0

during building led-blink " idf.py build " got follow error

[710/1257] Performing configure step for 'chip_gn'
Done. Made 253 targets from 211 files in 115ms
[711/1257] Performing build step for 'chip_gn'
FAILED: esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build esp-idf/chip/lib/libCHIP.a /Users/truebest/swift-matter-examples/led-blink/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build /Users/truebest/swift-matter-examples/led-blink/build/esp-idf/chip/lib/libCHIP.a 
cd "/Users/truebest/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/truebest/swift-matter-examples/led-blink/build/esp-idf/chip" && ninja esp32
/bin/sh: line 0: cd: /Users/truebest/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/truebest/swift-matter-examples/led-blink/build/esp-idf/chip: No such file or directory
[713/1257] Performing configure step for 'bootloader'

also I tried to build other example, got around same issue.

`FAILED: esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build esp-idf/chip/lib/libCHIP.a /Users/truebest/swift-matter-examples/smart-light/build/esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build /Users/truebest/swift-matter-examples/smart-light/build/esp-idf/chip/lib/libCHIP.a 
cd "/Users/truebest/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/truebest/swift-matter-examples/smart-light/build/esp-idf/chip" && ninja esp32
/bin/sh: line 0: cd: /Users/truebest/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/truebest/swift-matter-examples/smart-light/build/esp-idf/chip: No such file or directory
`

truebest avatar Mar 31 '25 07:03 truebest

Seems related to the Espressif SDK, did you install it properly? Does ESP-IDF work fine for you?

Also, based on the paths, I think you're referring to the swift-matter-examples repo.

iCMDdev avatar Apr 22 '25 09:04 iCMDdev

Hi. In that case, I just followed Apple’s example. Also I tested Espressif SDK without swift, that part works fine.

truebest avatar Apr 26 '25 07:04 truebest

Did you try the Espressif SDK (IDF) + the Matter SDK (ESP Matter) without Swift? This command that's generated by those SDKs seems completely wrong (it's trying to cd into something that has a ";" in the middle):

cd "/Users/truebest/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip;/Users/truebest/swift-matter-examples/led-blink/build/esp-idf/chip" && ninja esp32

kubamracek avatar Apr 26 '25 14:04 kubamracek

As I mentioned earlier, I used both macOS (Apple Silicon) and Ubuntu Linux to build the binaries for the default examples. I followed the instructions from this repository’s README, that link

The log from my initial post was captured on my Mac, using a Swift compiler downloaded from the "Development Snapshots" page. For Linux, there's a Docker container available that comes with the Swift compiler preinstalled.

Regarding your question about using the Espressif SDK (IDF) and Matter SDK (ESP Matter) without Swift - yes, I’ve successfully built the project using Docker with the following command:

docker run --rm \ -v "$current_dir/light:/project" \ -w /project \ --user "$(id -u):$(id -g)" \ espressif/esp-matter:latest \ sh -c "idf.py set-target esp32c6 && idf.py build"

truebest avatar May 01 '25 05:05 truebest