Cannot compile Matter Template sample after regenerating ZAP files

Hi,

I have installed nRF Connect 2.5.0 on a Windows 11 pc. My goal is to build a simple Matter button.

I have installed the ZAP tool using the python script (Matter tools — nRF Connect SDK 2.5.99 documentation (nordicsemi.com)) and version 2023.4.27 was installed.

I copy the Template project (ncs\v2.5.0\nrf\samples\matter\template) to my own directory. It compiles successfully.

I then try and add my own clusters, as mentioned in this guide:  Adding clusters to Matter application — nRF Connect SDK 2.5.99 documentation (nordicsemi.com)

The first issue I encounter is this when opening the template.zap file is this

"The template.zap requires feature level 99, we only have level 96."

I downloaded an updated version of the ZAP tool from its website and unpacked that. It is version 2023.12.6

I then generate the files using the script generate.py mentioned in the guide. I have not made *any* changes to the ZAP file (expect the relative path for the zcl.json and app-templates.json files)

===

Searching for zcl file from D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/template.zap
Wrench Using temporary state directory: C:\Users\Tomas\AppData\Local\Temp\zap005kw9af\zap.9y479c
Robot ZAP generation started:
 Mag input files: D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/template.zap
 Mag output pattern: D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/zap-generated
 Mag using templates: D:/Development/connectedhomeip/src/app/zap-templates/app-templates.json
 Mag using zcl data: D:\Development\ncs\v2.5.0\modules\lib\matter\src\app\zap-templates\zcl\zcl.json
 Mag zap version: ver. 2023.12.6, featureLevel 99, commit: 0aed125529d4a5f4d2741a5c4bb446568b9e7bc4 from 2023-12-06T13:43:13.000Z, mode: binary, exe: zap-cli
Clock1 Setup time: 1s 11ms
Point right using input file: D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/template.zap
Point right using output destination: D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/zap-generated
Clock1 File loading time: 36ms
Robot Generating files:
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\gen_config.h
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\IMClusterCommandHandler.cpp
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\CHIPClusters.h
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\CHIPClientCallbacks.h
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\endpoint_config.h
 Writing hand D:\Development\energy-and-smart-home-utilities\Gizmos\Matter\TouchButton\nrfconnect\src\zap-generated\access.h
Clock1 Generation time: 250ms
clang-format error: [WinError 2] The system cannot find the file specified
Files generated in: D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/src/zap-generated

===

You'll notice that it does mention a WinError2 The system cannot file the file specified, but the files are generated.

When I then try to compile the application, I get lots of errors:

===

[INFO] Validating JSON with schema...

[INFO] Validate OK

