smartnode/telebot

Building under Debian Stretch for Raspberry Pi fails

Closed this issue · 3 comments

I tried to build from source the testprogram echobot on my Raspberry Pi but building process fails under Debian Stretch. I remember, that it worked with Jessie but something changed now.
The mainreason for this that the packages "json" and "libcurl" are not available anymore with exact these names. But cmake checks in CMakeList.txt exactly for these packages and fails.
Any idea how to fix that?

Can you try with json-c instead of json?

In the meantime I managed to compile and link by replacing "json" and "libcurl" with "libcurl4-openssl-dev" and "libjson-c-dev" in CMakeList.txt. But now I have the next problem, that echobot does not react correctly anymore: It does not stop to echo anymore after a new text has been put in the chat. I have to press ctrl-c in order to stop it. It continues to send "RE: ..." with no end.
Please note, that in Debian Stretch (9) there does not exist anymore a package json or json-c. You can verify this by entering
apt list json*
This is true for Debian Stretch on my Pi and the Raspberry Pi Desktop (x86) release, too.

This is because offset is not increased. Change the test code as below.
int index, count, offset = 1;
...
ret = telebot_get_updates(handle, offset, 20, 0, NULL, 0, &updates, &count);
if (ret != TELEBOT_ERROR_NONE)
continue;
offset = updates[index].update_id + 1;
...
or you can just set offset to 0, internally it will update it.
ret = telebot_get_updates(handle, 0, 20, 0, NULL, 0, &updates, &count);

Pull the latest code, it is now fixed.