OpenSprinkler Forums OpenSprinkler Unified Firmware OSPi 2.1.9 build errors

This topic contains 5 replies, has 2 voices, and was last updated by  Ray 1 week, 1 day ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #62780

    Dutchie30
    Participant

    I’m seeing some build errors under CentOS 7:

    {code}[[email protected] 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/

    #62790

    Ray
    Keymaster

    Sounds 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.

    #62821

    Dutchie30
    Participant

    Strange. I’m not confident I’m missing the atoi library. A build of 2.1.8 works as expected on the same host:

    [[email protected] 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?

    #62824

    Ray
    Keymaster

    In your first post, the command you typed is:
    ./build.sh -s ospi
    what’s that ‘-s’?

    #62829

    Dutchie30
    Participant

    It’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!
    #62846

    Ray
    Keymaster

    I 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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware OSPi 2.1.9 build errors