Skip to content
This repository was archived by the owner on Jul 22, 2022. It is now read-only.

simplesample_http does not compile #86

Closed
kcoops opened this issue Feb 11, 2019 · 14 comments
Closed

simplesample_http does not compile #86

kcoops opened this issue Feb 11, 2019 · 14 comments

Comments

@kcoops
Copy link

kcoops commented Feb 11, 2019

I am using a NodeMCU ESP8266 board and I am trying to compile and load simplesample_http. However it gives a compile error. I have downloaded all the latest versions of the necessary AzuteIOT libraries and still no luck. Any assistance would be appreciated. Below is a dump of the error log.

In file included from C:\Users\userx\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/lock.h:17:0,
from C:\Users\userx\Documents\Arduino\libraries\AzureIoTUtility\src/AzureIoTUtility.h:7,
from C:\Users\userx\Documents\Arduino\libraries\AzureIoTHub\src/AzureIoTHub.h:7,
from sketch\simplesample_http.c:11:
C:\Users\userx\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:441:79: error: 'REFLECTED_19' undeclared here (not in a function)
static const REFLECTED_DATA_FROM_DATAPROVIDER ALL_REFLECTED(name) = { &C2(REFLECTED_, C1(DEC(COUNTER))) };

C:\Users\userx\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/macro_utils.h:4359:18: note: in definition of macro 'C2_'
#define C2_(x,y) x##y
^
C:\Users\userx\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:441:76: note: in expansion of macro 'C2'
static const REFLECTED_DATA_FROM_DATAPROVIDER ALL_REFLECTED(name) = { &C2(REFLECTED_, C1(DEC(COUNTER))) };
C:\Users\userx\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:87:5: note: in expansion of macro 'REFLECTED_LIST_HEAD'
REFLECTED_LIST_HEAD(schemaNamespace)
^
sketch\simplesample_http.c:30:1: note: in expansion of macro 'END_NAMESPACE'
END_NAMESPACE(WeatherStation);
^
exit status 1
Error compiling for board Generic ESP8266 Module.

@HITliuyu
Copy link

HITliuyu commented Feb 14, 2019

I got the same error and have not got any clue about that. Have been struggling with Arduino IoT Hub examples for half day but couldn't get even one example compiled and working. That's so frustrating. I really doubt when people finished porting and updating their library for Arduino platform, did they even have a try to compile their example to ensure they work.

@kcoops
Copy link
Author

kcoops commented Feb 14, 2019

In the end I used the following post to get it working, But had to chop and change a bit as I am not using the Huzzah. But my assumption is that if this has to be used in a production ready microcontroller and not Microsofts MX dev kit then this C library is essential.

It is a bit frustrating that for a production ready service all their examples are aimed at specific Dev Kits with unstable libraries.

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started

@HITliuyu
Copy link

Hi @kcoops ,
good to know that yours are working. I also have tried that post and it can pass the compilation with the latest IoT Hub libraries. However, I encountered a problem similar to this issue.https://github.com/Azure/azure-iot-arduino-protocol-mqtt/issues/1
So I wonder which protocol are you using now? MQTT or HTTP? When I switch from MQTT to HTTP, I will get another compilation error, and I am so tired of debugging these example apps which should work out-of-box...

@kcoops
Copy link
Author

kcoops commented Feb 15, 2019

There isn't an issue #1 so your link navigates to nothing. I left it as is, so thats MQTT. Also be careful with the latest versions of the libraries case the are usually betas, so for instance I used version 5.13.4 of the ArduinoJson.

@HITliuyu
Copy link

Hi @kcoops ,
Sorry for the link. It is not wrong, you have to copy and paste it into the browser to open it. If you click it, it will redirect you to somewhere else.
Azure/azure-iot-arduino-protocol-mqtt#1
I also notice the Json library doesn't work well with bate version. Anyway, thanks for your feedback.

@benparsell
Copy link

@kcoops can you share a bit more on how you found a workaround? I've been bouncing between both the simplesample and that Microsoft post for a few days now with no luck

@kcoops
Copy link
Author

kcoops commented Feb 19, 2019

Are you able to compile successfully or is it that IOT Central is not receiving any data? simplesample never compiled for me so I gave up on that. Will be good to know specifically what issues you are having.

As for the Microsoft sample just a few things I did. When it came to compilation errors I had to download version 5.13.4 of the ArduinoJson. Also I did not have a sensor connected so I updated the following flag in config.h (#define SIMULATED_DATA true). In the Message file I updated the temperature variable in the readMessage function to match what I defined in Azure. By default it is set to "temperature" in the code, but my definition was room_temp. The code looks like this root["room_temp"] = temperature. Lastly I am using IOT Central not IOT HUB which means I have to generate my connection string using dps-keygen as its not given when you create the "Real Device".

Hope that helps.

@YoDaMa
Copy link
Contributor

YoDaMa commented Feb 21, 2019

Hi @kcoops and @benparsell. Can you create a issue in the main azure-iot-sdk-c repo and link to this issue? Or continue to follow issue #795 in the repo. https://github.com/Azure/azure-iot-sdk-c/issues.

We're actively working on fixing our Arduino libraries and resolving the build issues in our samples for ESP8266. We need to fix library compatibility issues and also updating the libraries to handle certs.

@kcoops
Copy link
Author

kcoops commented Feb 28, 2019

Hi @kcoops and @benparsell. Can you create a issue in the main azure-iot-sdk-c repo and link to this issue? Or continue to follow issue #795 in the repo. https://github.com/Azure/azure-iot-sdk-c/issues.

We're actively working on fixing our Arduino libraries and resolving the build issues in our samples for ESP8266. We need to fix library compatibility issues and also updating the libraries to handle certs.

ok no problem will follow #795 for a resolution.

@kcoops kcoops closed this as completed Feb 28, 2019
@mysaggar
Copy link

mysaggar commented Mar 12, 2019

Hi! @kcoopss
I used the boards NodeMCU and Adafruit Feather Huzzah ESP8266 for running the microsoft sample, https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started and have run into a error:
Capture
Is there a workaround for this?

@kcoops
Copy link
Author

kcoops commented Mar 12, 2019

For starters it seems like its just not connecting to Azure. Its worth double checking you are using the correct connection string based on if you are using IOT Hub or IOT Central.

Also check issue #795 for any resolutions. as this thread is now closed as requested by moderators.

@mysaggar
Copy link

@kcoops I am using connection string based on the IotHub that was created by me and not any IoT. The thread #795 doesn't cater to this error but another error which occurs when using the remote monitoring sample.
I am following that error too. I haven't been able to run that sample either.

Also could you direct me to the HTTP Protocol version of the same app and the process for using it.
Thanks

@benparsell
Copy link

@mysaggar I ran into the same errors and ended up rolling back to an earlier (non-beta) ESP (NodeMCU) Board version via the Arduino Board Manager. There may have been a bug/conflict with TLS with the WiFi packages being used in the newer versions and Azure's libraries.

See if that might work!

@rachid-o
Copy link

rachid-o commented Oct 6, 2019

I had the same issues and finally got a working setup by installing certain specific versions. Others pointed out that they got it working by rollback to an older version, but I could not find a working set of compatible versions anywhere. Please always mention the specific version as this may help others reading your messages!

The exact steps how I got it working is described in this comment:
Azure/azure-iot-sdk-c#795 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants