esp-idf + esp-matter + vsc not even compiling on examples

AnonTheEngenius
Posts: 8
Joined: Sun Aug 27, 2023 6:35 pm

esp-idf + esp-matter + vsc not even compiling on examples

Postby AnonTheEngenius » Tue Oct 31, 2023 6:00 pm

System details:
[*]Mac M2
[*]VSC
[*]Esp-idf latest release
[*]esp-matter latest release

It is quite frankly ridiculous how shit the esp-idf development experience is.

but since their is no other way of trying to do what i want:

I didi a clean installation of the esp-idf extension in vscode. Afterwards i opened the command palette and entered Install ESP-Matter command. Which started the install but of course didn't work.
No problem so i follow the other guide (1 of 3 given from espress-if, none really complete...or working) and install the shallow clone of the esp-matter repo. Then i go to the esp-idf extension and set the path for the extension to the download path. So far so good. Next i enter the esp-examples command open the esp-matter light example and create my own project from it. Now starts the fun.
i execute the two export.sh scripts from esp-idf and esp-matter. Works...nice. I set the target first with the vsc function in the bottom left and hit build and get this:

Code: Select all

Running cmake in directory /Users/sam/Documents/wordclock_firmware2/light/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/Users/sam/.espressif/python_env/idf5.1_py3.9_env/bin/python -DESP_PLATFORM=1 -DCCACHE_ENABLE=1 /Users/sam/Documents/wordclock_firmware2/light"...
-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 
CMake Error at /Users/sam/.espressif/esp-matter/device_hal/device/esp32_devkit_c/esp_matter_device.cmake:3 (message):
  please set esp32 as the IDF_TARGET using 'idf.py set-target esp32'
Call Stack (most recent call first):
  CMakeLists.txt:35 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the /Users/sam/Documents/wordclock_firmware2/light/build/log/idf_py_stderr_output_13840 and /Users/sam/Documents/wordclock_firmware2/light/build/log/idf_py_stdout_output_13840
So i think what the hell and change the target to esp32 that should at least work right?

Code: Select all

-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 
-- Component directory /Users/sam/.espressif/esp-matter/examples/common/blemesh_platform does not contain a CMakeLists.txt file. No component will be added
-- Component directory /Users/sam/.espressif/esp-matter/examples/common/external_platform does not contain a CMakeLists.txt file. No component will be added
-- Component directory /Users/sam/.espressif/esp-matter/examples/common/relinker does not contain a CMakeLists.txt file. No component will be added
CMake Error at /Users/sam/esp/esp-idf/tools/cmake/project.cmake:349 (message):
  Directory specified in EXTRA_COMPONENT_DIRS doesn't exist:
  /Users/sam/.espressif/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components
Call Stack (most recent call first):
  /Users/sam/esp/esp-idf/tools/cmake/project.cmake:433 (__project_init)
  CMakeLists.txt:44 (project)


-- Configuring incomplete, errors occurred!

 *  The terminal process "/bin/zsh '-c', 'cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -B /Users/sam/Documents/wordclock_firmware2/light/build -S /Users/sam/Documents/wordclock_firmware2/light'" terminated with exit code: 1.
WTF. This is an example of a release version. This should work.

So do a full-clean, close the vsc again, call the export scripts again and do idf.py build again:

Code: Select all

Running cmake in directory /Users/sam/Documents/wordclock_firmware2/light/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/Users/sam/.espressif/python_env/idf5.1_py3.9_env/bin/python -DESP_PLATFORM=1 -DCCACHE_ENABLE=1 /Users/sam/Documents/wordclock_firmware2/light"...
-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 
CMake Error at /Users/sam/.espressif/esp-matter/device_hal/device/esp32_devkit_c/esp_matter_device.cmake:3 (message):
  please set esp32 as the IDF_TARGET using 'idf.py set-target esp32'
Call Stack (most recent call first):
  CMakeLists.txt:35 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the /Users/sam/Documents/wordclock_firmware2/light/build/log/idf_py_stderr_output_14461 and /Users/sam/Documents/wordclock_firmware2/light/build/log/idf_py_stdout_output_14461
