Wiz-IO / platform-azure

PlatformIO for Azure Sphere

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

azureiot: missing cstring

yoursunny opened this issue · comments

platformio.ini

[env:avnet_aesms_mt3620]
platform = azure
board = avnet_aesms_mt3620
framework = arduino

main.cpp

#include <Arduino.h>
#include <azureiot/iothub_device_client_ll.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

Error message:

AZURE SPHERE SDK SYSROOT: 2+Beta1905 [ MT3620 ] avnet_aesms_mt3620 
USED C:\Program Files (x86)\Microsoft Azure Sphere SDK 
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pio\build\avnet_aesms_mt3620\src\main.cpp.o
Compiling .pio\build\avnet_aesms_mt3620\_arduino\IPAddress.cpp.o
Compiling .pio\build\avnet_aesms_mt3620\_arduino\Print.cpp.o
Compiling .pio\build\avnet_aesms_mt3620\_arduino\Stream.cpp.o
In file included from C:\Users\sunny\.platformio\packages\framework-azure\Sysroots\2+Beta1905\usr\include/azureiot/iothub_device_client_ll.h:29,
                 from src\main.cpp:2:
C:\Users\sunny\.platformio\packages\framework-azure\Sysroots\2+Beta1905\usr\include/azure_c_shared_utility/macro_utils.h:18:10: 
fatal error: cstring: No such file or directory
 #include <cstring>
          ^~~~~~~~~
compilation terminated.
*** [.pio\build\avnet_aesms_mt3620\src\main.cpp.o] Error 1

Azure/azure-sphere-samples#82

rem cstring for string.h
or implement iot client in C

I found a workaround:

include/cstddef

extern "C" {
#include <stddef.h>
}

include/cstdint

extern "C" {
#include <stding.h>
}

include/cstring

extern "C" {
#include <string.h>
}

Lines like #include <cstring> would find these files, which then includes the corresponding C headers.


I think it's platform-azure's responsibility to supply C++ standard libraries, because Azure Sphere SDK itself does not officially support C++. It's platform-azure that adds Arduino support, which in turn requires C++ headers.

nice, thanks, today will test
maybe will put this files in core folder, is visible as /include and need only for Arduino
https://github.com/Wiz-IO/platform-azure/blob/master/builder/frameworks/arduino-MT3620.py#L45