[414/482] Performing build step for 'chip-gn'
Starting Matter library build in D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/build/modules/connectedhomeip
Done. Made 198 targets from 186 files in 106ms
[385/385] stamp obj/ABS_PATH/D/Development/ncs/v2.5.0/modules/lib/matter/config/nrfconnect/chip-gn/default.stamp
Matter library build complete
[460/482] Building CXX object CMakeFiles/app.dir/src/zap-generated/IMClusterCommandHandler.cpp.obj
FAILED: CMakeFiles/app.dir/src/zap-generated/IMClusterCommandHandler.cpp.obj
D:\Development\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-g++.exe -DCHIP_BYPASS_IDL -DCHIP_HAVE_CONFIG_H -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF52840_XXAA -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_CARRIER_FUNCTIONS_ENABLED=0 -DNRF_802154_CCA_CORR_LIMIT_DEFAULT=2 -DNRF_802154_CCA_CORR_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_ED_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED -DNRF_802154_ECB_PRIORITY=-1 -DNRF_802154_ENCRYPTION_ENABLED=1 -DNRF_802154_ENERGY_DETECTED_VERSION=1 -DNRF_802154_IE_WRITER_ENABLED=1 -DNRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 -DNRF_802154_PENDING_EXTENDED_ADDRESSES=16 -DNRF_802154_PENDING_SHORT_ADDRESSES=16 -DNRF_802154_RX_BUFFERS=16 -DNRF_802154_SECURITY_WRITER_ENABLED=1 -DNRF_802154_SERIALIZATION_HOST=0 -DNRF_802154_SWI_PRIORITY=1 -DNRF_802154_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -DUSE_PARTITION_MANAGER=1 -DZCBOR_ASSERTS -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../src -ID:/Development/ncs/v2.5.0/nrf/samples/matter/common/src -ID:/Development/ncs/v2.5.0/modules/lib/matter/third_party/nlio/repo/include -ID:/Development/ncs/v2.5.0/modules/lib/matter/zzz_generated/app-common -I../src/zap-generated -ID:/Development/ncs/v2.5.0/nrf/drivers/mpsl/clock_control -ID:/Development/ncs/v2.5.0/zephyr/include -Izephyr/include/generated -ID:/Development/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/nrf52 -ID:/Development/ncs/v2.5.0/zephyr/lib/libc/newlib/include -ID:/Development/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/common/. -ID:/Development/ncs/v2.5.0/zephyr/subsys/bluetooth -ID:/Development/ncs/v2.5.0/zephyr/subsys/net/lib/sockets/. -ID:/Development/ncs/v2.5.0/zephyr/subsys/settings/include -ID:/Development/ncs/v2.5.0/nrf/include -ID:/Development/ncs/v2.5.0/nrf/lib/multithreading_lock/. -ID:/Development/ncs/v2.5.0/nrf/subsys/bluetooth/controller/. -ID:/Development/ncs/v2.5.0/zephyr/drivers/flash -ID:/Development/ncs/v2.5.0/nrf/tests/include -ID:/Development/ncs/v2.5.0/zephyr/modules/openthread/platform/. -ID:/Development/ncs/v2.5.0/modules/hal/cmsis/CMSIS/Core/Include -ID:/Development/ncs/v2.5.0/zephyr/modules/cmsis/. -ID:/Development/ncs/v2.5.0/modules/hal/nordic/nrfx -ID:/Development/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include -ID:/Development/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk -ID:/Development/ncs/v2.5.0/zephyr/modules/hal_nordic/nrfx/. -ID:/Development/ncs/v2.5.0/modules/lib/zcbor/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/common/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/nrf21540_gpio/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/simple_gpio/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/fem/include/protocol -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/include -ID:/Development/ncs/v2.5.0/nrfxlib/mpsl/include/protocol -ID:/Development/ncs/v2.5.0/nrfxlib/openthread/include -Imodules/nrf/subsys/nrf_security/src/include/generated -ID:/Development/ncs/v2.5.0/nrf/subsys/nrf_security/include -ID:/Development/ncs/v2.5.0/nrf/ext/oberon/psa/core/include -ID:/Development/ncs/v2.5.0/nrf/ext/oberon/psa/core/library -ID:/Development/ncs/v2.5.0/modules/crypto/mbedtls/include -ID:/Development/ncs/v2.5.0/modules/crypto/mbedtls/library -ID:/Development/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include -ID:/Development/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -ID:/Development/ncs/v2.5.0/nrf/ext/oberon/psa/drivers -ID:/Development/ncs/v2.5.0/nrfxlib/nrf_802154/driver/include -ID:/Development/ncs/v2.5.0/nrfxlib/nrf_802154/sl/include -ID:/Development/ncs/v2.5.0/nrfxlib/nrf_802154/common/include -ID:/Development/ncs/v2.5.0/nrfxlib/softdevice_controller/include -ID:/Development/ncs/v2.5.0/modules/lib/matter/src -ID:/Development/ncs/v2.5.0/modules/lib/matter/src/include -ID:/Development/ncs/v2.5.0/modules/lib/matter/third_party/nlassert/repo/include -Imodules/connectedhomeip/gen/include -ID:/Development/ncs/v2.5.0/modules/lib/matter/examples/providers -isystem D:/Development/ncs/v2.5.0/nrfxlib/crypto/nrf_cc310_platform/include "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" -fno-strict-aliasing -Os -fcheck-new -std=c++14 -fno-exceptions -fno-rtti -imacros D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=D:/Development/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros D:/Development/ncs/v2.5.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=D:/Development/energy-and-smart-home-utilities/Gizmos/Matter/TouchButton/nrfconnect=CMAKE_SOURCE_DIR -fmacro-prefix-map=D:/Development/ncs/v2.5.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=D:/Development/ncs/v2.5.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -D_POSIX_THREADS -std=gnu++17 -D_SYS__PTHREADTYPES_H_ -MD -MT CMakeFiles/app.dir/src/zap-generated/IMClusterCommandHandler.cpp.obj -MF CMakeFiles\app.dir\src\zap-generated\IMClusterCommandHandler.cpp.obj.d -o CMakeFiles/app.dir/src/zap-generated/IMClusterCommandHandler.cpp.obj -c ../src/zap-generated/IMClusterCommandHandler.cpp
../src/zap-generated/IMClusterCommandHandler.cpp: In function 'void chip::app::Clusters::NetworkCommissioning::DispatchServerCommand(chip::app::CommandHandler*, const chip::app::ConcreteCommandPath&, chip::TLV::TLVReader&)':
../src/zap-generated/IMClusterCommandHandler.cpp:292:22: error: 'emberAfNetworkCommissioningClusterScanNetworksCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerTickCallback'?
292 | wasHandled = emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterServerTickCallback
../src/zap-generated/IMClusterCommandHandler.cpp:292:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterScanNetworksCallback'
../src/zap-generated/IMClusterCommandHandler.cpp:300:22: error: 'emberAfNetworkCommissioningClusterAddOrUpdateWiFiNetworkCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerInitCallback'?
300 | wasHandled = emberAfNetworkCommissioningClusterAddOrUpdateWiFiNetworkCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterServerInitCallback
../src/zap-generated/IMClusterCommandHandler.cpp:300:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterAddOrUpdateWiFiNetworkCallback'
../src/zap-generated/IMClusterCommandHandler.cpp:308:22: error: 'emberAfNetworkCommissioningClusterAddOrUpdateThreadNetworkCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerTickCallback'?
308 | wasHandled = emberAfNetworkCommissioningClusterAddOrUpdateThreadNetworkCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterServerTickCallback
../src/zap-generated/IMClusterCommandHandler.cpp:308:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterAddOrUpdateThreadNetworkCallback'
../src/zap-generated/IMClusterCommandHandler.cpp:316:22: error: 'emberAfNetworkCommissioningClusterRemoveNetworkCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerTickCallback'?
316 | wasHandled = emberAfNetworkCommissioningClusterRemoveNetworkCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterServerTickCallback
../src/zap-generated/IMClusterCommandHandler.cpp:316:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterRemoveNetworkCallback'
../src/zap-generated/IMClusterCommandHandler.cpp:324:22: error: 'emberAfNetworkCommissioningClusterConnectNetworkCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterClientTickCallback'?
324 | wasHandled = emberAfNetworkCommissioningClusterConnectNetworkCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterClientTickCallback
../src/zap-generated/IMClusterCommandHandler.cpp:324:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterConnectNetworkCallback'
../src/zap-generated/IMClusterCommandHandler.cpp:332:22: error: 'emberAfNetworkCommissioningClusterReorderNetworkCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerTickCallback'?
332 | wasHandled = emberAfNetworkCommissioningClusterReorderNetworkCallback(apCommandObj, aCommandPath, commandData);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| emberAfNetworkCommissioningClusterServerTickCallback
../src/zap-generated/IMClusterCommandHandler.cpp:332:22: note: maximum limit of 1000 namespaces searched for 'emberAfNetworkCommissioningClusterReorderNetworkCallback'
[465/482] Building CXX object CMakeFiles/app.dir/D_/Development/ncs/v2.5.0/modules/lib/matter/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp.obj
ninja: build stopped: subcommand failed.