So i do idf.py set-target esp32:

Code: Select all

(base) sam@Samuels-Air-2 light % idf.py set-target esp32
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/Users/sam/Documents/wordclock_firmware2/light/build' is empty. Nothing to clean.
Executing action: set-target
Set Target to: esp32, new sdkconfig will be created.
Target 'esp32' specified on command line is not consistent with target 'esp32c3' in the environment.
and building of course doesn't work. I have no idea where the esp32c3 in "the environment" comes from or how to get rid of it. I checked every file. But ok now lets try to full-clean

Code: Select all

Set Target to: esp32c3, new sdkconfig will be created.
Running cmake in directory /Users/sam/Documents/wordclock_firmware2/light/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/Users/sam/.espressif/python_env/idf5.1_py3.9_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=esp32c3 -DCCACHE_ENABLE=0 /Users/sam/Documents/wordclock_firmware2/light"...
-- Found Git: /usr/bin/git (found version "2.39.2 (Apple Git-143)") 

-- Component directory /Users/sam/.espressif/esp-matter/examples/common/blemesh_platform does not contain a CMakeLists.txt file. No component will be added
-- Component directory /Users/sam/.espressif/esp-matter/examples/common/external_platform does not contain a CMakeLists.txt file. No component will be added

-- Component directory /Users/sam/.espressif/esp-matter/examples/common/relinker does not contain a CMakeLists.txt file. No component will be added

CMake Error at /Users/sam/esp/esp-idf/tools/cmake/project.cmake:349 (message):
  Directory specified in EXTRA_COMPONENT_DIRS doesn't exist:
  /Users/sam/.espressif/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components
Call Stack (most recent call first):
  /Users/sam/esp/esp-idf/tools/cmake/project.cmake:433 (__project_init)
  CMakeLists.txt:44 (project)
I don't know anymore and i'm about to give up.

Anyway i guess my post has 3 goals:

1. Maybe someone has an idea what the issue is and can help me and others to work around this unfinished programming environment
2. Warn people to stay away or at least have them not be as frustrated as me for the past week
3. Be a hint towards the good people at Espressif - you do good boards but by god your software is pretty unusable.

Sry this turned into a bit of a rant and from this post onwards lets ignore the ranty part and focus on the fix. Maybe someone has an idea...

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: esp-idf + esp-matter + vsc not even compiling on examples

Postby ESP_bignacio » Wed Nov 01, 2023 11:19 am

Apologies for the bad experience with the vscode extension. Can you help us make it better for you ?

First, check the Troubleshooting section of the vscode extension. This information help us to understand your setup.

When you run the Install ESP-IDF Matter command, are you doing a full install or a partial command ?

You can check the install status in the output channel ESP-IDF (Menu View -> Output and choose ESP-IDF from the dropdown) What is the error you are getting, why is not installing ?

With regards to the examples. IF you did a shallow clone for specific platform, is likely that esp32c3 libraries are not available if you only cloned for esp32 target. Can you run the doctor command within the example project /Users/sam/Documents/wordclock_firmware2/light and check the current target the extension is recognizing? Is probably some mismatch with build IDF_TARGET and extension target.

ESP_Sayon
Posts: 1
Joined: Thu Nov 02, 2023 7:37 am

Re: esp-idf + esp-matter + vsc not even compiling on examples

Postby ESP_Sayon » Thu Nov 02, 2023 10:21 am

@ AnonTheEngenius
Can you please try the following steps:

1) Clonig the repositories:

Please follow the instructions here: https://docs.espressif.com/projects/esp ... positories [Please do not clone Esp-Matter inside ESP-IDF tools directory "/Users/Sam/.espressif/"]

2) Setting the ESP_MATTER_PATH:

Add "idf.espMatterPath":"/path/to/esp-matter/", in settings.json file inside .vscode folder

3) Setting the target for the device

