Building Qt OPC UA with open62541

Qt OPC UA is not included in the Qt installer and must be built from source.
Open62541 is currently the most stable and feature complete backend, the open62541 library has minimal external dependencies and can be easily built on all supported platforms (Linux, Windows (MinGW32, MSVC 2017), Android and iOS).

Requirements

First of all, an installation of Qt 5.11 is required. Using the Qt installer also provides the necessary tools required to build Qt OPC UA.
Building open62541 requires CMake and Python. The Python package six must be installed from a terminal before starting the build by executing

Building the Qt OPC UA module requires an installation of Perl.

Building on Linux

Build open62541

Build Qt OPC UA

Building on Windows

MinGW32

Execute the following commands in the  “Qt 5.11.1 for Desktop (MinGW 5.3.0 32 bit)” shell

Build open62541

Build Qt OPC UA

MSVC 2017

Execute the following commands in the “Qt 5.11.1 64-bit for Desktop (MSVC 2017)” shell

Build open62541

Build Qt OPC UA

Building for Android

Additional requirements

An Android NDK and CMake >= 3.6.0 are required to build for Android.

Building on Linux

Build open62541

Build Qt OPC UA

Building on Windows

Execute the following commands in the  “Qt 5.11.1 for Desktop (MinGW 5.3.0 32 bit)” shell

Build open62541

Build Qt OPC UA

Building for iOS

Additional requirements

XCode is required to build for iOS

Build open62541

Build Qt OPC UA

Creating the documentation

Use the same shell and the platform specific make tool that has been used in building the Qt OPC UA module. Building the docs on Linux or OS X requires using sudo to execute the second step if Qt has been installed to a location not writable by the current user.

Building the examples

Use the same shell and the platform specific make tool that has been used in building the Qt OPC UA module. The examples will be created in “examples” in the build directory.

 

20 thoughts on “Building Qt OPC UA with open62541”

    1. We are actually thinking about a server side API, but so far nothing is planed for the short to mid-term range. We currently focus on completing the client side API.

  1. Should we need to buy a commercial license for using Qt OPC UA in a closed source application ? The query is limited to Qt OPC UA( not the backend) and we are perfectly good with Open62541 which is under MPL.

    Or are we good with dynamic linking (LGPL adherence) also for this module? This query happened since QtOPC UA is part of Qt Automation which needs commercial license.

    1. Unlike the rest of “Qt for Automation” which is dual licensed (commercial + GPL), Qt OPC UA is tripple licensed (commercial + LGPL + GPL).

      Which means, as long as you can comply with the requirements of the LGPL (dynamic linking amongst others), you can use Qt OPC UA without a commercial license in a closed source application.

  2. I have a Problem following the Instructions. It leaves me with: qopen62541backend.cpp:506:9: error: ‘UA_Client_runAsync’ was not declared in this scope

    Any help would be useful
    Best Regards

      1. Or well, on my first try i had been on master and maybe there still is a conflict. I will try to remove any related files and try again.

        1. You are welcome! As you might know Qt OPC UA is currently a tech preview. To stabilize the API we rely on user feedback (missing features, is the API good, use cases covered, …). Please let us know if Qt OPC UA works or what doesn’t work for you. We are also interested in the scenarios where the module is used.

  3. Great post!.

    I have compiled Qt OPC UA and open62541 on Linux. However, when I check the number available backends with QOpcUaProvider I get 0.

    Apparently, the Qt OPC UA compilation was fine.

    Qt Opcua:
    FreeOpcua ………………………… no
    Open62541 ………………………… yes
    Unified Automation C++ SDK …………. no

    test config.qtopcua_opcua.libraries.open62541 succeeded

    How do I have to include Qt OPC UA and open62541 in my pro file? I tried this two ways:

    1.- Include OPC UA module

    include(qt_plugin_open62541_backend.pri)
    include(qt_lib_opcua.pri)
    QT += opcua

    2.- Directly link to the library

    LIBS += -lQt5OpcUa

    Any idea why I am getting zero backends providers in both cases? Thanks.

    1. After a successful installation of Qt OPC UA with the open62541 backend, the following file must be present:
      /path/to/Qt/5.11.0/gcc_64/plugins/opcua/libopen62541_backend.so

      Does this file exist in your installation?

      To use Qt OPC UA in your project, the only additional entry required in the .pro file is “QT += opcua”.

      1. Thank Jannis,

        Yes, the file exists but in a local folder, I just copied it to the appropriate Qt5 plugin folder and now it is working.

        1. The file should have been copied automatically. Have you skipped the “make install” step after building the Qt OPC UA module?

  4. When i want to compile the open62541 with MSVC 2017, i get the error U1095 every time while executing nmake. What can i do?

  5. Hello there,
    I am trying to build the library and I have stumbled upon a problem I cannot overcome. I have described it here in the forums: https://forum.qt.io/topic/92432/running-and-installing-opc-ua/4 Basically I am able to successfully build Open62541. After that I move to the opcua building phase. The problem is that after I run qmake, the script shows that Open62541 is not installed (like described in the forums). What could be the case in here? I would really appreciate all help.

    1. I can’t see an obvious error in the information you posted in the forum. Please add the content of the config.log file created by qmake to the thread, it will most likely help solving the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *