DanielH
I've managed to install OpenPLC v3.1 runtime in Arch Linux, adapting install.sh to suit Arch Linux dependencies.
See attached openplc_runtime_w_archlinux_install.sh.

All the installation process went fine, I have OpenPLC webserver running at localhost:8080 and I can upload different programs for testing web interface and generated .st files.

OpenPLC Hardware Layer is Blank Linux at the moment, as intended due the lack of Modbus Slave Devices driver in v3.

I've uploaded a very simple test program generated in BeremizIDE (BTW: PLCOpenEditor from  http://www.openplcproject.com refuses to properly work in my system).

The only change I have needed to succefully upload the program in OPLC runtime, is to change 

CONFIGURATION config to Config0 in generated_ plc.st file (found in build sub directory under my project directory).

Attached generated_ plc.st

Uploading it in OPLC webserver interface brings this results:
<code>
Optimizing ST program...
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Linux
Generating object files...
Generating glueVars...
varName: __IX0_0 varType: BOOL
varName: __IX0_1 varType: BOOL
varName: __QX0_0 varType: BOOL
Compiling main program...
Compilation finished successfully!
</code>

However, when I try to start program execution (Start PLC button in webserver interface), it fails with "OpenPLC Runtime is not running" message.

Below, terminal OPLC logs:
<code>
[daniel@hardwork OpenPLC_v3]$ ./start_ openplc.sh
* Serving Flask app "webserver" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /dashboard HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /login HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /static/openplc_logo.gif HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "POST /login HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /dashboard HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/default-user.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/home-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/programs-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/arrow.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/modbus-icon-512x512.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/hardware-icon-980x974.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/monitoring-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/users-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/settings-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/logout-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:56] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:57] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:58] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:59] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:00] "GET /runtime_logs HTTP/1.1" 200 -
./core/openplc: error while loading shared libraries: libasiodnp3.so: cannot open shared object file: No such file or directory
OpenPLC Runtime is not running. Error: [Errno 111] Connection refused
127.0.0.1 - - [01/Jul/2018 22:12:01] "GET /runtime_logs HTTP/1.1" 200 -
Openning database
Enabling Modbus on port 5020
Enabling DNP3 on port 20000
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /start_plc HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /dashboard HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:03] "GET /runtime_logs HTTP/1.1" 200 -
</code>

Note the log: ./core/openplc: error while loading shared libraries: libasiodnp3.so: cannot open shared object file: No such file or directory.

However, I have all required shared libraries under /usr/local/lib/
-rwxr-xr-x 1 root root 764048 jul 1 20:40 libasiodnp3.so
-rwxr-xr-x 1 root root 471352 jul 1 20:38 libasiopal.so
-rwxr-xr-x 1 root root 1599960 jul 1 20:38 libopendnp3.so
-rwxr-xr-x 1 root root 49152 jul 1 20:36 libopenpal.so

Is /usr/local/lib/ the directory on which OPLC runtime search for shared libraries, or I mus to move /copy them ontoanother directory?

Your answer will be welcome.
Best regards,
DanielH




Quote 0 0
DanielH
Sorry, I forgot to upload the attachments :-(
There they go...
Quote 0 0
thiagoralves
Those missing library errors are related to OpenDNP3. OpenPLC installer follows the recipe to build DNP3 exactly as the instructions suggest. It works on Debian-based systems, but might have issues with other systems. Given that those are dynamic libraries, apparently there is something messed up on your library path or something like that. It might be helpful to do a search on the OpenDNP3 forums to see other arch linux users that may have found a solution.
Quote 0 0
DanielH
Dear Thiago:

[SOLVED]
I have OpenPLC runtime running!

Logs in localhost:8080, after login:

OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Issued start_modbus() command to start on port: 5020
Modbus Server: Listening on port 5020
Modbus Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000

There is not missing libraries, OpenDNP3 libs were intalled at /usr/local/lib/ by install.sh
But OpenPLC runtime expects that OpenDNP3 libraries (libasiodnp3.so, libasiopal.so, libopendnp3.so, libopenpal.so) are installed directly under /usr/bin !!!

So, simply I've created symlinks to those libs in /usr/bin directory (I don't want to move the lib files from /usr/local/lib, as /usr/local/bin is the directory for locally installed programs and /usr/local/lib for its libraries).

