espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
683 stars 155 forks source link

ZAP error (CON-470) #369

Closed vallabh-d closed 1 year ago

vallabh-d commented 1 year ago

The light-switch in the example fails to build every time due to the zap-cli. I don't seem to find any solutions. Error Code : Searching for zcl file from /home/vallabh/MatterPrj/esp-matter/connectedhomeip/connectedhomeip/examples/light-switch-app/light-switch-common/light-switch-app.zap FAILED TO EXECUTE ZAP GENERATION: No such file or directory - "/home/vallabh/MatterPrj/esp-matter/.zap/zap-cli"


shubhamdp commented 1 year ago

zap-cli is needed to build the matter project.

Running install.sh installs zap-cli and sourcing export.sh exports the zap-cli path.

Can you check if .zap directory contains the zap-cli utility? If not re run the install.sh and then source the export.sh and it will fix the error.

dhrishi commented 1 year ago

@va1labh Please see if the above fixes your issue. It should ideally work

dhrishi commented 1 year ago

I am closing this. Please re-open if you still see the issue.

stage-01 commented 1 year ago

I'm getting this same issue. Re-running install.sh and sourcing export.sh doesn't seem to solve the issue. I'm using the latest branches of both esp-matter and esp-idf 5.1

topraveenpaul commented 1 year ago

I get the same error. Tried running install.sh and sourcing export.sh. Didnt work. The zap did not get install.

Do we have any working branch for esp-idf and esp-matter with clear instructions that can be followed so that one can blindly follow the same to make atleast the all-cluster-app work?

_Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/pi/esp-matter/examples/light/build/bootloader/bootloader.bin
[103/103] cd /home/pi/esp-matter/examples/light/build/bootloader/esp-idf/esptool_py && /home/pi/.espr... --offset 0xc000 bootloader 0x1000 /home/pi/esp-matter/examples/light/build/bootloader/bootloader.binBootloader binary size 0x6790 bytes. 0x4870 bytes (41%) free.
[638/1151] Performing configure step for 'chip_gn'Done. Made 298 targets from 236 files in 3239ms
[700/1151] 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
cd /home/pi/esp-matter/examples/light/build/esp-idf/chip && ninja esp32
[40/755] ACTION //third_party/connectedhomeip/src/controller/data_model:data_model_zapgen_zap_pregen(//third_party/connectedhomeip/config/esp32/toolchain:esp32)FAILED: gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/access.h gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/gen_config.h gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/endpoint_config.h gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/CHIPClientCallbacks.h gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/CHIPClusters.h gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated/IMClusterCommandHandler.cpp
python ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/third_party/pigweed/repo/pw_build/py/pw_build/python_runner.py --gn-root ../../../../../connectedhomeip/connectedhomeip/config/esp32/ --current-path ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model --default-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --current-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --capture-output --python-dep-list-files gen/third_party/connectedhomeip/src/controller/data_model/data_model_zapgen_zap_pregen_metadata_path_list.txt -- ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/tools/zap/generate.py --no-prettify-output --templates /home/pi/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/app/zap-templates/app-templates.json --output-dir /home/pi/esp-matter/examples/light/build/esp-idf/chip/gen/third_party/connectedhomeip/src/controller/data_model/zap_pregen/zap-generated --lock-file /home/pi/esp-matter/examples/light/build/esp-idf/chip/zap_gen.lock --parallel /home/pi/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model/controller-clusters.zap
Searching for zcl file from /home/pi/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model/controller-clusters.zap
FAILED TO EXECUTE ZAP GENERATION: No such file or directory - "/home/pi/esp-matter/connectedhomeip/connectedhomeip/.environment/cipd/packages/zap/zap-cli"
********************************************************************************
* You may need to install zap. Please ensure one of these applies:
* - `zap-cli` is in $PATH. Install from https://github.com/project-chip/zap/releases
*   see docs/guides/BUILDING.md for details
* - `zap-cli` is in $ZAP_INSTALL_PATH. Use this option if you
*   installed zap but do not want to update $PATH
* - Point $ZAP_DEVELOPMENT_PATH to your local copy of zap that you
*   develop on (to use a developer build of zap)
********************************************************************************
[41/755] ACTION //third_party/connectedhomeip/src/controller/data_model:data_model_codegen_codegen(//third_party/connectedhomeip/config/esp32/toolchain:esp32)FAILED: gen/third_party/connectedhomeip/src/controller/data_model/app/PluginApplicationCallbacks.h gen/third_party/connectedhomeip/src/controller/data_model/app/callback-stub.cpp
python ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/third_party/pigweed/repo/pw_build/py/pw_build/python_runner.py --gn-root ../../../../../connectedhomeip/connectedhomeip/config/esp32/ --current-path ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model --default-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --current-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --capture-output --python-dep-list-files gen/third_party/connectedhomeip/src/controller/data_model/data_model_codegen_codegen_metadata_path_list.txt -- ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py --generator cpp-app --output-dir gen/third_party/connectedhomeip/src/controller/data_model --expected-outputs gen/third_party/connectedhomeip/src/controller/data_model/data_model_codegen.expected.outputs ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model/controller-clusters.matter
Traceback (most recent call last):
  File "../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py", line 28, in <module>
    from matter_idl.matter_idl_parser import CreateParser
