Open dmitrij9992905 opened 3 months ago
For now, I've restructured my Azure components in my project, but build finishes with linking error
Components https://drive.google.com/file/d/1RCCq6j83iQFfBnzaYxnufBTbR6YBO2e8/view?usp=drive_link
Build log (undefined reference to)
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x10): undefined reference to `_Z33BackoffAlgorithm_InitializeParamsP23BackoffAlgorithmContextttm'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x14): undefined reference to `_Z18TLS_Socket_ConnectP14NetworkContextPKctPK18NetworkCredentialsmm'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x1c): undefined reference to `_Z31BackoffAlgorithm_GetNextBackoffP23BackoffAlgorithmContextmPt'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._Z11azureWorkerPv+0x18): undefined reference to `_Z15TLS_Socket_SendP14NetworkContextPKvj'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._Z11azureWorkerPv+0x1c): undefined reference to `_Z15TLS_Socket_RecvP14NetworkContextPvj'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._Z11azureWorkerPv+0x34): undefined reference to `_Z11Crypto_HMACPKhmS0_mPhmPm'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj):(.literal._Z11azureWorkerPv+0x7c): undefined reference to `_Z21TLS_Socket_DisconnectP14NetworkContext'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj): in function `_ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext':
/home/dmitrij999/esp32-workspace/v5.2.2/IgnisSmartModule/components/azure_management/azure_management.cpp:590:(.text._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x14): undefined reference to `_Z33BackoffAlgorithm_InitializeParamsP23BackoffAlgorithmContextttm'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/dmitrij999/esp32-workspace/v5.2.2/IgnisSmartModule/components/azure_management/azure_management.cpp:603:(.text._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x48): undefined reference to `_Z18TLS_Socket_ConnectP14NetworkContextPKctPK18NetworkCredentialsmm'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: /home/dmitrij999/esp32-workspace/v5.2.2/IgnisSmartModule/components/azure_management/azure_management.cpp:616:(.text._ZL36prvConnectToServerWithBackoffRetriesPKcmP18NetworkCredentialsP14NetworkContext+0x6e): undefined reference to `_Z31BackoffAlgorithm_GetNextBackoffP23BackoffAlgorithmContextmPt'
/home/dmitrij999/esp/esp-tools/v5.2.2/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/azure_management/libazure_management.a(azure_management.cpp.obj): in function `_Z11azureWorkerPv':
/home/dmitrij999/esp32-workspace/v5.2.2/IgnisSmartModule/components/azure_management/azure_management.cpp:361:(.text._Z11azureWorkerPv+0x2bb): undefined reference to `_Z21TLS_Socket_DisconnectP14NetworkContext'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
* The terminal process "ninja" terminated with exit code: 1.
sample-azure-iot CMakeLists
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.19)
#set(ROOT_PATH
# ${CMAKE_CURRENT_LIST_DIR}/../..
#)
# kconfig does not support multiline strings.
# For certificates, we use as a workaround escaping the newlines
# in certificates and keys so they can be entered as a single
# string in kconfig.
# The routine below unescapes the newlines so the values
# can be correctly interpreted by the code.
if(EXISTS "${CMAKE_BINARY_DIR}/config/sdkconfig.h")
file(READ "${CMAKE_BINARY_DIR}/config/sdkconfig.h" config_header)
string(REPLACE "\\n" "n" client_certificate ${config_header})
message("CLIENT_CERT: ${client_certificate}")
file(WRITE "${CMAKE_BINARY_DIR}/config/sdkconfig.h" "${client_certificate}")
endif()
idf_component_get_property(MBEDTLS_DIR mbedtls COMPONENT_DIR)
#list(APPEND COMPONENT_SOURCES
# ${CMAKE_CURRENT_LIST_DIR}/backoff_algorithm.c
# ${CMAKE_CURRENT_LIST_DIR}/transport_tls_esp32.c
# ${CMAKE_CURRENT_LIST_DIR}/crypto_esp32.c
#)
#list(APPEND COMPONENT_SOURCES
# backoff_algorithm.c
# transport_tls_esp32.c
# azure_sample_crypto.c
#)
file(GLOB COMPONENT_SOURCES
./*.c
)
set(COMPONENT_INCLUDE_DIRS
include
${CMAKE_CURRENT_LIST_DIR}/../../azure-configs
${MBEDTLS_DIR}/mbedtls/include
)
message("Sample Azure IoT Component sources used: ${COMPONENT_SOURCES}")
message("Sample Azure IoT Component include dirs used: ${COMPONENT_INCLUDE_DIRS}")
if (DEFINED CONFIG_ESP_TLS_USE_SECURE_ELEMENT)
idf_component_register(
SRCS ${COMPONENT_SOURCES}
INCLUDE_DIRS ${COMPONENT_INCLUDE_DIRS}
REQUIRES mbedtls tcp_transport esp-cryptoauthlib coreMQTT azure-sdk-for-c azure)
else()
idf_component_register(
SRCS ${COMPONENT_SOURCES}
INCLUDE_DIRS ${COMPONENT_INCLUDE_DIRS}
PRIV_REQUIRES mbedtls tcp_transport coreMQTT azure-sdk-for-c azure)
endif()
azure_management CMakeLists
cmake_minimum_required(VERSION 3.19)
list(APPEND component_srcs "azure_management.cpp")
#set(ROOT_PATH
# ${CMAKE_CURRENT_LIST_DIR}/../..
#)
#set(AZURE_IOT_MIDDLEWARE_FREERTOS
# ${ROOT_PATH}/components/azure/azure-iot-middleware-freertos
#)
#list(APPEND COMPONENT_SOURCES
# ${AZURE_IOT_MIDDLEWARE_FREERTOS}/ports/coreMQTT/azure_iot_core_mqtt.c
#)
#idf_component_get_property(FREERTOS_DIR freertos COMPONENT_DIR)
#idf_component_get_property(FREERTOS_RELATIVE_INCLUDE_DIRS freertos INCLUDE_DIRS)
#foreach(FREERTOS_RELATIVE_INCLUDE_DIR ${FREERTOS_RELATIVE_INCLUDE_DIRS})
# file(REAL_PATH ${FREERTOS_RELATIVE_INCLUDE_DIR} FREERTOS_ABSOLUTE_INCLUDE_DIR BASE_DIRECTORY ${FREERTOS_DIR})
# list(APPEND FREERTOS_ABSOLUTE_INCLUDE_DIRS ${FREERTOS_ABSOLUTE_INCLUDE_DIR})
# set(FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR "${FREERTOS_ABSOLUTE_INCLUDE_DIR}/freertos")
# if(EXISTS "${FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR}")
# list(APPEND FREERTOS_ABSOLUTE_INCLUDE_DIRS ${FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR})
# endif()
#endforeach()
set(AZURE_MANAGEMENT_CONFIG_PATH
${CMAKE_CURRENT_LIST_DIR}/../../azure-configs
)
#file(GLOB AZURE_MANAGEMENT_SOURCES
# *.cpp
#)
set(COMPONENT_SOURCES
#${AZURE_MANAGEMENT_SOURCES}
azure_management.cpp
)
set(COMPONENT_INCLUDE_DIRS
include
#${FREERTOS_ABSOLUTE_INCLUDE_DIRS}
${AZURE_MANAGEMENT_CONFIG_PATH}
)
idf_component_register(SRCS "${COMPONENT_SOURCES}"
INCLUDE_DIRS ${COMPONENT_INCLUDE_DIRS}
REQUIRES azure-sdk-for-c coreMQTT azure sample-azure-iot freertos
)
azure CMakeLists (which contains azure-iot-middleware-freertos)
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.19)
set(ROOT_PATH
${CMAKE_CURRENT_LIST_DIR}/../..
)
set(AZURE_IOT_MIDDLEWARE_FREERTOS
${ROOT_PATH}/components/azure/azure-iot-middleware-freertos
)
file(GLOB_RECURSE COMPONENT_SOURCES
${AZURE_IOT_MIDDLEWARE_FREERTOS}/source/*.c
)
list(APPEND COMPONENT_SOURCES
${AZURE_IOT_MIDDLEWARE_FREERTOS}/ports/coreMQTT/azure_iot_core_mqtt.c
)
idf_component_get_property(FREERTOS_DIR freertos COMPONENT_DIR)
idf_component_get_property(FREERTOS_RELATIVE_INCLUDE_DIRS freertos INCLUDE_DIRS)
foreach(FREERTOS_RELATIVE_INCLUDE_DIR ${FREERTOS_RELATIVE_INCLUDE_DIRS})
file(REAL_PATH ${FREERTOS_RELATIVE_INCLUDE_DIR} FREERTOS_ABSOLUTE_INCLUDE_DIR BASE_DIRECTORY ${FREERTOS_DIR})
list(APPEND FREERTOS_ABSOLUTE_INCLUDE_DIRS ${FREERTOS_ABSOLUTE_INCLUDE_DIR})
set(FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR "${FREERTOS_ABSOLUTE_INCLUDE_DIR}/freertos")
if(EXISTS "${FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR}")
list(APPEND FREERTOS_ABSOLUTE_INCLUDE_DIRS ${FREERTOS_ABSOLUTE_INCLUDE_FREERTOS_DIR})
endif()
endforeach()
set(COMPONENT_INCLUDE_DIRS
${FREERTOS_ABSOLUTE_INCLUDE_DIRS}
${AZURE_IOT_MIDDLEWARE_FREERTOS}/source/include
${AZURE_IOT_MIDDLEWARE_FREERTOS}/source/interface
${AZURE_IOT_MIDDLEWARE_FREERTOS}/ports/coreMQTT
)
idf_component_register(
SRCS ${COMPONENT_SOURCES}
INCLUDE_DIRS ${COMPONENT_INCLUDE_DIRS}
REQUIRES freertos azure-sdk-for-c coreMQTT mbedtls sample-azure-iot)
Is there an existing issue for this?
Version
7759a42a1eab12818ea2a8f3f940847743968021
Description of the issue
I faced with Azure IoTHub integration trouble, trying to integrate it into project based on ESP-IDF v5.2.2. esp-azure from components registry breaks down the project build, and conflicts with usb_host_cdc_acm, therefore I'm trying to integrate the azure-iot-middleware-freertos: https://github.com/Azure/azure-iot-midd ... /tree/main
When I'm fetching the sample (https://github.com/Azure-Samples/iot-mi ... /tree/main), the project works well on the top of ESP-IDF v5.2.2. But when I'm trying to integrate it to my existing project, the bunch of build errors occures. The last build error is the abscence of file threading_alt.h for mbedtls and I have no idea how does the approriate file look like.
Components tried to build https://drive.google.com/file/d/11HR8Rw_mmSAn61yu4nIgcEGdD_TiusZ_/view?usp=sharing
Expected behavior
No response
Steps to reproduce the issue
No response
Relevant log output
Code of Conduct