Compilation issue while building connectedhomeip sample for arduino nano 33 ble board

Development Environment: icore7 laptop running Ubuntu 20.04.2 LTS.

Target: To build connectedhomeip sample application for arduino nano 33 ble board and check against laptop as a controller.

Installed nRF Connect SDK manually as mentioned in the link: (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html). Once completed, tried to build connectedhomeip samples as present in the path: ~/ncs/nrf/samples/connectedhomeip. Build mentioned zephyr SDK was missing and needs to be installed as mentioned in zephyrproject.org documentaiton, which i installed.

```

nrf-connect-sdk@root1-Nitro-AN515-55:~/ncs/nrf/samples/connectedhomeip/light_bulb$ west build -b arduino_nano_33_ble
-- west build: generating a build system
Including boilerplate (Zephyr base): /home/nrf-connect-sdk/ncs/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb
-- Zephyr version: 2.4.99 (/home/nrf-connect-sdk/ncs/zephyr)
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: arduino_nano_33_ble
-- Cache files will be written to: /home/nrf-connect-sdk/.cache/zephyr
ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
CMake Error at /home/nrf-connect-sdk/ncs/zephyr/cmake/toolchain/zephyr/host-tools.cmake:124 (message):
  The SDK version you are using is not supported, please update your SDK.

  You need SDK version 0.11.1 or newer.

  You have version(s):

 

  The SDK can be downloaded from:

 
  github.com/.../zephyr-sdk-0.11.3-setup.run


  Note: If you are using SDK 0.11.1 or 0.11.2, remember to set
  ZEPHYR_SDK_INSTALL_DIR and ZEPHYR_TOOLCHAIN_VARIANT

Call Stack (most recent call first):
  /home/nrf-connect-sdk/ncs/zephyr/cmake/host-tools.cmake:3 (include)
  /home/nrf-connect-sdk/ncs/zephyr/cmake/app/boilerplate.cmake:514 (include)
  /home/nrf-connect-sdk/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /home/nrf-connect-sdk/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build -S/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb -GNinja -DBOARD=arduino_nano_33_ble

```

Installing zephyr-sdk solved this problem, but however it failed during compilation as below:

