fatal error: mbedtls/bignum.h: No such file or directory

Hello, I've tried a few a few combinations of nrfconnect/sdk-nrf branches, but I can't seem to get `CONFIG_CHIP=y` builds to work.

I'm using the following `prj.conf`:

CONFIG_BOOTLOADER_MCUBOOT=y

# CPP 17 or greater required
CONFIG_CHIP=y
CONFIG_STD_CPP17=y

I'm using ZEPHYR_TOOLCHAIN_VARIANT="gnuarmemb" and running `west build -b particle_xenon`. The build command that is failing (with spaces converted to newlines) is:

/nix/store/4rnf1zlpv24jwgk1hd3m9l2pffjdd3an-gcc-arm-embedded-10.3.1/bin/arm-none-eabi-g++
-MMD
-MF
obj/src/crypto/libChipCrypto.CHIPCryptoPALmbedTLS.cpp.o.d
-Wconversion
-mthumb
-Os
-g2
-fno-common
-ffunction-sections
-fdata-sections
-fno-exceptions
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-Wall
-Werror
-Wstack-usage=8192
-Wextra
-Wshadow
-Wunreachable-code
-Wvla
-Wformat
-Wformat-nonliteral
-Wformat-security
-Wno-deprecated-declarations
-Wno-unknown-warning-option
-Wno-maybe-uninitialized
-Wno-missing-field-initializers
-Wno-unused-parameter
-Wno-unused
-Wno-psabi
-Wno-cast-function-type
-fdiagnostics-color
-fno-strict-aliasing
-D_SYS__PTHREADTYPES_H_
-isystem/home/kenny/src/ncs/zephyr/include/posix
-std=gnu++14
-fno-rtti
-Wnon-virtual-dtor
-isystem/home/kenny/src/ncs/zephyr/include
-isystem/home/kenny/src/ble/matter/build/zephyr/include/generated
-isystem/home/kenny/src/ncs/zephyr/soc/arm/nordic_nrf/nrf52
-isystem/home/kenny/src/ncs/zephyr/lib/libc/newlib/include
-isystem/home/kenny/src/ncs/zephyr/soc/arm/nordic_nrf/common/.
-isystem/home/kenny/src/ncs/nrf/include
-isystem/home/kenny/src/ncs/modules/hal/cmsis/CMSIS/Core/Include
-isystem/home/kenny/src/ncs/modules/hal/nordic/nrfx
-isystem/home/kenny/src/ncs/modules/hal/nordic/nrfx/drivers/include
-isystem/home/kenny/src/ncs/modules/hal/nordic/nrfx/mdk
-isystem/home/kenny/src/ncs/zephyr/modules/hal_nordic/nrfx/.
-DKERNEL
-D__ZEPHYR__=1
-D_FORTIFY_SOURCE=2
-D__LINUX_ERRNO_EXTENSIONS__
-DUSE_PARTITION_MANAGER=1
-D__PROGRAM_START
-DNRF52840_XXAA
-fcheck-new
-std=c++17
-fno-exceptions
-fno-rtti
-imacros
/home/kenny/src/ble/matter/build/zephyr/include/generated/autoconf.h
-ffreestanding
-fdiagnostics-color=always
-mcpu=cortex-m4
-mthumb
-mabi=aapcs
-mfp16-format=ieee
-imacros
/home/kenny/src/ncs/zephyr/include/toolchain/zephyr_stdint.h
-fno-pie
-fno-pic
-fmacro-prefix-map=/home/kenny/src/ble/matter=CMAKE_SOURCE_DIR
-fmacro-prefix-map=/home/kenny/src/ncs/zephyr=ZEPHYR_BASE
-fmacro-prefix-map=/home/kenny/src/ncs=WEST_TOPDIR
-specs=nano.specs
-std=gnu++17
-DNDEBUG
-DCHIP_HAVE_CONFIG_H=1
-I../../../../../ncs/modules/lib/matter/src/include
-I../../../../../ncs/modules/lib/matter/src
-Igen/include
-I../../../../../ncs/modules/lib/matter/zzz_generated/app-common
-I../../../../../ncs/modules/lib/matter/third_party/nlassert/repo/include
-I../../../../../ncs/modules/lib/matter/third_party/nlio/repo/include
-c
../../../../../ncs/modules/lib/matter/src/crypto/CHIPCryptoPALmbedTLS.cpp
-o
obj/src/crypto/libChipCrypto.CHIPCryptoPALmbedTLS.cpp.o

