arunmag
Hello, I am on Ubuntu 16 and When I am trying to install softPLC I get this weird error. 
Thanks in advance


arun@oit:~/Downloads/OpenPLC_v2$ sudo ./build.sh 
[sudo] password for arun: 
Building OpenPLC environment:
[MATIEC COMPILER]
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/arun/Downloads/OpenPLC_v2/matiec_src/config/missing: Unknown `--is-lightweight' option
Try `/home/arun/Downloads/OpenPLC_v2/matiec_src/config/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for bison... bison -y
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking for gawk... (cached) mawk
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/timeb.h usability... yes
checking sys/timeb.h presence... yes
checking for sys/timeb.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for alarm... yes
checking for working mktime... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for clock_gettime... yes
checking for memset... yes
checking for pow... no
checking for strcasecmp... yes
checking for strdup... yes
checking for strtoul... yes
checking for strtoull... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating absyntax/Makefile
config.status: creating absyntax_utils/Makefile
config.status: creating stage1_2/Makefile
config.status: creating stage3/Makefile
config.status: creating stage4/Makefile
config.status: creating stage4/generate_c/Makefile
config.status: creating stage4/generate_iec/Makefile
config.status: creating config/config.h
config.status: config/config.h is unchanged
config.status: executing depfiles commands
Making all in absyntax
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/absyntax'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/absyntax'
Making all in absyntax_utils
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/absyntax_utils'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/absyntax_utils'
Making all in stage1_2
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage1_2'
make  all-am
make[2]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage1_2'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage1_2'
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage1_2'
Making all in stage3
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage3'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage3'
Making all in stage4
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4'
Making all in generate_c
make[2]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4/generate_c'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4/generate_c'
Making all in generate_iec
make[2]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4/generate_iec'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4/generate_iec'
make[2]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4'
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src/stage4'
make[1]: Entering directory '/home/arun/Downloads/OpenPLC_v2/matiec_src'
make[1]: Leaving directory '/home/arun/Downloads/OpenPLC_v2/matiec_src'
[LADDER]
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
[GLUE GENERATOR]

The OpenPLC needs a driver to be able to control physical or virtual hardware.
Please select the driver you would like to use:
1) Blank      5) UniPi       9) Arduino+RaspberryPi
2) Modbus      6) PiXtend      10) Simulink
3) Fischertechnik    7) Arduino
4) RaspberryPi      8) ESP8266
#? 1
[OPENPLC]
Generating object files...
In file included from Config0.c:6:0:
./lib/iec_std_lib.h: In function ‘TIME __time_mul(TIME, LREAL)’:
./lib/iec_std_lib.h:379:22: warning: narrowing conversion of ‘((LREAL)(long int)ns.div_t::rem + ((s_f - (LREAL)s) * (LREAL)1000000000))’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
         (long)ns.rem + (s_f - s) * 1000000000 };
         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
./lib/iec_std_lib.h: In function ‘TIME __real_to_time(LREAL)’:
./lib/iec_std_lib.h:537:94: warning: narrowing conversion of ‘IN’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
 E   __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};}
                                                                             ^
./lib/iec_std_lib.h:537:82: warning: narrowing conversion of ‘((IN - (LREAL)(LINT)IN) * (LREAL)1000000000)’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
  TIME   __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};}
                                                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
./lib/iec_std_lib.h: In function ‘STRING __time_to_string(TIME)’:
./lib/iec_std_lib.h:584:42: error: call of overloaded ‘div(long int&, int)’ is ambiguous
     days = div(IN.tv_sec, SECONDS_PER_DAY);
                                          ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/stdlib.h:36,
                 from ./lib/iec_std_lib.h:40,
                 from Config0.c:6:
/usr/include/stdlib.h:749:14: note: candidate: div_t div(int, int)
 extern div_t div (int __numer, int __denom)
              ^~~
In file included from /usr/include/c++/6/stdlib.h:36:0,
                 from ./lib/iec_std_lib.h:40,
                 from Config0.c:6:
/usr/include/c++/6/cstdlib:233:3: note: candidate: lldiv_t __gnu_cxx::div(long long int, long long int)
   div(long long __n, long long __d)
   ^~~
/usr/include/c++/6/cstdlib:175:3: note: candidate: ldiv_t std::div(long int, long int)
   div(long __i, long __j) { return ldiv(__i, __j); }
   ^~~
In file included from Res0.c:6:0:
./lib/iec_std_lib.h: In function ‘TIME __time_mul(TIME, LREAL)’:
./lib/iec_std_lib.h:379:22: warning: narrowing conversion of ‘((LREAL)(long int)ns.div_t::rem + ((s_f - (LREAL)s) * (LREAL)1000000000))’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
         (long)ns.rem + (s_f - s) * 1000000000 };
         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
./lib/iec_std_lib.h: In function ‘TIME __real_to_time(LREAL)’:
./lib/iec_std_lib.h:537:94: warning: narrowing conversion of ‘IN’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
 E   __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};}
                                                                             ^
./lib/iec_std_lib.h:537:82: warning: narrowing conversion of ‘((IN - (LREAL)(LINT)IN) * (LREAL)1000000000)’ from ‘LREAL {aka double}’ to ‘long int’ inside { } [-Wnarrowing]
  TIME   __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};}
                                                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
./lib/iec_std_lib.h: In function ‘STRING __time_to_string(TIME)’:
./lib/iec_std_lib.h:584:42: error: call of overloaded ‘div(long int&, int)’ is ambiguous
     days = div(IN.tv_sec, SECONDS_PER_DAY);
                                          ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/stdlib.h:36,
                 from ./lib/iec_std_lib.h:40,
                 from Res0.c:6:
/usr/include/stdlib.h:749:14: note: candidate: div_t div(int, int)
 extern div_t div (int __numer, int __denom)
              ^~~
In file included from /usr/include/c++/6/stdlib.h:36:0,
                 from ./lib/iec_std_lib.h:40,
                 from Res0.c:6:
/usr/include/c++/6/cstdlib:233:3: note: candidate: lldiv_t __gnu_cxx::div(long long int, long long int)
   div(long long __n, long long __d)
   ^~~
/usr/include/c++/6/cstdlib:175:3: note: candidate: ldiv_t std::div(long int, long int)
   div(long __i, long __j) { return ldiv(__i, __j); }
   ^~~
Generating glueVars.cpp
Compiling main program
g++: error: *.o: No such file or directory
Reply 0 0
thiagoralves
This is really strange. I had no problems installing and running OpenPLC on Ubuntu 15. Haven't tried Ubuntu 16 yet. Are you sure that you installed all dependencies before building OpenPLC?

sudo apt-get update
sudo apt-get install build-essential pkg-config bison flex
sudo apt-get install autoconf automake libtool make nodejs git
Reply 0 0
arunmag
Hello, Thanks for the reply. 
Yes. Installed all the dependencies. Just checked too. I am currently on LXDE desktop. 
Reply 0 0
arunmag
I even reinstalled to Ubuntu 17.04. Still same error.
Am i missing anything??
Reply 0 0
thiagoralves
It seems that the more recent version of GCC is causing issues with OpenPLC code. I just installed Ubuntu 17.04 on a VM and got the same error. It works fine with GCC from Ubuntu 15 though. I'll look for a solution and let you know once I figured it out.
Reply 0 0
thiagoralves
I fixed the problem. The correction is already on git, so all you need to do is to git clone the repository again and build. It will still give you some warnings but the compilation work fine. Let me know if you have any problems with it.
Reply 0 0
Reply