Building Qt OPC UA with open62541

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

NEW: Starting with the 5.12 branch, Open62541 v0.3.0 has been added to Qt OPC UA  as a 3rd party source. The open62541 plugin is now built by default without requiring any additional setup.

Requirements

First of all, an installation of Qt 5.12 is required. Using the Qt installer also provides the necessary tools required to build Qt OPC UA except Perl which must be installed manually.

Building on Linux

Building on macOS

Building on Windows

MinGW32

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

MSVC 2017

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

Building for Android

Additional requirements

The Android NDK is required to build for Android.

Building on Linux

Building on Windows

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

Building for iOS

Additional requirements

XCode is required to build for iOS.

Building on macOS

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 macOS 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.

87 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.

  6. Hallo,

    do I see it right that QT OPCUA API does not cover yet the case
    of server connection with username and password whereas open62541 0.3 does cover such a case already?

    1. Connecting to a server with username and password is supported for servers which don’t require an encrypted password. Username and password must be passed as part of the QUrl in connectToEndpoint() (opc.tcp://user:pass@host). This can be done directly or by using url.setUserName(“user”) and url.setPassword(“password”).

      I will extend the documentation accordingly.

      1. Hallo, just tried your advice with Siemens Sinumerik OPC UA 2.0
        Server. See https://github.com/sirop/qtopcua_test/blob/userpass/examples/opcua/opcuaviewer/mainwindow.cpp#L184-L188 .

        I also tried:

        QUrl myUrl;
        myUrl.setUrl(mServerUrl->text());
        myUrl.setUserName("OpcUaClient");
        myUrl.setPassword("Password2018");
        mOpcUaClient->connectToEndpoint(myUrl);

        not being sure if the order of setting QUrl matters.
        Result: https://www2.pic-upload.de/img/35931415/opcua1.png .

        However, when my using UA Expert both username and password were accepted. Pic: https://www2.pic-upload.de/img/35931441/ua_opcua2.png .

        What have I done wrongß

        Regards,
        boris

  7. hello, I have a problem when I try to compile Qt OPCUA on windows with open62541.

    I am following this tutorial (Building On Windows – Mingw32)

    I cannot seem to specify the path to the header open62541.h and the lib open62541.a even if I did

    set QTOPCUA_OPEN62541_INCLUDE_PATH=d:\open62541\build
    set QTOPCUA_OPEN62541_LIB_PATH=d:\open62541\build\bin
    Note that open62541 is compiled and that I do have the files open62541.h and libopen62541.a (in version 0.3) where they should be.

    The error I get is a linker problem : cannot find -lopen62541

    I added manually the open62541.h to the project files since it was not working either.

    What should I do to specify correctly the path to open62541 please ? Is there an up-to-date documentation ?

    1. Which branch of the Qt OPC UA repository are you trying to build?
      The steps in this tutorial are for the 5.11 branch, dev and 5.12 use a different way to configure the external dependencies.

      1. I checked, I am trying to build the 5.11 branch. Do you know if the configuration for the external dependencies changed ?

        1. This should work.
          Please delete all files from your build directory, run the steps from the tutorial again and provide the content of the config.log file that has been created by qmake. Maybe this helps to determine what went wrong.

  8. Do you know how to deploy correctly an application using QT OPCUA ?
    Under Windows, with windeployqt, it adds the dll Qt5OpcUa.dll but it seems that there is no backend for the QOpcUaProvider class when running the program.
    Do I also have to add the dll to open62541 ? (which is weird because it was linked statically ?)

    1. The application also needs the open62541 plugin.
      windeployqt does not copy the plugins by default, they must be copied to /plugins/opcua/ manually.

      1. It works !
        I want to sincerly thank you for your time and for this tutorial, I needed to use QT OPC UA for a project and succeded thanks to your help. Without it I would probably still be banging my head on my desk.
        Again, Thank you 🙂

  9. On a fresh install of Ubuntu 18.04 with Qt 5.11.1 and have tried to build for Android following your process. (Do I need to build for Linux too?)

    Everything seems okay when building but running a Qt application fails as no backends are detected.
    provider.availableBackends().isEmpty()

    I noticed another comment regarding the same issue and you said to check for a “libopen62541_backend.so”.
    I’m able to find this file under ~/Qt/5.11.1/android_arm7/plugins/opcua

    Would you have any ideas?

    Any help would be greatly appreciated.
    Many thanks

    1. The open62541 backend plugin is only built if the open62541 library is available.
      Did you see the message “Open62541 ………………………… yes” after running qmake?
      Please provide the config.log file created by qmake, it should state the reason why the plugin was not built.

  10. Hello,
    I’m on a stuck with a problem and some help will be appreciated it.
    I’ve installed open62541 following this tutorial (Building On Windows – Mingw32) and seems like everything are ok, but when I try to connect my own client with a demo opcua server the QOpcUaClient::ClientState(Connecting) is always connecting state (no matter if server is running or not).

    Debugging I can see:

    -qopen62541backend.cpp:
    Open62541AsyncBackend::connectToEndpoint(const QUrl &url) is emitting signals correctly (connected when server is running or disconnected when not) so far I think it’s ok.

    On other hand, qopcuaclientprivate.cpp:
    void pcUaClientPrivate::setStateAndError(QOpcUaClient::ClientState state, QOpcUaClient::ClientError error) seems like should receive the signals from backend class but it doesn’t work, so client state still on connecting.

    I also tried with other compiler (“Qt 5.11.1 64-bit for Desktop (MSVC 2017)”) and still happen the same.

    I’m looking forward for your feedback. Thanks in advance.
    Berna.

    1. Hello,
      I am unable to reproduce this behavior with the 5.11 branch of Qt OPC UA on Qt 5.11.1 .

      The following minimal example produces the right state transitions (connecting -> connected -> closing -> disconnected if the server is running, connecting -> disconnected if it is not):

      int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);

      QOpcUaProvider provider;
      QOpcUaClient *client = provider.createClient(“open62541”);

      QObject::connect(client, &QOpcUaClient::stateChanged, [client](QOpcUaClient::ClientState state) {
      qDebug() << "New state:" <disconnectFromEndpoint();
      if (state == QOpcUaClient::ClientState::Disconnected)
      exit(EXIT_SUCCESS);
      });

      client->connectToEndpoint(QUrl(“opc.tcp://127.0.0.1:43344”));

      return a.exec();
      }

      What result do you get when running my example?

  11. Hello Jannis,

    First at all, I want to say thanks you for your feedback.

    Despite your example work perfectly, I’m afraid that I found some issue when I tried to work with my QThread class:
    – QObject::connect(client, &QOpcUaClient::stateChanged, [client](QOpcUaClient::ClientState state): “client” have to be local not a class member, it doesn’t a big deal and I change it to a local QOpcUaClient but that bring me again to the same problem client->state() still on connecting.

    In order to fix this I tried to install open65241 with option:
    UA_ENABLE_MULTITHREADING ->ON

    cmake -DCMAKE_BUILD_TYPE=Release -G “MinGW Makefiles” -DUA_ENABLE_AMALGAMATION=ON -DUA_ENABLE_MULTITHREADING=ON ..

    Unfortulately it doesn’t work neither.

    So what do I doing in a wrong way?

    Thanks in advance.

    1. Hello,

      the Qt OPC UA open62541 backend is single threaded, Qt OPC UA also does not make any promises to be thread-safe.

      Can you paste or upload your code somewhere?

  12. Hello, I am using Qt 5.5 and I tried to compile Qt OPC UA with this version. However during the compilation I got some errors from make. I think that these errors are due the fact that I am using Qt 5.5, but the recommended version is Qt 5.11 (I tried with Qt 5.11 and works fine). In this case, is it mandatory to use Qt 5.11 or with some minor changes is it possible to use Qt 5.5?

    Thank you in advance

    1. Hello,
      as Qt OPC UA is a new module which has been first released with Qt 5.11, backwards compatibility was not a goal during implementation.
      The oldest Qt version I have built it for is 5.10.

      Since Qt 5.5, there have been many changes to the Qt code base and to the build system. I can’t tell how extensive the changes to the Qt OPC UA code would need to be.

        1. Thanks for your answers, I actually saw that there are many differences. We are thinking of moving to Qt 11.

          I’m not sure if it’s a problem with my configuration (most likely), but I had to add to “opcuaviewer.pro” file the path to the libraries with “QMAKE_RPATHDIR += /home//Qt/5.11.0/gcc_64/lib”, because I got errors like “:-1: warning: libicui18n.so.56, needed by /home//Qt/5.11.0/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)”

  13. Many thanks for this guide and thework on the library, it’s really helped me with incorporating OPC-UA into an Android Application.

    A few issues I’m unclear on though and I’m struggling to find much info, if you could help that would really be appreciated:

    Is it at all possible to retrieve historical data for a historised node, e.g. get the values between some start time and an end time? My server application supports this but I can’t find an easy way to get at the data from the client.

    Is there any further documentation or guidelines on calling method nodes?
    Trying to call a method on my server from client I can see the call arriving server-side and the results being prepared but but 75% of the time I’ll receive a ‘BadConnectionClosed’ on my Qt Client and an empty result.

    1. We are happy if Qt OPC UA works for you!

      About historical data access. This is something that is currently still missing from the API. It might be something for Qt 5.13. It won’t be in 5.12.

      Some background: the underlying open62541 is (on 0.3) currently missing this functionality. Its available on their master, but not stable API wise (yet). So if their master settles down into an 0.4 beginning of 2019, it might be there for Qt 5.13.

    2. Hello,

      Qt OPC UA does not yet support the HistoryRead service, but It’s on our to-do list.

      The water pump example and the auto tests use method calls, but generally the server should just reject the call request if it does not like the arguments that were passed. What server application are you using? Does the same problem occur if you’re running the client application on a different platform (Windows, Linux…)?
      Wireshark is able to dissect the OPC UA protocol. Does it show any indications on what went wrong?

      1. Thank you both for your replies.

        The Water Pump example is one I had a look at to get started:
        Does the NodeId of CallMethod need to be the same Id as the node you’re using to make the call?

        E.g. Node1->CallMethod(, …) ?
        Node2->CallMethod(, …)
        My server is a Raspberry Pi using the Python FreeOpcUa library to implement the server. (https://github.com/FreeOpcUa/python-opcua)

        The function is basically a very crude request for historical data (hence my earlier question!) that returns a string of timestamp/value pairs for a given node. It takes in strings at the moment just to test with sending parameters but these would eventually be datetimes.

        On the Server:

        add_method(, ,
        lambda id=0, s=”start”, end=”end”, node=result: *default args* [ua.Variant((), ua.VariantType.String)], *Method*
        [ua.VariantType.String, ua.VariantType.String], *In Args* [ua.VariantType.String]) *Out Arg*

        On the Client:

        node->callMethod(, args);

        args is a QVector with two elements.

        QPair(QString(“TestStart”),QOpcUa::Types::String)

        I get no errors on the server side; I see a trace for the method being received, the parameters parsed and the data for the node retrieved and returned. However on the client this rarely comes through, more often than not I’ll see:

        qt.opcua.plugins.open62541: Could not call method: BadConnectionClosed

        qt.opcua.plugins.open62541: Unable to send publish request

        I’ve tried using a completely different client (UaExpert) on Windows and connecting to my server and couldn’t recreate the issue – I’ll see if I can set my client application up on Windows or Linux and try again; will also look into Wireshark too.

        Thanks again and apologies for such a long post.

        1. The output from the open62541 plugin indicates that the client closes the connection because it considers a messages received from the server as invalid. This could for example be caused by an unexpected sequence number. Wireshark will show the last message from the server before the connection is closed, the best bet is to check the headers of this message and the previous one for any strange values.
          You could also build open62541 with a more verbose log level and see if you get any output which indicates what went wrong.

  14. Hi Frank:
    I am stuck in mingw32 make (building qt opc ua)
    here is the message:
    ‘perl’ is not recognized as an internal or external command,
    operable program or batch file.
    Project ERROR: Failed to run: perl -w C:\Qt\5.11.1\mingw53_32\bin\syncqt.pl -mod
    ule QtOpcUa -version 5.11.2 -outdir C:/Qt/5.11.1/mingw53_32/open62541/qtopcua/bu
    ild -builddir C:/Qt/5.11.1/mingw53_32/open62541/qtopcua/build C:/Qt/5.11.1/mingw
    53_32/open62541/qtopcua
    Makefile:41: recipe for target ‘sub-opcua-make_first’ failed
    mingw32-make[1]: *** [sub-opcua-make_first] Error 3
    mingw32-make[1]: Leaving directory ‘C:/Qt/5.11.1/mingw53_32/open62541/qtopcua/bu
    ild/src’
    Makefile:42: recipe for target ‘sub-src-make_first’ failed
    mingw32-make: *** [sub-src-make_first] Error 2

    How can I overcome this?

    1. Never mind. I managed to solved it. The code I copied from
      https://blog.basyskom.com/2018/want-to-give-qt-opcua-a-try/
      failed at “No backends found”.

      bool QOpcUaReader::init()
      {
      QOpcUaProvider p;
      qDebug() << "Available backends:" << p.availableBackends();

      if (p.availableBackends().size() == 0) {
      qDebug() << "No backends found";
      return false;
      }

      m_client.reset(p.createClient(p.availableBackends()[0]));

      if (!m_client) {
      qDebug() <connectToEndpoint(QUrl(“opc.tcp://opcua.demo-this.com:51210/UA/SampleServer”));
      return true;
      }

    2. Never mind. I managed to install it. but I am unable to run the simplest code.

      QOpcUaProvider provider;
      QStringList available = provider.availableBackends();
      if (!available.isEmpty()) {
      QOpcUaClient *client = provider.createClient(available[0]);
      if (client)
      qDebug() << "Client successfully created";
      }
      The Backend is empty. I am using Kepware OPC UA as server
      When I tried you code, the same thing No Backend availabe.
      What is backend?

  15. Hi:
    I left a message few hours ago. apparently after reading the post earlier on, I realized at the qmake .. process the message
    Open62541 ………………………… no—> which meant the qmake failed?
    my question:

    1) Build open62541 and Build Qt OPC UA are both in different directory?

    2) how can i overcome qmake failure?

    3) where is open62541 plugin after build ?

    Thanks

    1. Hello,
      if “Open62541” is marked as “no”, this means that qmake was unable to find or use the open62541 library when running the config tests.
      Did you follow the steps for MinGW in “Build open62541”?
      If you are not sure, please do so, then erase all files from the Qt OPC UA build directory and repeat the steps listed in “Build Qt OPC UA”.
      If it still does not work, check the config.log file created by qmake. It should show the reason why the config tests failed to find or use the open62541 library.

      After a successful build, the plugin will be available in the plugins/opcua directory.

      1. Hi Jannis:
        My bad. I found the mistake that I made. Well , I am start exploring it right now. I had written code (C#) as a client to opcserver. The step of connecting is quite straight forward.

        Can you point me to simple client code that connect to OPC server, and read a value or a array of addresses?

        I am able to connect to the current opc server reside in my laptop, but still figuring out how to read some addresses from the server

  16. Hi:
    Missing signal in QOpcUaNode?
    ‘dataChangeOccurred’ is not a member of ‘QOpcUaNode’
    QObject::connect(m_node.data(),&QOpcUaNode::dataChangeOccurred,this, &MainWindow::UpdateValue);

    1. Hello,
      this signal has been added in the 5.12 branch which is currently under development.
      I guess you have found the preview version of the documentation.
      The docs for Qt OPC UA 5.11 are available here: https://doc.qt.io/QtOPCUA/qtopcua-index.html

      The Qt OPC UA examples are a good starting point. The water pump example shows how to use read, write, monitoring and method calls, the explorer example shows the browse API.
      The browser example

  17. I seem to have an issue with my connections dropping after around ~10 minutes.

    I’m only connecting to servers and monitoring a single variable for change and then potentially requesting some additional values depending on its result – nothing taxing

    Is this something you’ve seen before? Or would you have any recommendations on how best to find the cause of this.

    My server is a Raspberry Pi running a Python Free-OPCUA Server and the Qt client is running on an Android device.

    Many thanks

  18. I’m having some trouble with subscribing/monitoring nodes – the connection to the server will drop out after roughly 10 minutes every time.

    I’ve tried other clients (UAExpert / Prosys) and they don’t seem to drop connection, so I’m wondering what I’ve done wrong.

    Basically I have an application that subscribes to a node common to my OPC servers I then wait for it to change value and react accordingly (it looks a bit like this):

    QOpcUaNode* n = devices[deviceName]->client->node(“ns=2;s=Common-Node”);

    n->enableMonitoring(QOpcUa::NodeAttribute::Value, QOpcUaMonitoringParameters(500));

    connect(n, &QOpcUaNode::attributeUpdated,
    this, [this,deviceName](QOpcUa::NodeAttribute attr, QVariant value)
    {
    if(value.toBool()){
    qDebug() << "Update received on NVF for: " << deviceName;
    }
    });

    Checking the output I see an entry for "Open62541: Unable to Send Publish Request" (I've tried rebuilding the library with a higher log level but there's no difference) I can't seem to find any further details.

    I'm not really seeing anything on Wireshark either the packets just seem to stop.

    Would you be able to advise?

    Many thanks

      1. Hi Jannis,

        Sorry for the double post, the related issue is my own actually (good find).

        Trying again today and it seems that any interaction with the server after ~10 minutes causes the connection to drop, so its probably not a specific subscription issue.

        There are some security policies to choose from on FreeOpcUa, is there a type expected by QtOpcUa / Open62541 or a way to specify?

        I’ll run it again and check the Wireshark output at the disconnect point, is there any specific I should look for? (not something I’m too familiar with)

        Thanks again

  19. Hey Frank,
    I’ve done install the opcua libray. when i build the example(***\qt\5.11.2\mingw53_32\open62541\build\qtopcua),
    i get these errors.:
    “Project ERROR: You cannot build examples inside the Qt source tree, except as part of a proper Qt build.
    Makefile:33: recipe for target ‘sub-opcua-qmake_all’ failed
    mingw32-make: *** [sub-opcua-qmake_all] Error 3”
    I’m not familar with QT, hoping to get your help. thanks

    1. Hello,
      according to the path, your build directory is located inside the Qt installation directory.
      As the error message states, this is not permitted when building examples.
      When building additional Qt modules for an existing Qt installation, the usual approach is to build them in a directory outside of the Qt installation directory. The files required to use the new module are copied to the Qt installation directory using “make install”. With such a setup, the examples can be built in the build directory that was used for the module itself.

  20. Hello,
    First of all thanks for these guidelines. They are quite helpful.
    I have followed the indicated steps to set up Qt OPC UA on linux (debian) using Qt 5.11.2.
    Everything seems to work fine, and the qmake configuration says that the open62541 plugin has been installed successfully.

    The problem I am facing occurs when attempting to create a client.
    Here is the error I get:
    <>

    So though the open62541 plugin available and found, it is failing to load. What could be the cause of this behavior?

    1. Hello,
      Wordpress seems to have removed the error message from your comment.
      There are two things you could check:
      1) Run the command line ldd /path/to/Qt/5.11.2/gcc_64/plugins/opcua/libopen62541_backend.so and make sure libopen62541.so points to your open62541 installation.
      2) Run your Qt OPC UA application with the environment variable QT_DEBUG_PLUGINS set to 1 and see if there is any output related to the open62541 plugin.

      1. In fact, when I run the command lld /path/to/Qt/5.11.1/gcc_64/plugins/opcua/libopen62541_backend.so, libopen62541.so does not point to the open62541 installation.
        Here how it looks like: ” libopen62541.so.0 => not found “.
        What can then be the reason of this? And how can it be fixed?

        1. This looks like your open62541 installation has somehow failed or you have installed it to a path that is not automatically searched for libraries.

      2. I have followed this tutorial: “http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html” , and I was able to fix the path to which libopen62541.so should point to by adding in /etc/ld.so.conf.d/ a ‘.conf’ file with the path to the actual path open62541 installation.
        Thanks though for your availability to address my doubt!

  21. I am trying to build qtopcua 5.12 against OPEN62541 0.3 without success. 5.11 works well, but I was hoping to use features such as findServers and requestEndpoints without digging into OPEN62541. Is this configuration currently possible? Is it on a roadmap? There doesn’t even seem to be an existence test for OPEN62541 in qtopcua\src\opcua\configure.pri. (WIN 7 and 10)

    1. The way to specify build parameters for Qt OPC UA has changed between Qt 5.11 and Qt 5.12.
      I have just updated this howto to show the steps necessary for building the 5.12 branch of Qt OPC UA with Qt 5.12.0.
      Please let us know if you have further problems with building and using Qt OPC UA.

  22. Hi! Did the way to specify build parameters on linux also change? I tried to build 5.12 with OPEN62541 on linux the same way as 5.11.3, but qmake did not detect OPEN6254.

    1. When building for Qt 5.12, it is important not to forget the step “git checkout 644761ff” when building open62541.
      After this commit, the install path for the open62541 header file is changed and the config test fails to detect the open62541 library.

  23. I am trying to build qtopcua using the new build scheme with open62541 as 3rd party source. I am trying to include mbedtls, to take a swipe at authentication/encryption.

    All goes well until the link step, when it complains about not finding members of the mbedtls libraries. (first one is mbedtls_md_info_from_type) Can you give me a hint as to how to link them in the qtopcua build system? The open62541 instructions no longer seem to apply.

    1. You could try adding the following line in src/3rdparty/open62541.pri: LIBS += -lmbedtls -lmbedx509 -lmbedcrypto

      An API for secure connections has been added on the Qt OPC UA dev branch which is going to become Qt 5.13 soon. The open62541 plugin does not support that API yet because we are tied to open62541 v0.3.0 which does not offer client side secure connection capabilities. The uacpp plugin code already has an implementation for this and can be used as an example for how to implement the secure connection API.

      1. I am thinking that I have not built the mbedtls libraries appropriately. (using qtcreator) cmake appears to find the libraries, but can’t resolve their members. DUMPBIN shows the members with a preceding underscore, which shouldn’t be an issue.

        I will explore compiling mbedtls again. The instructions (I am working on windows 7 with vs2017) fail to generate mbedcrypto and mbedx509, and I had to create the project files manually.

        I am using open62541 [master] and qtopcua [5.13]. qtopcua compiles (except for the link phase) with a change only to qopen62541subscription.cpp to work around deprecated code that has been removed in open62541 [master].

        Since the bleeding edge version of open62541 appears to support client side encryption/authentication (there is example code in the tree) I thought I would try to put a qt wrapper around it and and see if it works. We require authentication and encryption.

    2. In addition to what Jannis said. We might not be able to get open62541 client security into Qt OPC UA proper (aka. a released version) before open62541 has settled down into an 0.4 branch (or a release candidate at least), but we see the need for having this feature. One way could be to have a “known to work” patch in gerrit (open62541 users need to build from source anyways). We are happy to collaborate on that.

  24. I still haven’t given up on adding security to qtopcua; I got sidetracked just after I figured out how to set up a security infrastructure and compiled against mbedtls. Still gonna do it.
    I am stuck trying to deploy an app. Plain vanilla Qt opcua, built in qt creator. It simply accesses the library, gets a list of endpoints, then creates a new QOpcUaProvider, and attempts to load a backend, connect a server, then update the server periodically from a Reflective memory network.
    It works perfectly in qcreator, either run or debug, but as a standalone (accompanied by dependencies provided by windeployqt.exe) the provider does not report any backends. (verified with printf) I put a delay (x1000 sqrt(f) so it doesn’t kill the thread) in, but doesn’t appear to be a timing issue. Is there or are there some dependency(ies) that windeployqt.exe might be missing that qtcreator provides in it’s configuration? Could it be a visual studio issue? ( it seems to work on a VS2017 system if I build it there, but not when compiled against VS2015) Unfortunately my target platform is 2015, and cannot have a qt install or 2017.

    The dev machine has qtopcua built with VS2015

    I have a couple of servers built the same way (based loosely on the waterpump example) that stand up and run just fine.
    Any suggestions you can provide would be most appreciated.

    1. I guess windeployqt doesn’t copy the plugins (the open62541-backend is a plugin). Please check the target folder of the deployment if you find the backend there.

      btw. Christmas comes early this year: https://codereview.qt-project.org/#/c/256710/
      This patch is a “fork” which implements the security API with open62541 based on their master. We currently can’t merge it as we need a proper release of open62541, but its still something you can already check out and test. We are looking forward to your feedback.

  25. Sorry for the delay getting back to you. After reading the docs at
    https://github.com/probonopd/linuxdeployqt a light bulb went off, and I manually included the plugin into the windeployqt bundle and things work as they should.
    I guess now I should figure out how to apply a patch so I can check out the security preview, but right now I am having an issue porting an app from windows to linux (centos). Discovery works OK, but my client connect times out.

  26. Hello,

    I have troubles when building the sources on Windows with MinGW32.
    I installed Qt 5.13.0, Perl 5.3.1 and MinGW32 7.3.

    When building sources with mingw32-make, I get an Invalid argument error. With details : [Makefile:45: sub-opcua-make_first] Error 126.

    It may be related to an installation issue but I can’t see which one in particular.

    Thank you for your help.

    1. Hello,

      is this the entire output, or is there more that could indicate what went wrong?
      Are you able to call perl from the shell you are using to build Qt OPC UA without specifying the full path to the executable?

Leave a Reply to Constantin Belyaev Cancel reply

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