you can set the ESP_MATTER_DEVICE_PATH inside vscode using command palette (Ctrl + Shift + P ). ESP-IDF:Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH).
By default it is set to esp32 device path you need to change it.
Once you have set the path appropriately for esp32c3 the build should work. The path for esp32c3 would be "/path/to/esp-matter/device_hal/device/esp32c3_devkit_m".

Make sure that the target set in vscode(bottom left) matches the ESP_MATTER_DEVICE_PATH

We will include the above steps in documentation. Thanks for feedback.

If you still face issue please comment.

AnonTheEngenius
Posts: 8
Joined: Sun Aug 27, 2023 6:35 pm

Re: esp-idf + esp-matter + vsc not even compiling on examples

Postby AnonTheEngenius » Fri Nov 03, 2023 10:20 am

Hi,

alright i did all you guys suggested and got the building process to start. However at the very last step the building process fails again, this time due to this error:

Code: Select all

warning: default on the choice symbol SEC_CERT_DAC_PROVIDER (defined at /Users/sam/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/Kconfig:827, /Users/sam/esp/esp-matter/components/esp_matter/Kconfig:41) will have no effect, as defaults do not affect choice symbols
warning: the choice symbol SEC_CERT_DAC_PROVIDER (defined at /Users/sam/esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/components/chip/Kconfig:827, /Users/sam/esp/esp-matter/components/esp_matter/Kconfig:41) is defined with a prompt outside the choice
[1091/1094] Building C object CMakeFiles/light.elf.dir/project_elf_src_esp32c3.c.obj
[1092/1094] Linking CXX executable light.elf
FAILED: light.elf 
...
/Users/sam/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/chip/lib/libCHIP.a(cryptopal_mbedtls.CHIPCryptoPALmbedTLS.cpp.o): in function `chip::Crypto::HKDF_sha::HKDF_SHA256(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int)':
/Users/sam/Documents/wordclock_firmware2/light/build/esp-idf/chip/../../../../../../esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:331: undefined reference to `mbedtls_hkdf'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Btw when installing the non shallow clone with the esp-matter install command in vs code it stops at some point due to their being a cycle of self referencing within the connectedhomeip repo that produces a path that is too long for vs code and it aborts.

Also please add the specific reasons for when to do a shallow clone and when not to to the documentation.

AnonTheEngenius
Posts: 8
Joined: Sun Aug 27, 2023 6:35 pm

Re: esp-idf + esp-matter + vsc not even compiling on examples

Postby AnonTheEngenius » Fri Nov 03, 2023 11:45 am

Update: in order to fix the mistake i tried cloning the esp-matter repo freshly this time not shallow but complete via command line exactly how it is described in this guide https://docs.espressif.com/projects/esp ... positories:

Unfortunately i get this error when executing the install.sh

Code: Select all

/Users/sam/esp/esp-matter/connectedhomeip/connectedhomeip/scripts/bootstrap.sh: line 97: /Users/sam/esp/esp-matter/connectedhomeip/connectedhomeip/third_party/pigweed/repo/pw_env_setup/util.sh: No such file or directory
Again, guys this should be tested. For some reason the linked repo there is not downloaded.

So i tried the shallow version again which fortunately works. Weird.

but everything again works until i build and get this error:

Code: Select all

[1092/1094] Linking CXX executable light.elf
FAILED: light.elf 
...
/Users/sam/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/chip/lib/libCHIP.a(cryptopal_mbedtls.CHIPCryptoPALmbedTLS.cpp.o): in function `chip::Crypto::HKDF_sha::HKDF_SHA256(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int)':
/Users/sam/Documents/wordclock_firmware2/light/build/esp-idf/chip/../../../../../../esp/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp:331: undefined reference to `mbedtls_hkdf'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

AnonTheEngenius
Posts: 8
Joined: Sun Aug 27, 2023 6:35 pm

Re: esp-idf + esp-matter + vsc not even compiling on examples

Postby AnonTheEngenius » Fri Nov 03, 2023 11:55 am

Ok found the solution:

https://github.com/espressif/esp-matter/issues/429

This should at least be mentioned in a guide, i think

Who is online

Users browsing this forum: No registered users and 91 guests