Problems with running Stand-Alone OPC UA Server on Raspberry Pi 4
-
Dear Community,
Currently I am trying to run an application with a stand-alone OPC UA Server on a Rasperry Pi 4B, which is based on the official waterpump simulation server example of Qt Documentation: https://doc-snapshots.qt.io/qtopcua/qtopcua-waterpump-waterpump-qmlcpp-example.html
For the cross compilation, I used the following installation guide: https://wapel.de/?p=842The problem, which I am trying to solve is the following:
The OPC UA Serverproject can be built with two development Kits:-
The Desktop Development Kit is working without any problems.
-
By using the Raspberry Pi Development Kit, I got the following error messages:
I tried to solve this problem by comparing the included header files and the project structure with the official waterpump example. They exactly match the default specifications of the waterpump example.
I don´t understand the reason for this kind of errors. Maybe there is anyone who had the same problem?
Thank you in Advance!
-
-
I solved the problem by myself changing two things:
- Changing Pro-File:
TEMPLATE = app INCLUDEPATH += \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541 \ $$PWD/../../../../raspi/sysroot/usr/include DEPENDPATH += INCLUDEPATH QT += core gui QT += opcua QT += opcua-private greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 qtConfig(open62541):!qtConfig(system-open62541) { include($$PWD/../../../../raspi/qtopcua/src/3rdparty/open62541.pri) } else { QMAKE_USE_PRIVATE += open62541 } SOURCES += \ main.cpp \ simulationserver.cpp \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541/qopen62541utils.cpp \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541/qopen62541valueconverter.cpp HEADERS += \ simulationserver.h\ FORMS += \ simulationserver.ui TRANSLATIONS += \ OpcUa_Server_RasperryPi4_en_GB.ts # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /home/pi/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
Changing the server-main class type from QWidget to QObject
-
Old Code:
Simulationserver::Simulationserver(QWidget *parent) : QMainWindow(parent)
-
New Code:
Simulationserver::Simulationserver(QObject *parent) : QObject(parent)
-
-
For the cross compilation, I used the following installation guide: https://wapel.de/?p=842
just in case, have you cross-compiled the Qt OPC UA module for RPi 4 as well?
If so, is it properly deployed/copied into your sysroot location in host PC? -
@Pablo-J-Rogina: Thank you for your answer. Please have a look at my comments:
just in case, have you cross-compiled the Qt OPC UA module for RPi 4 as well?
If so, is it properly deployed/copied into your sysroot location in host PC?Yes, I have cross-compiled the Qt OPC UA module as well. I used this part of the installation guide:
https://wapel.de/?p=842I checked the sysroot folder in my host PC: /home/user/raspi/sysroot/lib/qt5/bin/
--> there is only a folder installed, which is called qt5I checked the second folder, which was build by the installation guide: /home/user/raspi/qt5pi/include/QtOpcUa/
--> the Qt OPC UA Library is included within this folder.Is it necessary to have the Qt OPC UA Library within the sysroot folder as well?
-
@Mauda said in Problems with running Stand-Alone OPC UA Server on Raspberry Pi 4:
Is it necessary to have the Qt OPC UA Library within the sysroot folder as well?
It depends on how you will reference the headers and libraries in your project.
Could you post your .pro and/or CMakeLists.txt files?
-
@Pablo-J-Rogina said in Problems with running Stand-Alone OPC UA Server on Raspberry Pi 4:
Could you post your .pro and/or CMakeLists.txt files?
Shure, here is my .pro file:
QT += core gui QT += opcua QT += opcua-private greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 TEMPLATE = app DEPENDPATH += INCLUDEPATH INCLUDEPATH += \ $$PWD/../../../../src/plugins/opcua/open62541 SOURCES += \ main.cpp \ simulationserver.cpp \ /home/qt-projects/OpcUa_Server/OpcUa_Server_RasperryPi4/Third_Party/open62541/qopen62541utils.cpp \ /home/qt-projects/OpcUa_Server/OpcUa_Server_RasperryPi4/Third_Party/open62541/qopen62541valueconverter.cpp HEADERS += \ simulationserver.h FORMS += \ simulationserver.ui TRANSLATIONS += \ OpcUa_Server_RasperryPi4_en_GB.ts qtConfig(open62541):!qtConfig(system-open62541) { include(/home/qt-projects/OpcUa_Server/OpcUa_Server_RasperryPi4/Third_Party/open62541.pri) } else { QMAKE_USE_PRIVATE += open62541 } # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /home/pi/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
Where can I find the CMakeLists.txt file?
Thank you!
-
I solved the problem by myself changing two things:
- Changing Pro-File:
TEMPLATE = app INCLUDEPATH += \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541 \ $$PWD/../../../../raspi/sysroot/usr/include DEPENDPATH += INCLUDEPATH QT += core gui QT += opcua QT += opcua-private greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 qtConfig(open62541):!qtConfig(system-open62541) { include($$PWD/../../../../raspi/qtopcua/src/3rdparty/open62541.pri) } else { QMAKE_USE_PRIVATE += open62541 } SOURCES += \ main.cpp \ simulationserver.cpp \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541/qopen62541utils.cpp \ $$PWD/../../../../raspi/qtopcua/src/plugins/opcua/open62541/qopen62541valueconverter.cpp HEADERS += \ simulationserver.h\ FORMS += \ simulationserver.ui TRANSLATIONS += \ OpcUa_Server_RasperryPi4_en_GB.ts # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /home/pi/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
Changing the server-main class type from QWidget to QObject
-
Old Code:
Simulationserver::Simulationserver(QWidget *parent) : QMainWindow(parent)
-
New Code:
Simulationserver::Simulationserver(QObject *parent) : QObject(parent)
-