ctbenergy

successfully tested OpenPLC under "Bash on Ubuntu on Windows"

https://msdn.microsoft.com/de-de/commandline/wsl/install_guide

~/OpenPLC_v2$ sudo nodejs server.js
Working on port 8081
Hello_World.st is starting ...
Hello_World.st uploaded to st_files/Hello_World.st
finishing old program...
compiling new program...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c

Program compiled successfully
moving files...
compiling OpenPLC...
stdout: Generating object files...
Generating glueVars.cpp
varName: __IX0_0 varType: BOOL
varName: __QX0_0 varType: BOOL
Compiling main program

stderr:
compiled without errors
Starting OpenPLC Software...



it runs out of the box, only changed port 8080 to 8081 in server.js, something already listening on port 8080.

app.listen(8081,function()
{
console.log("Working on port 8081");
});


 

Reply 1 0
nmambre
When I tested this, I got this error:


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


I found the lib and copied it with other libs and could run openplc


sudo cp /usr/local/lib/libmodbus.so* /usr/lib/x86_64-linux-gnu/
Reply 0 0
thiagoralves
ctbenergy wrote:
successfully tested OpenPLC under "Bash on Ubuntu on Windows"
https://msdn.microsoft.com/de-de/commandline/wsl/install_guide

These are great news! I've heard about this Bash on Windows thing, but as far as I know it is still in beta, right? It's a great idea to have Linux users migrating to Windows. Which driver did you use with the OpenPLC? I'm wondering if it will work with the ESP8266 or the Arduino driver.

nmambre wrote:
When I tested this, I got this error:
 ./openplc: error while loading shared libraries: libmodbus.so.5: cannot open shared object file: No such file or directory 

Libmodbus gives a lot of headache on the linking step. At least now it is only needed if you choose the Modbus driver. Can you paste here the output of the OpenPLC installation, specially after you choose the Modbus driver? I'm wondering if it could even compile it successfully.
Reply 0 0
nmambre
I haven't booted into Win10 for a long time. I don't have the output during compile/install, but I forgot I had this output saved. If I remember correctly, there was no mayor problems during install.

nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ sudo ./openplc
sudo: unable to resolve host NMWIN10
./openplc: error while loading shared libraries: libmodbus.so.5: cannot open shared object file: No such file or directory
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ man ldd
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ ldd openplc
        linux-vdso.so.1 =>  (0x00007fffedfb6000)
        libmodbus.so.5 => not found
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffbf3ff0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffbf3dc0000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffbf3ba0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffbf37d0000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffbf34b0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffbf4400000)
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ locate libmodbus.so.5
/home/nmambre/Testing/OpenPLC_v2/libmodbus_src/src/.libs/libmodbus.so.5
/home/nmambre/Testing/OpenPLC_v2/libmodbus_src/src/.libs/libmodbus.so.5.1.0
/usr/local/lib/libmodbus.so.5
/usr/local/lib/libmodbus.so.5.1.0
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ sudo cp /usr/local/lib/libmodbus.so* /usr/lib/x86_64-linux-gnu/
sudo: unable to resolve host NMWIN10
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ ls /usr/lib/x86_64-linux-gnu/libmodbus.so*
/usr/lib/x86_64-linux-gnu/libmodbus.so    /usr/lib/x86_64-linux-gnu/libmodbus.so.5.1.0
/usr/lib/x86_64-linux-gnu/libmodbus.so.5
nmambre@NMWIN10:~/Testing/OpenPLC_v2/core$ sudo ./openplc
sudo: unable to resolve host NMWIN10
OpenPLC Software running...
Setting main thread priority to RT
Server: Listening on port 502
Server: waiting for new client...
Locking main thread memory
WARNING: Failed to lock memory
Getting current time
Server: Client accepted! Creating thread for the new client ID: 5...
Server: waiting for new client...
Server: Thread created for client ID: 5
Reply 0 0
RottenRonnie
You saved my bacon!

I'd been running cygwin64 under Win10:
 Ron@Hal_9000:~/OpenPLC_v2$ node server.js Working on port 8080 


And when I navigated to http://127.0.0.1:8080 all I got was "invalid request"

I modified my server.js using nano and changed the port as per your example and the server now works properly!

Cheers!

ctbenergy wrote:

successfully tested OpenPLC under "Bash on Ubuntu on Windows"

https://msdn.microsoft.com/de-de/commandline/wsl/install_guide

~/OpenPLC_v2$ sudo nodejs server.js Working on port 8081 Hello_World.st is starting ... Hello_World.st uploaded to st_files/Hello_World.st finishing old program... compiling new program... POUS.c POUS.h LOCATED_VARIABLES.h VARIABLES.csv Config0.c Config0.h Res0.c

Program compiled successfully moving files... compiling OpenPLC... stdout: Generating object files... Generating glueVars.cpp varName: __IX0_0 varType: BOOL varName: __QX0_0 varType: BOOL Compiling main program

stderr: compiled without errors Starting OpenPLC Software...



it runs out of the box, only changed port 8080 to 8081 in server.js, something already listening on port 8080.

app.listen(8081,function() { console.log("Working on port 8081"); });


 

Reply 0 0
Reply