OpenSprinkler › Forums › OpenSprinkler Unified Firmware › OSPi 2.1.9 build errors
- This topic has 10 replies, 4 voices, and was last updated 4 years, 9 months ago by Ray.
-
AuthorPosts
-
September 30, 2019 at 7:50 pm #62780
Dutchie30ParticipantI’m seeing some build errors under CentOS 7:
{code}[root@opensprinkler OpenSprinkler-Firmware]# ./build.sh -s ospi
Building OpenSprinkler…
weather.cpp: In function ‘void getweather_callback(char*)’:
weather.cpp:55:31: error: ‘atoi’ was not declared in this scope
wt_errCode = atoi(tmp_buffer);
^
weather.cpp:61:22: error: ‘atoi’ was not declared in this scope
v = atoi(tmp_buffer);
^
weather.cpp:71:22: error: ‘atoi’ was not declared in this scope
v = atoi(tmp_buffer);
^
weather.cpp:80:22: error: ‘atoi’ was not declared in this scope
v = atoi(tmp_buffer);
^
weather.cpp:89:31: error: ‘atol’ was not declared in this scope
uint32_t l = atol(tmp_buffer);
^
weather.cpp:98:22: error: ‘atoi’ was not declared in this scope
v = atoi(tmp_buffer);
^
weather.cpp:110:22: error: ‘atoi’ was not declared in this scope
v = atoi(tmp_buffer);
^
Done!{code}I reported a similar issue for 2.1.7 about 3 years ago, it’s possible this issue is similar: https://opensprinkler.com/forums/topic/ospi-2-1-7-build-errors-on-centos-7-2-1511-for-rpi3/
September 30, 2019 at 7:53 pm #62790
RayKeymasterSounds like you are missing some basic libraries: atoi is a very common function. I’ve never compiled the program in CentOS. If you just google the error message you should be able to find solutions online.
October 3, 2019 at 6:04 am #62821
Dutchie30ParticipantStrange. I’m not confident I’m missing the atoi library. A build of 2.1.8 works as expected on the same host:
[root@opensprinkler OpenSprinkler-Firmware-218]# ./build.sh ospi Building OpenSprinkler... Done!
2.1.8 also looks to contain references to atoi in server.cpp, so it looks like I do have the atoi library available. Is it possible the atoi library isn’t declared properly in the new weather.cpp?
October 3, 2019 at 10:37 am #62824
RayKeymasterIn your first post, the command you typed is:
./build.sh -s ospi
what’s that ‘-s’?October 5, 2019 at 7:50 pm #62829
Dutchie30ParticipantIt’s the option to do a “quiet” build:
# head -n 11 build.sh #!/bin/bash while getopts ":s" opt; do case $opt in s) SILENT=true command shift ;; esac done echo "Building OpenSprinkler..."
It fails without -s too:
# ./build.sh ospi Building OpenSprinkler... weather.cpp: In function ‘void getweather_callback(char*)’: weather.cpp:55:31: error: ‘atoi’ was not declared in this scope wt_errCode = atoi(tmp_buffer); ^ weather.cpp:61:22: error: ‘atoi’ was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:71:22: error: ‘atoi’ was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:80:22: error: ‘atoi’ was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:89:31: error: ‘atol’ was not declared in this scope uint32_t l = atol(tmp_buffer); ^ weather.cpp:98:22: error: ‘atoi’ was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:110:22: error: ‘atoi’ was not declared in this scope v = atoi(tmp_buffer); ^ Done!
October 5, 2019 at 7:53 pm #62846
RayKeymasterI am confused: you said this is under CentOS 7, so does your Raspberry Pi run CentOS 7, or are you compiling the code under a desktop CentOS 7? I would assume your RPi runs CentOS 7, because you are using ‘./build.sh ospi’. If you are building it on a desktop Linux, you should be ‘./build.sh demo’. I have no experience with CentOS 7, so unfortunately I can’t tell what’s the issue. Sounds like you just need to add a include header in one of those .cpp files. The code has been compiled on Raspbian and also Linux Mint and I did not observe any such error. Make sure you are on master branch. Do a clean git clone to make sure you didn’t modify anything.
October 18, 2019 at 12:03 am #62972
MarcParticipantI just updated my Raspberry Pi installation (after running a “git pull” from my installation directory), and thought I should mention that I ran into the same problem:
pi@sprinkler:~/OpenSprinklerGen2 $ sudo ./build.sh ospi Building OpenSprinkler... weather.cpp: In function 'void getweather_callback(char*)': weather.cpp:55:31: error: 'atoi' was not declared in this scope wt_errCode = atoi(tmp_buffer); ^ weather.cpp:61:22: error: 'atoi' was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:71:22: error: 'atoi' was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:80:22: error: 'atoi' was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:89:31: error: 'atol' was not declared in this scope uint32_t l = atol(tmp_buffer); ^ weather.cpp:98:22: error: 'atoi' was not declared in this scope v = atoi(tmp_buffer); ^ weather.cpp:110:22: error: 'atoi' was not declared in this scope v = atoi(tmp_buffer); ^ Done!
I added a line to the weather.cpp file to include the C standard library include file (i.e., “#include <stdlib.h>”), and that appears to have resolved the issue for me:
pi@sprinkler:~/OpenSprinklerGen2 $ sudo ./build.sh ospi Building OpenSprinkler... Done!
October 19, 2019 at 1:34 pm #62987
RayKeymasterHmm, I just did a fresh checkout of the firmware and compiled it on my RPi and didn’t see this error at all. But sure, we can add the header file to weather.cpp anyways.
October 27, 2019 at 4:11 pm #63058
TalltreesParticipantRay, I too have the same error message as Marc when compiling a fresh copy of firmware onto a fully updated / dist-update Jessie formatted SD card. I tried compiling another SD card and again I got the same error message.
The result of this is that OpenSprinkler doesn’t run, checked /etc/init.d/OpenSprinkler.sh to find that that file has no content. I copied the content of OpenSprinkler.sh from my other Ospi running firmware 2.1.8(4) into the new build with no success.April 9, 2020 at 1:03 pm #65060
Dutchie30ParticipantA very late reply from me: Adding #include <stdlib.h> (Thx @Marc!) fixed the issue for me too. I’m all for including this in the next release.
April 9, 2020 at 1:03 pm #65072
RayKeymasterIt’s already added to the latest release of the firmware.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › OSPi 2.1.9 build errors