```

nrf-connect-sdk@root1-Nitro-AN515-55:~/ncs/nrf/samples/connectedhomeip/light_bulb$ export ZEPHYR_SDK_INSTALL_DIR=/home/nrf-connect-sdk/zephyr-sdk-0.12.4
nrf-connect-sdk@root1-Nitro-AN515-55:~/ncs/nrf/samples/connectedhomeip/light_bulb$ export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
nrf-connect-sdk@root1-Nitro-AN515-55:~/ncs/nrf/samples/connectedhomeip/light_bulb$ west build -b arduino_nano_33_ble
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): /home/nrf-connect-sdk/ncs/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb
-- Zephyr version: 2.4.99 (/home/nrf-connect-sdk/ncs/zephyr)
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: arduino_nano_33_ble
-- Cache files will be written to: /home/nrf-connect-sdk/.cache/zephyr
-- Found toolchain: zephyr (/home/nrf-connect-sdk/zephyr-sdk-0.12.4)
-- Found dtc: /home/nrf-connect-sdk/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/nrf-connect-sdk/ncs/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble.dts
-- Generated zephyr.dts: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/include/generated/device_extern.h
Parsing /home/nrf-connect-sdk/ncs/zephyr/Kconfig
Loaded configuration '/home/nrf-connect-sdk/ncs/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig'
Merged configuration '/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/prj.conf'
Configuration saved to '/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/.config'
Kconfig header saved to '/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/nrf-connect-sdk/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- CMake build type: Debug
-- Version: gaad6518ee
-- Found Python3: /usr/bin/python3.8 (found version "3.8.5") found components: Interpreter
CMake Warning at /home/nrf-connect-sdk/ncs/zephyr/CMakeLists.txt:1385 (message):
 

        The CMake build type was set to 'Debug', but the optimization flag was set to '-Os'.
        This may be intentional and the warning can be turned off by setting the CMake variable 'NO_BUILD_TYPE_WARNING'


-- Configuring done
-- Generating done
-- Build files have been written to: /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build
-- west build: building application
[1/608] Preparing syscall dependency handling

[273/608] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj
ccache /home/nrf-connect-sdk/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DBUILD_VERSION=v2.4.99-ncs2 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DNRF52840_XXAA -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -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_CSMA_CA_ENABLED=1 -DNRF_802154_DELAYED_TRX_ENABLED=1 -DNRF_802154_FRAME_TIMESTAMP_ENABLED=1 -DNRF_802154_IFS_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_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -DNRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL=1 -DOPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/nrf-connect-sdk/ncs/zephyr/kernel/include -I/home/nrf-connect-sdk/ncs/zephyr/arch/arm/include -I/home/nrf-connect-sdk/ncs/nrf/drivers/mpsl/clock_control -I/home/nrf-connect-sdk/ncs/zephyr/include -Izephyr/include/generated -I/home/nrf-connect-sdk/ncs/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/nrf-connect-sdk/ncs/zephyr/lib/libc/newlib/include -I/home/nrf-connect-sdk/ncs/zephyr/lib/fnmatch/. -I/home/nrf-connect-sdk/ncs/zephyr/subsys/net/lib/sockets/. -I/home/nrf-connect-sdk/ncs/zephyr/subsys/net/lib/openthread/platform/. -I/home/nrf-connect-sdk/ncs/zephyr/subsys/settings/include -I/home/nrf-connect-sdk/ncs/zephyr/subsys/bluetooth -I/home/nrf-connect-sdk/ncs/nrf/include -I/home/nrf-connect-sdk/ncs/nrf/lib/multithreading_lock/. -I/home/nrf-connect-sdk/ncs/nrf/subsys/bluetooth/controller/. -I/home/nrf-connect-sdk/ncs/nrfxlib/nfc/include -I/home/nrf-connect-sdk/ncs/nrfxlib/mpsl/include -Imodules/nrfxlib/nrf_security/include -Imodules/nrfxlib/nrf_security/include/mbedtls_generated -I/home/nrf-connect-sdk/ncs/mbedtls/include -I/home/nrf-connect-sdk/ncs/mbedtls/include/mbedtls -I/home/nrf-connect-sdk/ncs/nrfxlib/softdevice_controller/include -I/home/nrf-connect-sdk/ncs/nrfxlib/nrf_802154_sl/include -I/home/nrf-connect-sdk/ncs/modules/hal/nordic/drivers/nrf_radio_802154/src -I/home/nrf-connect-sdk/ncs/modules/hal/nordic/nrfx -I/home/nrf-connect-sdk/ncs/modules/hal/nordic/nrfx/drivers/include -I/home/nrf-connect-sdk/ncs/modules/hal/nordic/nrfx/mdk -I/home/nrf-connect-sdk/ncs/zephyr/modules/hal_nordic/nrfx/. -I/home/nrf-connect-sdk/ncs/modules/hal/cmsis/CMSIS/Core/Include -I/home/nrf-connect-sdk/ncs/modules/crypto/tinycrypt/lib/include -I/home/nrf-connect-sdk/ncs/zephyr/../nrfxlib/crypto/nrf_cc310_platform/include -Imodules/openthread/build/etc/cmake -I/home/nrf-connect-sdk/ncs/modules/lib/openthread/etc/cmake -I/home/nrf-connect-sdk/ncs/modules/lib/openthread/include -isystem /home/nrf-connect-sdk/ncs/modules/lib/openthread/zephyr/../include -isystem /home/nrf-connect-sdk/ncs/modules/lib/openthread/zephyr/../examples/platforms -isystem /home/nrf-connect-sdk/ncs/nrfxlib/crypto/nrf_cc310_platform/include -g   -Os -imacros /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros /home/nrf-connect-sdk/ncs/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/nrf-connect-sdk/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/nrf-connect-sdk/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj -MF zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_nvs.c.obj   -c /home/nrf-connect-sdk/ncs/zephyr/subsys/settings/src/settings_nvs.c
In file included from /home/nrf-connect-sdk/ncs/zephyr/include/arch/arm/aarch32/arch.h:20,
                 from /home/nrf-connect-sdk/ncs/zephyr/include/arch/cpu.h:19,
                 from /home/nrf-connect-sdk/ncs/zephyr/include/kernel_includes.h:33,
                 from /home/nrf-connect-sdk/ncs/zephyr/include/kernel.h:17,
                 from /home/nrf-connect-sdk/ncs/zephyr/include/fs/nvs.h:11,
                 from /home/nrf-connect-sdk/ncs/zephyr/subsys/settings/include/settings/settings_nvs.h:11,
                 from /home/nrf-connect-sdk/ncs/zephyr/subsys/settings/src/settings_nvs.c:12:
/home/nrf-connect-sdk/ncs/zephyr/subsys/settings/src/settings_nvs.c: In function 'settings_backend_init':
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree/fixed-partitions.h:53:9: error: 'DT_COMPAT_fixed_partitions_LABEL_storage_PARTITION_ID' undeclared (first use in this function); did you mean 'DT_COMPAT_fixed_partitions_LABEL_code_EXISTS'?
   53 |  DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
 2176 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/home/nrf-connect-sdk/ncs/zephyr/include/storage/flash_map.h:267:2: note: in expansion of macro 'DT_FIXED_PARTITION_ID'
  267 |  DT_FIXED_PARTITION_ID(DT_NODE_BY_FIXED_PARTITION_LABEL(label))
      |  ^~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree/fixed-partitions.h:53:2: note: in expansion of macro 'DT_CAT'
   53 |  DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)
      |  ^~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/storage/flash_map.h:267:24: note: in expansion of macro 'DT_NODE_BY_FIXED_PARTITION_LABEL'
  267 |  DT_FIXED_PARTITION_ID(DT_NODE_BY_FIXED_PARTITION_LABEL(label))
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/subsys/settings/src/settings_nvs.c:275:23: note: in expansion of macro 'FLASH_AREA_ID'
  275 |  rc = flash_area_open(FLASH_AREA_ID(storage), &fa);
      |                       ^~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree/fixed-partitions.h:53:9: note: each undeclared identifier is reported only once for each function it appears in
   53 |  DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
 2176 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/home/nrf-connect-sdk/ncs/zephyr/include/storage/flash_map.h:267:2: note: in expansion of macro 'DT_FIXED_PARTITION_ID'
  267 |  DT_FIXED_PARTITION_ID(DT_NODE_BY_FIXED_PARTITION_LABEL(label))
      |  ^~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/devicetree/fixed-partitions.h:53:2: note: in expansion of macro 'DT_CAT'
   53 |  DT_CAT(DT_COMPAT_fixed_partitions_LABEL_, label)
      |  ^~~~~~
/home/nrf-connect-sdk/ncs/zephyr/include/storage/flash_map.h:267:24: note: in expansion of macro 'DT_NODE_BY_FIXED_PARTITION_LABEL'
  267 |  DT_FIXED_PARTITION_ID(DT_NODE_BY_FIXED_PARTITION_LABEL(label))
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nrf-connect-sdk/ncs/zephyr/subsys/settings/src/settings_nvs.c:275:23: note: in expansion of macro 'FLASH_AREA_ID'
  275 |  rc = flash_area_open(FLASH_AREA_ID(storage), &fa);
      |                       ^~~~~~~~~~~~~
[286/608] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/ieee802154/ieee802154_nrf5.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/nrf-connect-sdk/ncs/nrf/samples/connectedhomeip/light_bulb/build

```

Related