Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
588 stars 739 forks source link

Compilation error while building Azure IoT SDK when adding "-DUSE_PROV_MODULE" in azureiot.bld file #2639

Open MrudulaSatyaY opened 2 months ago

MrudulaSatyaY commented 2 months ago

Hello,

I am using the TI CC3235SF MCU and to include the Azure IoT SDK, I am using the Azure IoT SDK Plugin V4.10 provided by TI. Into this plugin, I have cloned the latest LTS Azure IoT SDK C ([LTS_03_2024_Ref02).

I am using XDC Tools 3.61.00.16_core.

When I try to build the Azure IoT SDK with "-DUSE_PROV_MODULE" in the azureiot.bld file, (code snippet below) "ti.targets.arm.elf.M4" : " -ms -g --c99 -DUSE_PROV_MODULE",

I am getting a compilation error. Without the "-DUSE_PROV_MODULE" macro, the SDK builds fine.

But I need to use the Device Provisioning Service (DPS) code and hence I need to use this macro.

The compilation error is as follows:

`

C:\ti\azure_cc32xx_4_10_01_01\source\third_party\azure-iot-pal-simplelink\build_all>C:\ti\xdctools_3_61_00_16_core\gmake all
Fetching installation locations from imports.mak...
building packages...
making all: Thu Aug 8 12:18:04 CDT 2024 ...
======== .interfaces [../build_all/pal] ========
======== .interfaces [../build_all/sdk] ========
making package.mak (because of .xdcenv.mak) ...
making package.mak (because of .xdcenv.mak) ...
.interfaces files complete: Thu Aug 8 12:18:09 CDT 2024.
======== .libraries [../build_all/pal] ========
======== .libraries [../build_all/sdk] ========
clem4 ../../sdk/c-utility/adapters/tickcounter_linux.c ...
clem4 ../../sdk/c-utility/src/sha384-512.c ...
clem4 ../../sdk/c-utility/src/strings.c ...
clem4 ../../sdk/c-utility/src/singlylinkedlist.c ...
clem4 ../../sdk/c-utility/src/string_tokenizer.c ...clem4 ../../sdk/c-utility/src/usha.c ...clem4 ../../sdk/c-utility/src/urlencode.c ...
clem4 ../../sdk/c-utility/src/utf8_checker.c ...
clem4 ../../sdk/c-utility/src/xio.c ...
clem4 ../../sdk/c-utility/src/uws_client.c ...
clem4 ../../sdk/c-utility/src/xlogging.c ...clem4 ../../sdk/c-utility/src/wsio.c ...clem4 ../../sdk/c-utility/src/uws_frame_encoder.c ...clem4 ../../sdk/c-utility/src/vector.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_authorization.c ...
clem4 ../../sdk/iothub_client/src/iothub_client.c ...clem4 package/package_build_all.sdk.c ...clem4 ../../sdk/iothub_client/src/iothub.c ...clem4 ../../sdk/iothub_client/src/iothub_client_diagnostic.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_ll.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_retry_control.c ...
clem4 ../../sdk/iothub_client/src/iothub_device_client_ll.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_core_ll.c ...clem4 ../../sdk/iothub_client/src/iothub.c ...
clem4 ../../sdk/iothub_client/src/iothubtransport_mqtt_common.c ...
clem4 ../../sdk/iothub_client/src/iothub_transport_ll_private.c ...clem4 package/package_build_all.sdk.c ...clem4 ../../sdk/iothub_client/src/iothub_client_ll_uploadtoblob.c ...
clem4 ../../sdk/iothub_client/src/blob.c ...ent_authorization.c ...
clem4 ../../sdk/iothub_client/src/iothubtransporthttp.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_ll_uploadtoblob.c ...

clem4 ../../sdk/iothub_client/src/iothub_client_ll.c ...
clem4 ../../sdk/iothub_client/src/iothubtransportmqtt.c ...
clem4 ../../sdk/iothub_client/src/iothubtransport.c ...clem4 ../../sdk/iothub_client/src/iothub_transport_ll_private.c ...

"../clem4 ../../sdk/iothub_client/src/iothub_client.c ...
clem4 ../../sdk/iothub_client/src/iothub_client_retry_control.c ...clem4 ../../sdk/iothub_client/src/iothub_client_diagnostic.c ....
dk/clem4 ../../sdk/iothub_client/src/iothub_client_core_ll.c ...iclem4 ../../sdk/iothub_client/src/iothubtransport_mqtt_common.c ...
clem4 ../../sdk/iothub_client/src/blob.c ...
clem4 ../../sdk/iothub_client/src/version.c ...rthttp.c ...
ub_client/srcclem4 ../../sdk/iothub_client/src/iothubtransport.c ...
/iothub_clieclem4 ../../sdk/serializer/src/datapublisher.c ...
clem4 ../../sdk/serializer/src/datamarshaller.c ...clem4 ../../sdk/iothub_client/src/iothubtransportmqtt.c ...
nt
uclem4 ../../sdk/serializer/src/commanddecoder.c ... ...clem4 ../../sdk/serializer/src/agenttypesystem.c ...
hclem4 ../../sdk/serializer/src/dataserializer.c ...nt_ll.c ...t
oriclem4 ../../sdk/serializer/src/schema.c ...clem4 package/package_build_all.sdk.c ...clem4 ../../sdk/serializer/src/iotdevice.c ...
tion.c",clem4 ../../sdk/serializer/src/codefirst.c ... l"i.
nclem4 ../../sdk/serializer/src/methodreturn.c ....clem4 ../../sdk/serializer/src/jsonencoder.c ...
.8/:s dfka/tiaoarchiving package/lib/lib/ccs/m4/iotclient_sl_prov_release/package/package_build_all.sdk.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_authorization.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_diagnostic.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_ll.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_core_ll.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_ll_uploadtoblob.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_client_retry_control.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_message.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_transport_ll_private.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothubtransport.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothubtransporthttp.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothubtransportmqtt.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothubtransport_mqtt_common.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/version.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/blob.oem4 package/lib/lib/ccs/m4/iotclient_sl_prov_release/iothub_device_client_ll.oem4 into lib/ccs/m4/iotclient_sl_prov_release.a ...
lt heurbclem4 ../../sdk/serializer/src/jsondecoder.c ...
r_ocrl:clem4 ../../sdk/c-utility/adapters/agenttime.c ...
i ecnatnclem4 ../../sdk/serializer/src/schemalib.c ...
/nsortc /oipclem4 ../../sdk/c-utility/src/wsio.c ...
oetclem4 package/package_build_all.sdk.c ...
nclem4 ../../sdk/iothub_client/src/iothub_client_authorization.c ...
h uclem4 ../../sdk/c-utility/src/xio.c ...
sbot"ur.ra.cn/es. p.fo/clem4 ../../sdk/c-utility/src/xlogging.c ...
irsltde.k c/""ia,oclem4 ../../sdk/c-utility/src/vector.c ...
z tulhriuenbclem4 ../../sdk/c-utility/src/uws_frame_encoder.c ...
_e_p cr2lo1iv7e_:nc tlw/iasclem4 ../../sdk/c-utility/src/uws_client.c ...errnnc
iclem4 ../../sdk/c-utility/src/urlencode.c ...edlist.c ...
gon:tt heturybnptaerl a/qniusoaptlohiruftbi._ecar"u ,ti hsl_ icmnleeia en2ni1tn7.g:hl "ew
sr noi1nn  ccgaaclem4 ../../sdk/c-utility/src/usha.c ...
:ts clem4 ../../sdk/c-utility/src/strings.c ...
att"../../sdk/iothub_client/src/iothub_client_authorization.c", line 18: fatal error: cannot open source file "azure_prov_client/internal/iothub_auth_client.h"
1 catastrophic error detected in the compilation of "../../sdk/iothub_client/src/iothub_client_authorization.c".
Compilation terminated.
s y
>> Compilation failure
ttpclem4 ../../sdk/c-utility/adapters/tickcounter_linux.c ...
ryeoclem4 ../../sdk/c-utility/src/sha384-512.c ...
p peqh
acclem4 ../../sdk/c-utility/src/string_tokenizer.c ...
l iefrireorclem4 ../../sdk/c-utility/src/utf8_checker.c ...r  i
tmeecatneidn gilne stsh eo nc ocmapsitl attyipoen
of "../../sdk/iothub_client/src/iothub_client_authorization.c".
Compilation terminated.

>> Compilation failure
gmake[1]: *** [lib/ccs/m4/iotclient_sl_debug.a.mak:111: package/lib/lib/ccs/m4/iotclient_sl_debug/iothub_client_authorization.oem4] Error 1
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: *** [lib/ccs/m4/iotclient_sl_release.a.mak:111: package/lib/lib/ccs/m4/iotclient_sl_release/iothub_client_authorization.oem4] Error 1
clem4 ../../sdk/c-utility/src/sastoken.c ...
clem4 ../../sdk/c-utility/src/sha224.c ...
clem4 ../../sdk/c-utility/src/sha1.c ...archiving package/lib/lib/ccs/m4/common_sl_prov_debug/package/package_build_all.sdk.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/agenttime.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/azure_base32.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/azure_base64.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/buffer.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/consolelogger.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/constbuffer.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/crt_abstractions.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/doublylinkedlist.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/gballoc.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/gb_rand.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/gb_stdio.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/gb_time.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/hmac.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/hmacsha256.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/httpapiex.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/httpapiexsas.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/httpheaders.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/linux_time.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/lock_pthreads.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/map.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/optionhandler.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/sastoken.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/sha1.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/sha224.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/sha384-512.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/singlylinkedlist.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/strings.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/string_tokenizer.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/tickcounter_linux.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/urlencode.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/usha.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/utf8_checker.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/uws_client.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/uws_frame_encoder.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/vector.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/wsio.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/xio.oem4 package/lib/lib/ccs/m4/common_sl_prov_debug/xlogging.oem4 into lib/ccs/m4/common_sl_prov_debug.a ...

clem4 ../../sdk/c-utility/src/optionhandler.c ...
xdctools_3_61_00_16_core\gmake.exe: *** [c:/ti/xdctools_3_61_00_16_core\packages\xdc\bld\xdc_top.mak:389: ../build_all/sdk,.libraries] Error 2
gmake: *** [Makefile:59: all] Error 2

C:\ti\azure_cc32xx_4_10_01_01\source\third_party\azure-iot-pal-simplelink\build_all>
`

The compilation error occurs in the iothub_client_authorization.c file.

I am not sure if this is a Azure IoT SDK C issue or an XDC tools issue or a TI issue. hence, I decided to start here and posting my query.

Thank you in advance.

MrudulaSatyaY commented 2 months ago

Hello,

I was able to resolve this issue by making the following change in iothub_client_authorization.c file line 18. image

As the issue was "cannot open

", I mentioned the whole path of the headerfile iothub_auth_client.h instead of the relative path that is mentioned in line 18. This resolved the compilation error.

Is this something important for which I need to issue a pull request ?

ewertons commented 2 months ago

Hi @MrudulaSatyaY , thank you for the issue and sharing the details for the workaround. We will try to add your fix to the code base, but meanwhile I wanted to check if you got to play with our other SDK specifically designed for microcontrollers? Please check it out: https://github.com/azure/azure-sdk-for-c

MrudulaSatya commented 2 months ago

Hi @ewertons Thank you for your response. I will definitely checkout the SDK for embedded systems.