Build Error on OSX - can't find rsa.h

When getting a fresh git clone of mesh-develop or feature/ble-peripheral I get the following error after make clean all:

src/handshake.h:31:25: fatal error: mbedtls/rsa.h: No such file or directory

If I look in /usr/local/include/mbedtls I see rsa.h. I’ve installed all the listed tools for osx. Any tips on what’s missing from the make recipe?

Do a git submodule update --init --recursive in the root directory and try again

2 Likes

Well, this certainly made a difference but I get a new error shown below. BTW, I’m following directions from here. No mention there of building for mesh targets so perhaps I need some more make flags?

Building firmware for Spark core, platform ID: 0, product ID: 0
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ./communication 
Building cpp file: src/spark_protocol.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/communication/platform-0-prod-0/src/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F10X_MD -DPLATFORM_THREADING=0 -DPLATFORM_ID=0 -DPLATFORM_NAME=core -DUSBD_VID_SPARK=0x1D50 -DUSBD_PID_DFU=0x607F -DUSBD_PID_CDC=0x607D -DPRODUCT_ID=0 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DMBEDTLS_CONFIG_FILE="<mbedtls_config.h>" -DSYSTEM_VERSION_STRING=0.8.0-rc.26 -DRELEASE_BUILD -Werror -I./src -I../hal/inc -I../hal/shared -I../hal/src/core -I../hal/src/stm32 -I../platform/shared/inc -I../platform/MCU/STM32F1xx/CMSIS/Include -I../platform/MCU/STM32F1xx/CMSIS/Device/ST/Include -I../platform/MCU/STM32F1xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F1xx/STM32_USB_Device_Driver/inc -I../platform/NET/CC3000/CC3000_Host_Driver -I../dynalib/inc -I../services/inc -I../third_party/nanopb/nanopb -I../wiring/inc -I../crypto/inc -I../third_party/mbedtls/mbedtls/include -I. -MD -MP -MF ../build/target/communication/platform-0-prod-0/src/spark_protocol.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"comm\""  -std=gnu++11 -c -o ../build/target/communication/platform-0-prod-0/src/spark_protocol.o src/spark_protocol.cpp
src/spark_protocol.cpp: In member function 'particle::protocol::CoAPMessageType::Enum SparkProtocol::received_message(unsigned char*, size_t)':
src/spark_protocol.cpp:378:93: error: 'mbedtls_aes_crypt_cbc' was not declared in this scope
   mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_DECRYPT, round_to_16(length), iv_receive, buf, buf);
                                                                                             ^
src/spark_protocol.cpp: In member function 'void SparkProtocol::encrypt(unsigned char*, int)':
src/spark_protocol.cpp:1695:90: error: 'mbedtls_aes_crypt_cbc' was not declared in this scope
   mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_ENCRYPT, round_to_16(length), iv_send, buf, buf);
                               

I think you’re missing a parameter in the build command. You’re building for Core, but you can’t build mesh-develop for core. Try something like:

cd firmware/modules
make clean all PLATFORM=xenon
1 Like

Thanks! With the PLATFORM=xenon and cd firmware/modules it built without errors. Now I just need to figure out how to use the output for debugging. Is this documented anywhere for the mesh devices?