thingsboard-client-sdk: Unable to use library with fresh install, Installation paragraph need update (after the right solution is found)
So I want to log some temperatures with DS18B20 sensors on an Arduino Mega and Ethernet Shield (since I have no ESP8266 module and want wired) “to somewhere”. I found Thingsboard that look interesting (I haven’t installed it yet).
But I ran into some problems (I usually use Visual Studio Code with arduino plugin) so I now started out fresh (on another Windows machine) to see if I was doing things wrong. I downloaded the zipped versions of the following from www.arduino.cc page.
- Arduino IDE 2.0.3
- Arduino IDE 1.8.19 The libraries folder in my Documents\Arduino folder was clean. I tested both versions separately to compile (“Verify”) code but the results seems to be the same.
The issue is that I don’t get everything needed to get up and running. The first example sketch doesn’t compile. I then made the simplest sketch possible with an include and still have problem. I guess you people that use and develop this library have some more things installed that, maybe unknowingly, is required. If we can find this out perhaps the Readme.md can be updated and dependency info in Arduino library manager. But I gave it a go to try to fix it myself but after three more libraries I feel I’ve lost the path. I’m a Java developer by day and C/C++ dependency fixing and how the includes depend is not crystal clear but I hope I went for the right approach. This is the path I took:
I downloaded Thingsboard-arduino-sdk 0.8.0 (it’s newer than in Arduino library manager). Earlier, before this clean attempt I had problem with the PSTR that was changed to PROGMEM (so I guess it’s better to try with the 0.8.0 rather than 0.7.1 from library manager). I also downloaded the libraries mentioned as requirements from their respective github pages:
- MQTT PubSub Client (found: v2.8)
- ArduinoJSON (found: v6.20.0)
- Arduino Http Client (found v0.3.2)
I couldn’t see that they in turn required some non-standard library. I started the Arduino IDE (first with 2.0.3) and it found that Arduino Http Client had an update (newer than github release…) so I let it update it to (became v0.4.0).
Then in the sketch I wrote this include (as mentioned by library.properties file under includes key) so it’s the simplest possible.
#include <ThingsBoard.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Which gives this compilation error (remember it’s for the Arduino Mega but I suspect e.g. UNO target would get the same).
C:\Users\MyUserName\Documents\Arduino\libraries\thingsboard-arduino-sdk-0.8.0\src/HashGenerator.h:11:10: fatal error: mbedtls/md.h: No such file or directory
#include <mbedtls/md.h>
^~~~~~~~~~~~~~
compilation terminated.
So this is the first problem. I search for mbedtls in Arduino library manager and found this:
https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls
v3.0.1
So I added (thanks to library.properties for that library, and the example)
#include <Seeed_mbedtls.h>
to the top of my sketch. Press verify again and get this:
C:\Users\MyUserName\Documents\Arduino\libraries\thingsboard-arduino-sdk-0.8.0\src/HashGenerator.h:12:10: fatal error: string: No such file or directory
#include <string>
^~~~~~~~
Since I found out that the Arduino IDE doesn’t have the C++ STL I need an arduino library for this. Searching for STL in the library manager there are a few different choices. I tested https://github.com/mike-matera/ArduinoSTL v1.3.3 (as reported in Arduino library manager). I’ve also tested the avr_stl library.
So I added (thanks to library.properties for that library, and the example)
#include <ArduinoSTL.h>
to the top of my sketch. Press verify again and get this:
C:\Users\MyUserName\Documents\Arduino\libraries\Seeed_Arduino_mbedtls\src\port\mbedtls_debug.c:15:10: fatal error: strings.h: No such file or directory
#include <strings.h>
^~~~~~~~~~~
That file (notice: plural, strings). I found some explanation for string.h and strings.h here: https://stackoverflow.com/questions/4291149/difference-between-string-h-and-strings-h Which leads my to think that library has some unmentioned dependency and I stop here (it’s that library’s problem). I’m probably down the wrong path anyway.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 24 (14 by maintainers)
Commits related to this issue
- Removed usages of STL for non ESP, fixing #111 — committed to MathewHDYT/thingsboard-client-sdk by MathewHDYT a year ago
There was one more error. I fixed it and now it compiles. I’m not used to github so for tonight I won’t go into the process of learning to submit a pull request and so one for your branch but instead screenshot it so you can do the same. This is the fixed one.