ModuleNotFoundError: No module named 'matter_idl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py", line 32, in <module>
    from matter_idl.matter_idl_parser import CreateParser
  File "/home/pi/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/py_matter_idl/matter_idl/matter_idl_parser.py", line 7, in <module>
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
[45/755] c++ obj/third_party/connectedhomeip/third_party/jsoncpp/repo/src/lib_json/jsoncpp.json_reader.cpp.oninja: build stopped: subcommand failed.
[705/1151] Building C object esp-idf/driver/CMakeFiles/__idf_driver.dir/ledc/ledc.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/pi/esp-matter/examples/light/build/log/idf_py_stderr_output_7226 and /home/pi/esp-matter/examples/light/build/log/idf_py_stdout_output_7226_

Here is another error while bootstrapping.

_  BOOTSTRAP! Bootstrap may take a few minutes; please be patient.

Downloading and installing packages into local source directory:

  Setting up CIPD package manager...done (14m29.3s)
  Setting up Python environment.....done (16m17.8s)
  Setting up pw packages............skipped (0.1s)
  Setting up Host tools.............done (0.1s)

Activating environment (setting environment variables):

  Setting environment variables for CIPD package manager...done
  Setting environment variables for Python environment.....done
  Setting environment variables for pw packages............skipped
  Setting environment variables for Host tools.............done

Checking the environment:

20230627 09:59:56,977 INF Environment passes all checks!

Environment looks good, you are ready to go!

To reactivate this environment in the future, run this in your
terminal:

  source ./activate.sh

To deactivate this environment, run this:

  deactivate

Building host tools

Done. Made 6568 targets from 325 files in 3961ms
ninja: Entering directory `/home/pi/esp-matter/connectedhomeip/connectedhomeip/out/host'
ninja: error: '../../third_party/libwebsockets/repo/lib/core-net/adopt.c', needed by 'obj/third_party/libwebsockets/repo/lib/core-net/libwebsockets.adopt.c.o', missing and no known rule to make it
pi@matter-controller1:~/esp-matter$ cd ../esp-idf/

_

shubhamdp commented 1 year ago

@topraveenpaul Have you installed the prerequisites as per the documentation?

topraveenpaul commented 1 year ago

@shubhamdp //Yes, i followed the perquisites strictly.

We are working on a POC and was considering the esp32 boards and sdk to use for that.

Im doing it in a Rpi 3 B+ loaded with Ubuntu 20.04 LTS

sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \
     libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \
     python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev

sudo apt-get install pi-bluetooth avahi-utils

Edited the below file sudo nano /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service and updated with ExecStart=/sbin/wpa_supplicant -u -s -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf And Edited sudo nano /etc/wpa_supplicant/wpa_supplicant.conf Updated with

ctrl_interface=DIR=/run/wpa_supplicant
update_config=1

Rebooted Pi.

Then proceeded with installation of

git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf; git checkout v4.4.2; git submodule update --init --recursive;
./install.sh
cd ..

git clone --depth 1 https://github.com/espressif/esp-matter.git
cd esp-matter
git submodule update --init --depth 1
./connectedhomeip/connectedhomeip/scripts/checkout_submodules.py --platform esp32 --shallow
./install.sh
cd ..

cd esp-idf; . ./export.sh; cd ..
cd esp-matter; . ./export.sh; cd ..

export IDF_CCACHE_ENABLE=1
cd esp-matter
cd examples/light
idf.py set-target esp32c3 build

Also tried with esp-idf git checkout v4.4.4, 5.0

stage-01 commented 1 year ago

try adding these requirements before installing:

cd ~/.espressif/esp-matter python3 -m pip install -r requirements.txt

shubhamdp commented 1 year ago

As suggested by @stage-01 and the documentation here, you have to source the IDF environment before executing esp-matter/install.sh

topraveenpaul commented 1 year ago

Thank you. Apparently my Rpi board may have issues as I see the solid green light is on for extended period of time. So i need to try this out on a new board and will update if there are still problems.

luftaquila commented 10 months ago

Same issue here. There was no problem when installing it on WSL2, but it failed while installing it on RPi 3B.

Doubt that ./install.sh cannot handle the zap installation on the Linux ARM architecture (https://github.com/espressif/connectedhomeip/blob/v1.1-branch/docs/guides/BUILDING.md#linux-arm).