[SOLVED] Error installing Blynk-library on Raspberry Pi 3

Hey guys,
today I learned about Blynk and the possibility to controle my Raspberry Pi via smartphone. I tried to install the necessery libraries for my pi but im getting an error. Im using the Raspberry Pi 3 and the Raspian OS istalled with NOOBS. For my project i want to code in C++ and use the Inputs from my smartphone.

I followed the instructions in the readme file from github.
It says that i should use following commands to install the library:

Connect your Raspberry Pi to the internet and open it’s console. :slight_smile:

Install WiringPi: Raspberry Pi | Wiring | Download & Install | Wiring Pi

Download and build Blynk:

$ git clone GitHub - blynkkk/blynk-library: Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
$ cd blynk-library/linux
$ make clean all target=raspberry
Run Blynk:

$ sudo ./blynk --token=YourAuthToken

I already installed wiringPi for some previous projects so I skiped this step. When I try to run the

$ make clean all target=raspberry

command Im getting a few errors:

pi@raspberrypi:~/blynk-library/linux $ make clean all target=raspberry
rm main.o BlynkDebug.o …/src/utility/BlynkHandlers.o …/src/utility/BlynkTimer.o blynk
rm: cannot remove ‘main.o’: No such file or directory
rm: cannot remove ‘BlynkDebug.o’: No such file or directory
rm: cannot remove ‘…/src/utility/BlynkHandlers.o’: No such file or directory
rm: cannot remove ‘…/src/utility/BlynkTimer.o’: No such file or directory
rm: cannot remove ‘blynk’: No such file or directory
Makefile:64: recipe for target ‘clean’ failed
make: [clean] Error 1 (ignored)
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY main.cpp -o main.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY BlynkDebug.cpp -o BlynkDebug.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY …/src/utility/BlynkHandlers.cpp -o …/src/utility/BlynkHandlers.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY …/src/utility/BlynkTimer.cpp -o …/src/utility/BlynkTimer.o
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::init()’:
…/src/utility/BlynkTimer.cpp:47:46: error: ‘memset’ was not declared in this scope
memset(&timer[i], 0, sizeof (timer_t));
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::deleteTimer(unsigned int)’:
…/src/utility/BlynkTimer.cpp:216:52: error: ‘memset’ was not declared in this scope
memset(&timer[timerId], 0, sizeof (timer_t));
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::enableAll()’:
…/src/utility/BlynkTimer.cpp:264:42: error: ‘numRuns’ was not declared in this scope
if (timer[i].callback != NULL && numRuns[i] == RUN_FOREVER) {
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::disableAll()’:
…/src/utility/BlynkTimer.cpp:273:42: error: ‘numRuns’ was not declared in this scope
if (timer[i].callback != NULL && numRuns[i] == RUN_FOREVER) {
^
Makefile:70: recipe for target ‘…/src/utility/BlynkTimer.o’ failed
make: *** […/src/utility/BlynkTimer.o] Error 1

Would be very nice if someone knows a solution for this problem. Would be a pity if i could not use Blynk :grin:

Thanks !! :slight_smile:

Max

I recommend using some more current (I think) directions. And don’t skip any steps, in case your prior install is corrupted or incompatible.

Also, I don’t think BlynkTimer is compatible with WiringPi.

Here are the two common ways for running Blynk on RPi

http://help.blynk.cc/hardware-and-libraries/nodejs-vs-c-library

It is also possible to have both methods installed and running concurrently

The first error ‘‘memset’’ error is because cstring library was not included.
add
#include < cstring>”
//without " and space before cstring, I cannot edit my post properly
in
blynk-library/src/Blynk/BlynkTimer.h

The other one is a typo:
in blynk-library/src/utility/BlynkTimer.cpp
on line 264 and 273
change numRuns[i]
to
timer[i].numRuns

after that run make clean all target=raspberry,
it worked for me

1 Like

Thanks for the answers :slight_smile: I managed to run it by changing the makefile. I removed the command to compile the blynktimer. For what exactly do I need the BlynkTimer ?

I guess that depends on your sketch, if you are using one (as opposed to simple direct pin control via ONOFF).

BlynkTimer is just that, a flexible timer to have commands run every few seconds/minutes, hours, etc. Run something for X much time for Y many times, and so on. It effectively replaces the blocking delay()command in Blynkified Arduino C++ sketches. As stated, I am unsure if it is compatible with WiringPi though.

Okay, I already thought I would do something like that. But couldn’t I use threads if I need to run some tasks without blocking my whole code ?

I am more used to Arduino, where just looking at it sideways can be blocking :wink: thus I do not have as much RPi experience, but I don’t think blocking commands is as much of an issue due to the threading as you mentioned.

Just use the BlynkTimer for timing purposes (hmmm, again, assuming it even works in NodeJS… now I need to go and check that for myself… :stuck_out_tongue: )

Oh yes I totally forgot that threading is not possible on the Arduino right ? Me neither I have the PI for only a few weeks now and it takes much time, effort and errors to build up a tiny bit of experience :weary:

Haha I never programmed something in javascript so I’m completely clueless :sweat_smile:

Unfortunately I have another problem with my project already :confused:
I posted another topic about the problem because it has something to to with a local server I wanted to set up. Do you have experience with those servers ?

My problems seem to be never ending :angry:

I just found out that the BlynkTimer is fully compatible to wiringPi ! I don’t really know why the error with the BlynkTimer occurred but I reinstalled all libraries because of an error with my local server and now everything works just like intended :slight_smile:

That good to know!.. the “original” SimpleTimer apparently had issues, and BlynkTimer is based off of it, so I wasn’t sure.

Glad to hear you are up and running :+1:

huge help