Please, see openplc_runtime_w_archlinux_install.sh.txt attached to my previous email.
I haven't changed nothing but adding commands to update Arch package database and binaries, install build and runtime dependencies, and edit start_ openplc.sh to launch webserver.py by python2. (BTW: python is python3 in Arch Linux).
I haven't touch nothing in OpenDNP3 install section...

So:
All's well thats end well...

Now, I'm still waiting for your Modbus drive for v3 ;-)
I wish to use cheap Modbus RTU I/O interfaces (RS-485), like WELLPRO [1]

Meanwhile, I will try to use Arduino Mega as Slave Device.
I will try to install OPLC runtime onto an old Raspberry P model 1 B, too, but running on Arch Linux ARM, not Raspbian (as you can see, I'm not a Debian friend).

[1]  http://www.shwellpro.com/index.asp

Best regard,
DanielH
Quote 0 0
krive001
Same problem archlinux. Install finish. 

./core/openplc: error while loading shared libraries: libasiodnp3.so: cannot open shared object file: No such file or directory

How to thanks.
Quote 0 0
thiagoralves
Well, DanielH already gave you the solution on the post above. Just create symlinks for the libraries and put them on /usr/bin. If you don't know how to do that, I suggest you stop using archlinux and start using debian as it is a lot more user friendly.
Quote 0 0
krive001
Thanks. Work.
Quote 0 0
Olorin
I'm trying to install OpenPLC on Manjaro and I'm having some problems.
It appears that the update line in the attached script tries to install a package that does not exist: python2-flask-login
I am also told that the -n option is not correct maybe I have to modify the script as below?
sudo pacman -S --needed bison flex autoconf automake libtool make pkg-config cmake git sqlite3 python2 python2-flask-login.
Does the current version of openPLC work using Python 3?

Thank you all.
DanielH wrote:
I've managed to install OpenPLC v3.1 runtime in Arch Linux, adapting install.sh to suit Arch Linux dependencies.
See attached openplc_runtime_w_archlinux_install.sh.

All the installation process went fine, I have OpenPLC webserver running at localhost:8080 and I can upload different programs for testing web interface and generated .st files.

OpenPLC Hardware Layer is Blank Linux at the moment, as intended due the lack of Modbus Slave Devices driver in v3.

I've uploaded a very simple test program generated in BeremizIDE (BTW: PLCOpenEditor from  http://www.openplcproject.com refuses to properly work in my system).

The only change I have needed to succefully upload the program in OPLC runtime, is to change 

CONFIGURATION config to Config0 in generated_ plc.st file (found in build sub directory under my project directory).

Attached generated_ plc.st

Uploading it in OPLC webserver interface brings this results:
<code>
Optimizing ST program...
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Linux
Generating object files...
Generating glueVars...
varName: __IX0_0 varType: BOOL
varName: __IX0_1 varType: BOOL
varName: __QX0_0 varType: BOOL
Compiling main program...
Compilation finished successfully!
</code>

However, when I try to start program execution (Start PLC button in webserver interface), it fails with "OpenPLC Runtime is not running" message.

Below, terminal OPLC logs:
<code>
[daniel@hardwork OpenPLC_v3]$ ./start_ openplc.sh
* Serving Flask app "webserver" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /dashboard HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /login HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:45] "GET /static/openplc_logo.gif HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "POST /login HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /dashboard HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/default-user.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/home-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/programs-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/arrow.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/modbus-icon-512x512.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/hardware-icon-980x974.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/monitoring-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/users-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/settings-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /static/logout-icon-64x64.png HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:55] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:56] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:57] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:58] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:11:59] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:00] "GET /runtime_logs HTTP/1.1" 200 -
./core/openplc: error while loading shared libraries: libasiodnp3.so: cannot open shared object file: No such file or directory
OpenPLC Runtime is not running. Error: [Errno 111] Connection refused
127.0.0.1 - - [01/Jul/2018 22:12:01] "GET /runtime_logs HTTP/1.1" 200 -
Openning database
Enabling Modbus on port 5020
Enabling DNP3 on port 20000
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /start_plc HTTP/1.1" 302 -
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /dashboard HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:02] "GET /runtime_logs HTTP/1.1" 200 -
127.0.0.1 - - [01/Jul/2018 22:12:03] "GET /runtime_logs HTTP/1.1" 200 -
</code>

