GordonH
Hi,

I am trying to get this installed and working as a development environment for teaching my friend PLC programming but I am getting errors with the compiler.

I am using Windows 10 and have tried to simply compile the hello world example program just to see how everything works together. Can you please have a look at the log below and offer any advice?

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 Raspberry Pi
Generating object files...
Generating glueVars...
varName: __IX0_0 varType: BOOL
varName: __QX0_0 varType: BOOL
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
hardware_layer.cpp:31:10: fatal error: wiringPi.h: No such file or directory
 #include <wiringPi.h>
          ^~~~~~~~~~~~
compilation terminated.
modbus_master.cpp:31:10: fatal error: modbus.h: No such file or directory
 #include <modbus.h>
          ^~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!
Reply 0 0
thiagoralves
It looks that you're running it on a Raspberry Pi, right? If so, are you using Raspbian? It seems that your installation didn't complete correctly or you had some other problem while installing. My recommendation is that you reinstall OpenPLC on a fresh Raspbian image (other programs installed previously can interfere with OpenPLC).
Reply 0 0
GordonH
thiagoralves
Thanks for your reply, you are half right!

I am developing on Windows 10 and using the Windows runtime to compile and run my projects. Have I set an option somewhere to compile for Raspberry Pi rather than the Windows runtime?
Reply 0 0
thiagoralves
Yes you did. Go to the Hardware tab, and choose the blank driver (windows) and save your changes.
Reply 1 0
GordonH
ah, that's what happens when you don't read things and just click wildly!

Thanks for your help.
Reply 0 0
Moezzz
It looks that you're running it on a Raspberry Pi, right? If so, are you using Raspbian? It seems that your installation didn't complete correctly or you had some other problem while installing. My recommendation is that you reinstall OpenPLC on a fresh Raspbian image (other programs installed previously can interfere with OpenPLC).

Hi thiagoralves
I just installed openPLC on a raspberry pi 3 board with a fresh raspian os with no addional programs installed exept git

Raspberry Pi OS Lite

  • Release date: April 4th 2022
  • System: 64-bit
  • Kernel version: 5.15
  • Debian version: 11 (bullseye)
when enabling hardware IO Access  I find the same error

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 Raspberry Pi
Generating object files...
Generating glueVars...
Compiling main program...
hardware_layer.cpp:31:10: fatal error: wiringPi.h: No such file or directory
31 | #include <wiringPi.h>
| ^~~~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!

thanks for help me to solve this problem

Reply 0 0
thiagoralves
You need to install WiringPi. OpenPLC uses WiringPi to control the Pi's GPIO pins. It used to come with Raspbian, it might not be the case anymore...
Reply 1 0
Moezzz
You need to install WiringPi. OpenPLC uses WiringPi to control the Pi's GPIO pins. It used to come with Raspbian, it might not be the case anymore...



Thank you for your reply. I installed wiringpi v2.52there is still an error message




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 Raspberry Pi
Generating object files...
Generating glueVars...
Compiling main program...
/usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/10/../../../../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /lib/../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/10/../../../ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: cannot find -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/10/../../../../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /lib/../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/../lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/10/../../../ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /lib/ libwiringPi.so when searching for -lwiringPi
/usr/bin/ld: skipping incompatible /usr/lib/ libwiringPi.so when searching for -lwiringPi
collect2: error: ld returned 1 exit status
Error compiling C files
Compilation finished with errors!
Reply 0 0
thiagoralves
I don’t know how you installed this version of WiringPi but clearly it was not right. You will have to remove it and reinstall the latest version from here:  https://github.com/WiringPi/WiringPi/releases/tag/2.61-1
Reply 1 0
Moezzz
I don’t know how you installed this version of WiringPi but clearly it was not right. You will have to remove it and reinstall the latest version from here:  https://github.com/WiringPi/WiringPi/releases/tag/2.61-1


Yes it works thanks a lot
Reply 0 0
AndyS
I am trying to setup a development PC for my software engineers on a Windows 10 PC and I have the same problem and found this forum. I have checked the Hardware Tab and it is set to Blank. Is there any suggestions to what I try next? Below is the final part of the install log.
 
[FINALIZING]
Activating Blank driver
Setting Platform
cat: ethercat: No such file or directory
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Including Siemens S7 Protocol via snap7
Moving Files...
Compiling for Windows
Generating object files...
Generating glueVars...
Compiling main program...
modbus_master.cpp:31:10: fatal error: modbus.h: No such file or directory
31 | #include <modbus.h>
| ^~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!
 
Thanks for any help offered.
Reply 0 0
thiagoralves
Something went wrong during the installation of your runtime, most likely with the libmodbus installation. That’s why it is failing to include Modbus.h. Try rebasing it twice (there is an icon on the windows menu to rebase) and then check if it works
Reply 0 0
AndyS
Hi Thiago, thank you very much for the quick reply.
I've rebased it twice but I still get the same error. For background, I used the MSYS2 install method from here: - 1.3 Installing OpenPLC Runtime on Windows – Autonomy.
I'm not sure if this is relevant?
Thanks again.
Reply 0 0
thiagoralves
Try the following. Open the MSYS2 terminal (plain MSYS2, not the mingw one) and type the following:
rm -Rf OpenPLC_v3
git clone https://github.com/thiagoralves/OpenPLC_v3
cd OpenPLC_v3
./install.sh win_msys2
Once everything is finished, copy and paste the whole installation output here please for me to check.
Reply 0 0
AndyS
Hi Thiago - sorry for the delay.
I ran the commands as per your instructions and it finished with no errors.
I think everything is OK now. See installation output attached.
According to my software engineers, everything is running OK.
Thank you very much for taking the time to help me. It is truly appreciated.
Reply 1 0
Reply