Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtOpcUa client error after updating Qt from 5.11 to 5.12 [opensource]



  • When i update my QtQuick app from 5.11 to 5.12, and rebuild QtOpcUa and Open62541 like described here :

    https://blog.basyskom.com/building-qt-opc-ua-with-open62541/

    My opcua client can not connect to the server anymore,

    it hits this condition :

    void MachineBackend::connectToServer(const QString &url, qint32 index){
     if (index < 0 || index >= m_backends.size()){
                  return; // Invalid index
        }
    ..
    

    So it looks like i have a probleme with my open62541 build ? Can someone tell me how to solve this please?

    Build open62541

    //git clone https://github.com/open62541/open62541.git
    //cd open62541
    //git checkout 0.3 
    //mkdir build
    //cd build
    cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
    mingw32-make
    

    Build Qt OPC UA

    //cd qtopcua
    //mkdir build
    //cd build
    set QTOPCUA_OPEN62541_INCLUDE_PATH=c:\path\to\open62541\build
    set QTOPCUA_OPEN62541_LIB_PATH=c:\path\to\open62541\build\bin
    qmake ..
    mingw32-make
    mingw32-make install
    

    I have not updated open62541 and QtOpcUa, but keeped versions i had 7 months ago..
    Thank you



  • I also found this Qt doc
    https://doc-snapshots.qt.io/qtopcua/qtopcua-build-open62541.html

    i cant understand this part, what i have to do, can someone tell me please ?

    When building at the top level, you have to specify the path to the Open62541 SDK:
    configure OPEN62541_PREFIX=/path/to/sdk
    If you are not building at the top level, this setting has to be given to qmake:
    qmake </path/to/qtopcua> -- OPEN62541_PREFIX=/path/to/sdk

    what means building at the top level ?

    Im cloning open62541 and QtOpcUa in a completly different folder from my project. like :
    c:\qtProject\myproject
    and libs
    c:\libs\open62541
    c:\libs\QtOpcUA

    I tryed to build like this :

    qmake OPEN62541_INCDIR=c:\users\lev\documents\lib\open62541\build OPEN62541_LIBDIR=c:\users\lev\documents\lib\open62541\buil\bin ..
    

    and output is :

    Open62541......................................no
    


  • this is the confg.log file generated in the build dir

    Command line: 
    looking for library freeopcua
    Trying source 0 (type pkgConfig) of library freeopcua ...
      => source failed condition '!config.win32'.
    Trying source 1 (type inline) of library freeopcua ...
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\freeopcua && C:\Qt\5.12.0\mingw73_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += freeopcua" "QMAKE_LIBS_FREEOPCUA = -lopcuacore -lopcuaclient -lopcuaprotocol -lopcuaserver -lWininet" C:/Users/lev/Documents/LIB/qtopcua/config.tests/freeopcua
    > Info: creating stash file C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\.qmake.stash
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\freeopcua && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -O2 -fexceptions -mthreads -w -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -IC:\Users\lev\Documents\LIB\qtopcua\config.tests\freeopcua -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.12.0\mingw73_64\mkspecs\win32-g++  -o main.o C:\Users\lev\Documents\LIB\qtopcua\config.tests\freeopcua\main.cpp
    > C:\Users\lev\Documents\LIB\qtopcua\config.tests\freeopcua\main.cpp:37:10: fatal error: opc/ua/node.h: No such file or directory
    >  #include <opc/ua/node.h>
    >           ^~~~~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:449: main.o] Error 1
     => source failed verification.
    test config.qtopcua_opcua.libraries.freeopcua FAILED
    looking for library open62541
    Trying source 0 (type open62541) of library open62541 ...
      => source failed condition '!config.win32'.
    Trying source 1 (type open62541) of library open62541 ...
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\open62541 && C:\Qt\5.12.0\mingw73_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += open62541" "QMAKE_LIBS_OPEN62541 = \"-lopen62541 -lws2_32\" -Lc:\\users\\lev\\documents\\lib\\open62541\\build\\bin" "QMAKE_INCDIR_OPEN62541 = c:\\users\\lev\\documents\\lib\\open62541\\build" C:/Users/lev/Documents/LIB/qtopcua/config.tests/open62541
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\open62541 && set MAKEFLAGS=& mingw32-make
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -IC:\Users\lev\Documents\LIB\qtopcua\config.tests\open62541 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-winx64\include -IC:\Utils\postgresql\pgsql\include -Ic:\users\lev\documents\lib\open62541\build -IC:\Qt\5.12.0\mingw73_64\mkspecs\win32-g++  -o main.o C:\Users\lev\Documents\LIB\qtopcua\config.tests\open62541\main.cpp
    > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o open62541.exe main.o  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-winx64\lib -LC:\Utils\postgresql\pgsql\lib -l"open62541 -lws2_32" -Lc:\users\lev\documents\lib\open62541\build\bin   
    > C:/Qt/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopen62541 -lws2_32
    > collect2.exe: error: ld returned 1 exit status
    > mingw32-make: *** [Makefile:64: open62541.exe] Error 1
     => source failed verification.
    Trying source 2 (type inline) of library open62541 ...
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\open62541 && C:\Qt\5.12.0\mingw73_64\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-winx64\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += open62541" "QMAKE_LIBS_OPEN62541 = -lopen62541 -lws2_32" C:/Users/lev/Documents/LIB/qtopcua/config.tests/open62541
    + cd /d C:\Users\lev\Documents\LIB\qtopcua\build\config.tests\open62541 && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
    > del main.o
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -IC:\Users\lev\Documents\LIB\qtopcua\config.tests\open62541 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.12.0\mingw73_64\mkspecs\win32-g++  -o main.o C:\Users\lev\Documents\LIB\qtopcua\config.tests\open62541\main.cpp
    > C:\Users\lev\Documents\LIB\qtopcua\config.tests\open62541\main.cpp:38:10: fatal error: open62541.h: No such file or directory
    >  #include "open62541.h"
    >           ^~~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:451: main.o] Error 1
     => source failed verification.
    Trying source 3 (type inline) of library open62541 ...
      => source failed condition '!config.win32'.
    Trying source 4 (type pkgConfig) of library open62541 ...
    pkg-config use disabled globally.
      => source produced no result.
    test config.qtopcua_opcua.libraries.open62541 FAILED
    looking for library uacpp
    Trying source 0 (type uacpp) of library uacpp ...
      => source failed condition 'config.win32 && var.QT_EDITION != 'OpenSource''.
    Trying source 1 (type uacpp) of library uacpp ...
      => source failed condition '!config.win32 && var.QT_EDITION != 'OpenSource''.
    test config.qtopcua_opcua.libraries.uacpp FAILED
    
    


  • Finally worked !

    
    qmake c:\users\lev\Documents\LIB\qtopcua -- OPEN62541_PREFIX=c:\users\lev\document
    s\lib\open62541 OPEN62541_INCDIR=c:\users\lev\documents\lib\open62541\build OPEN62541_LIBDIR=c:\users\lev\documents\lib\open62541\bu
    ild\bin
    
    

    Running configuration tests...
    Checking for FreeOpcua... no
    Checking for Open62541... yes
    Checking for Unified Automation C++ SDK... no
    Done running configuration tests.

    Configure summary:

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


Log in to reply