Note the log: ./core/openplc: error while loading shared libraries: libasiodnp3.so: cannot open shared object file: No such file or directory.

However, I have all required shared libraries under /usr/local/lib/
-rwxr-xr-x 1 root root 764048 jul 1 20:40 libasiodnp3.so
-rwxr-xr-x 1 root root 471352 jul 1 20:38 libasiopal.so
-rwxr-xr-x 1 root root 1599960 jul 1 20:38 libopendnp3.so
-rwxr-xr-x 1 root root 49152 jul 1 20:36 libopenpal.so

Is /usr/local/lib/ the directory on which OPLC runtime search for shared libraries, or I mus to move /copy them ontoanother directory?

Your answer will be welcome.
Best regards,
DanielH




================
http://www.flussiliberi.it/
================
Quote 0 0
thiagoralves
OpenPLC won’t run on Python 3. You can try installing flask-login with pip
Quote 1 0
Olorin
OpenPLC won’t run on Python 3. You can try installing flask-login with pip


Perfect, I will install python2-pip and then with pip2 what I am missing.
Thanks so much.

PS : If I succeed I will modify the shell file for the installation of OpenPLC on Manjaro and then I will post it here.
================
http://www.flussiliberi.it/
================
Quote 0 0
Olorin
Almost everything ok except this error at the end of the process.
How can I solve it?

[FINALIZING]
Activating Blank driver
Setting Platform
Optimizing ST program...
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Linux
Generating object files...
Generating glueVars...
Compiling main program...
Package libmodbus was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmodbus.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libmodbus', required by 'virtual:world', not found
modbus_master.cpp:31:10: fatal error: modbus.h: File o directory non esistente
   31 | #include <modbus.h>
      |          ^~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!
================
http://www.flussiliberi.it/
================
Quote 0 0
Mike7518
Olorin wrote:
Almost everything ok except this error at the end of the process.
How can I solve it?
[...]
Package
 libmodbus was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmodbus.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libmodbus', required by 'virtual:world', not found
modbus_master.cpp:31:10: fatal error: modbus.h: File o directory non esistente
   31 | #include <modbus.h>
      |          ^~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!


It looks like you are missing the modbus libraries.
You could try installing it with
sudo pacman -Syu libmodbus

It should then appear when searching for libraries :
ldconfig -p | grep libmodbus
Quote 0 0
Olorin
Probably the automatic procedure that compiles and installs libmodbus does not install it in the correct path for distro derived from ARCH.
Later I attach the installation sh file which I have adapted for Manjaro and the installation log.

Mike7518 wrote:


It looks like you are missing the modbus libraries.
You could try installing it with
sudo pacman -Syu libmodbus

It should then appear when searching for libraries :
ldconfig -| grep libmodbus
================
http://www.flussiliberi.it/
================
Quote 0 0
Olorin
Hi all.
These are the shell files that I have modified (renamed to be able to upload) and the installation log.
Maybe I will try to install libmodbus with pacman from AUR but in reality the compilation of the library seems to be successful.
================
http://www.flussiliberi.it/
================
Quote 0 0