Any idea why this isn't working?

Parents
  • Hello, 

    Could you please elaborate on what you are trying to achieve? What version of nRF Connect SDK are you working with? When using CONFIG_CHIP it selects CONFIG_CPLUSPLUS as well.

    Kind regards,
    Øyvind

  • Thanks. I wanted to build this by building up from nothing and adding what's needed, but I guess I'll start with the light bulb one and delete what's not needed.

    It would be nice if this is made more robust over time. For example if adding CONFIG_CHIP requires at least CPP 14+ then it would be helpful if the kconfig was set to make this required (or at least fail with a proper error).

    I suspect something in the set of configs is allowing the bulb example to work, whereas just CONFIG_CHIP alone doesn't, but without proper dependencies in the configs I can't easily figure out what exactly is needed.

  • Hello, 

    I reached out to our Matter team and got some answers. 

    kenmacd said:
    It would be nice if this is made more robust over time. For example if adding CONFIG_CHIP requires at least CPP 14+ then it would be helpful if the kconfig was set to make this required (or at least fail with a proper error).

    You should be able to change CONFIG_STD_CPP14 to e.g CONFIG_STD_CPP17. The reason for the use was due to other Matter community members using CPP 14, and by including this avoiding any problems.

    kenmacd said:
    I suspect something in the set of configs is allowing the bulb example to work, whereas just CONFIG_CHIP alone doesn't, but without proper dependencies in the configs I can't easily figure out what exactly is needed.

    Our developers confirm that the Matter: Mandatory Configuration is missing some important steps in regards to starting from scratch. (This is reported internally as a bug). The error you see is a result of lacking crypto backend for Matter. Matter cannot work without proper network layer protocol and crypto libraries that are OpenThread and mbedTLS in this case. They inform that the minimal config that can be used to build Matter is:

    # Enable CHIP
    CONFIG_CHIP=y
    
    CONFIG_CHIP_PROJECT_CONFIG="src/chip_project_config.h"
    CONFIG_STD_CPP14=y
    # General networking settings
    CONFIG_NETWORKING=y
    # Use nrf_security
    CONFIG_OPENTHREAD_NRF_SECURITY_CHOICE=y
    CONFIG_CC3XX_BACKEND=n
    CONFIG_OBERON_BACKEND=y
    CONFIG_MBEDTLS_ENABLE_HEAP=y
    CONFIG_MBEDTLS_HEAP_SIZE=15360
    CONFIG_MBEDTLS_TLS_LIBRARY=y
    CONFIG_NRF_SECURITY_ADVANCED=y
    CONFIG_MBEDTLS_AES_C=y
    CONFIG_MBEDTLS_ECP_C=y
    CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
    CONFIG_MBEDTLS_CTR_DRBG_C=y
    CONFIG_MBEDTLS_CIPHER_MODE_CTR=y
    CONFIG_MBEDTLS_ECJPAKE_C=y
    CONFIG_MBEDTLS_SHA256_C=y
    CONFIG_MBEDTLS_PK_C=y
    CONFIG_MBEDTLS_PK_WRITE_C=y
    CONFIG_MBEDTLS_X509_CREATE_C=y
    CONFIG_MBEDTLS_X509_CSR_WRITE_C=y

    But please note that it will not function properly without Bluetooth LE included. This is the reason for why we encourage our customers to start with copying our existing samples and start from there, modifying this to your use.
    You can also start with our Matter Template sample, which is intended for this use.

    Kind regards,
    Øyvind
  • Hi, I am facing the same issue,

     fatal error: mbedtls/bignum.h: No such file or directory

    When trying to port the matter sample code within my project.

    I´m using nRF Connect SDK v2.2.0.

    I have added all the mandatory configuration shared above and still have the same issue. 

    If you can help it will be appreciated.

  • Hello  , 

    Can you please open a new ticket regarding your issue? Please provide as much information about your setup for us to reproduce. 

    Please note that we are currently entering Easter holiday and a delayed answer must be expected, i.e. Tuesday /Wednesday next week.

    Kind regards,
    Øyvind

Reply Children
Related