NRF v.2.6.0 - cannot find source file error

We just upgraded to NRF V2.6.0 and ran into the following build error when building the Matter light_bulb sample:

CMake Error at /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/extensions.cmake:424 (add_library):
Cannot find source file:

/opt/nordic/ncs/v2.6.0/nrf/samples/matter/common/src/led_widget.cpp

Sure enough, this file doesn't exist. It seems to have been moved to this subdirectory:

/opt/nordic/ncs/v2.6.0/nrf/samples/matter/common/src/board/led_widget.cpp

I had thought I would be able to modify the relevant cmake files but it's not obvious to me how to do so.

Thanks for you help! Dan.

Environment: MacOS, SDK v.2.6.0, VS Code

Detailed log output:

CMake Error at /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/extensions.cmake:424 (add_library):
  Cannot find source file:

    /opt/nordic/ncs/v2.6.0/nrf/samples/matter/common/src/led_widget.cpp
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/kernel.cmake:211 (zephyr_library_named)
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:23 (find_package)


CMake Error at /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/extensions.cmake:424 (add_library):
  No SOURCES given to target: app
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/kernel.cmake:211 (zephyr_library_named)
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:23 (find_package)


CMake Generate step failed.  Build files cannot be regenerated correctly.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/580e4ef81c/bin/cmake -DWEST_PYTHON=/opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 -B/Users/ydr/dev/nordic/light_bulb_2.6/build -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION=NONE '-DBOARD_ROOT=/Users/ydr/dev/nordic;/Users/ydr/dev/nordic/light_bulb_2.6' -Dmcuboot_CONF_FILE=/Users/ydr/dev/nordic/light_bulb_2.6/child_image/mcuboot/prj.conf '-Dmcuboot_DTC_OVERLAY_FILE=/opt/nordic/ncs/v2.6.0/nrf/modules/mcuboot/flash_sim.overlay;/Users/ydr/dev/nordic/light_bulb_2.6/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay' '-Dmcuboot_OVERLAY_CONFIG=/opt/nordic/ncs/v2.6.0/nrf/subsys/pcd/pcd.conf;/opt/nordic/ncs/v2.6.0/nrf/subsys/partition_manager/ext_flash_mcuboot_secondary.conf;/opt/nordic/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf' -Dmultiprotocol_rpmsg_CONF_FILE=/Users/ydr/dev/nordic/light_bulb_2.6/child_image/multiprotocol_rpmsg/prj.conf '-Dmultiprotocol_rpmsg_OVERLAY_CONFIG=/opt/nordic/ncs/v2.6.0/nrf/subsys/bootloader/image/secure_boot.conf;/opt/nordic/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf' -DCACHED_CONF_FILE=/Users/ydr/dev/nordic/light_bulb_2.6/prj.conf -DDTC_OVERLAY_FILE=/Users/ydr/dev/nordic/light_bulb_2.6/boards/nrf5340dk_nrf5340_cpuapp.overlay -S/Users/ydr/dev/nordic/light_bulb_2.6

  • Hi,

    Here is a diff that shows the changes you must make to CMakeLists to fix this problem:

    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index 122c6e5..94878c6 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -24,38 +24,24 @@ find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
     
     project(light_bulb)
     
    -set(COMMON_ROOT ${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common)
    -set(NLIO_ROOT ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/third_party/nlio/repo)
     include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)
     include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/chip_data_model.cmake)
     
     # NORDIC SDK APP START
    +
    +# Include all source files that are located in the Matter common directory.
    +include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/source_common.cmake)
    +
     target_include_directories(app PRIVATE
         src
    -    ${COMMON_ROOT}/src
    -    ${NLIO_ROOT}/include
    -    ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/zzz_generated/app-common
     )
     
     target_sources(app PRIVATE
         src/app_task.cpp
         src/main.cpp
         src/zcl_callbacks.cpp
    -    src/zap-generated/IMClusterCommandHandler.cpp
    -    src/zap-generated/callback-stub.cpp
    -    ${COMMON_ROOT}/src/led_widget.cpp
    -    ${COMMON_ROOT}/src/pwm_device.cpp
     )
     
    -if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
    -    target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
    -endif()
    -
    -if(CONFIG_MCUMGR_TRANSPORT_BT)
    -    zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)
    -    target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu_over_smp.cpp)
    -endif()
    -
     chip_configure_data_model(app
         INCLUDE_SERVER
         BYPASS_IDL
    

    Please note that there have been a lot of changes to Matter between nRF Connect SDK v2.5.2 and v2.6.0, so I strongly recommend going through the Matter-specific parts of the Migration guide for nRF Connect SDK v2.6.0.

    Best regards,
    Marte

Related