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

using opc ua in qt



  • Hello,

    I want to use opc ua in qt.
    Therefore I have to install the open62541, if I understood correctly.
    I have seen this page but I do not know how to install the package as described in this description.

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

    Does qt have its own shell for installing this package?
    How should I install it exactly?

    Sorry, if this are stupid questions, but I do not know what to do exactly.

    Thanks for your help.

    Greetings

    Mogli


  • Lifetime Qt Champion

    @Mogli123 The description is quite clear. What exactly is the problem?
    "Does qt have its own shell for installing this package?" - "make install" after building will do it.
    And what is your OS?



  • I work on windows.
    I do not know where to insert the comments.

    1 Git clone https://github.com/open62541/open62541.git
    2 cd open62541
    3 git checkout 644761ff
    4 mkdir build
    ...

    In cmd of windows or in a shell of qt if it exists?



  • You need to install git/tortoise git (for use git and clone the projects open62541 / qtopcua)

    when installing git, there may be an option 'add to environment variable' check this option to automatically configure your PATH.

    when it is installed open your normal windows terminal and write :

    git
    

    if it is recognizing you are good to go, if not, you need to config you PATH

    ... same thing for qmake/make / cmake

    what compiler do you use ?

    Note :qtopcua 5.11.0 works perfectly, but i could not build qtopcua 5.12 for the moment, https://forum.qt.io/topic/97476/build-qtopcua-5-12-windows/2



  • Thank you very much
    I will try it.
    I answer if it works for me or not.

    Mh ok thanks for the hint, I would like to build Qtopcua on Qt 5.12, too.



  • @Mogli123 i clarify :

    i use Qt 5.12 and i build :

    QtOpcUa 5.11 : success
    QtOpcUa 5.12 : fail



  • When I try to run:

    cmake -DCMAKE_BUILD_TYPE = Share -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION = ON -DCMAKE_INSTALL_PREFIX = c: \ Qt_5_12_MinGW \ open62541\build ..

    I get the following error:
    CMake error: The source directory "c: Qt_5_12_MinGW / open62541 / build" is not against containing CMakeLists.txt.

    I run this code in the build folder like in the discripiton.
    I have installed MinGW64
    is this a problem?

    What am I doing wrong?



  • @Mogli123 hi, try to add .. at the end of your command



  • @LeLev
    hi,
    I have the 2 dots allready in my code like in my post above

    When I run:

    cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_INSTALL_PREFIX=c:\path\to\open62541-mingw-install ..

    I get this error:

    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles" CMake_Make_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles" CMake_Make_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

    I have no experience to work with the shell therefore I have no idea what I can do to solve the error.





  • @LeLev
    thank you :)
    adding links to the system path solved the problem

    but now I have a building problem with

    mingw32-make

    error:

    cc1.exe: error: unrecognized command line option "-Wpedantic"
    cc1.exe: warnings being treated as errors
    cc1.exe: error:unrecognized command line option "-Wno-static-in-inline"
    ...

    if one error is solved the next one will follow:(



  • @Mogli123
    Can you please check your mingw version ? with mingw32-make -ver

    i used mingw that comes with qt, adding this to system path

    C:\Qt\5.12.0\mingw73_64\bin



  • @LeLev
    Thank you very much for taking the time to help me

    I'm using mingw from qt, too.

    my mingw version is:
    GNU Make 4.2.1
    Cuilt for x86_64-w64-mingw32
    Copyright....

    I add the same as you to the system path



  • @Mogli123 when you call cmake .. see if your output is ~similar to mine
    maybe you need to update gcc

    cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
    -- The C compiler identification is GNU 5.1.0
    -- The CXX compiler identification is GNU 5.1.0
    -- Check for working C compiler: C:/TDM-GCC-64/bin/gcc.exe
    -- Check for working C compiler: C:/TDM-GCC-64/bin/gcc.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/TDM-GCC-64/bin/g++.exe
    -- Check for working CXX compiler: C:/TDM-GCC-64/bin/g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: C:/Users/lev/AppData/Local/Programs/Python/Python36-32/python.exe (found version "3.6.5")
    -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.16.2.windows.1")
    -- Could NOT find Sphinx (missing: SPHINX_EXECUTABLE)
    -- Could NOT find LATEX (missing: LATEX_COMPILER)
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/lev/Documents/LIB/open62541/build
    


  • @LeLev

    I delet the fils in the build folder

    try cmake again and all works fine

    I don't know why....

    THANK you very much for your helping

    that is now qopcua 5.12?
    Should I load the 5.11 version, because you noticed that the 5.12 does not work for you?



  • @Mogli123 right click on your cloned qtopcua folder> TortoiseGit > Show log to see the version.

    Please try to build the qtopcua 5.12 and tell me if it works for you.

    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
    mingw32-make
    mingw32-make install
    


  • @LeLev

    It seems that I have the 5.11 version
    0_1545216990793_Unbenannt_2.PNG

    I runed the code like in the discripiton

    0_1545217141684_Unbenannt_3.PNG

    I see no error but howe can I test if it works?
    sorry if this is a stupid question



  • @Mogli123 said in using opc ua in qt:

    howe can I test if it works?

    create a project, a class, include <QtOpcUa> , create QScopedPointer<QOpcUaClient> m_client; , compile


Log in to reply