===

How can I resolve this?

Parents Reply Children
  • Unfortunately, I get the same error:

    erated/IMClusterCommandHandler.cpp.obj -MF CMakeFiles\app.dir\src\zap-generated\IMClusterCommandHandler.cpp.obj.d -o CMakeFiles/app.dir/src/zap-generated/IMClusterCommandHandler.cpp.obj -c ../src/zap-generated/IMClusterCommandHandler.cpp
    ../src/zap-generated/IMClusterCommandHandler.cpp: In function 'void chip::app::Clusters::NetworkCommissioning::DispatchServerCommand(chip::app::CommandHandler*, const chip::app::ConcreteCommandPath&, chip::TLV::TLVReader&)':
    ../src/zap-generated/IMClusterCommandHandler.cpp:292:22: error: 'emberAfNetworkCommissioningClusterScanNetworksCallback' was not declared in this scope; did you mean 'emberAfNetworkCommissioningClusterServerTickCallback'?
    292 | wasHandled = emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, aCommandPath, commandData);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | emberAfNetworkCommissioningClusterServerTickCallback

    I tried a similar process with the light_switch project as you suggested. I copied it to a new location and edited the ZAP file using the same python scripts. It compiles and I can flash it to my development kit.

  • Hello,

    I have not been able to reproduce this on Windows 10. I'm not sure if it is a Windows 11 issue, or if the cause is something else.

    I have also tried to find the Dispatch Server command in the Matter 1.1 specification, but I have not been successful.

    Check the points below which I have put in order of likelihood:

    • The .zap directory contains initialization data for the ZAP tool which can cause errors when updating the ZAP tool. Delete the directory and restart ZAP tool. By default, the directory is  located in C:/Users/<username>.
    • You could have an incompatible version for some required tools. Can you verify that you have the necessary requirements for NCS v2.5.0 as listed here?

    Best regards,

    Maria

Related