Solved Cannot compile QtOpcUa
-
I've just discovered they don't provide QtOpcUa from the Qt online installer.
So I'm trying to build it by myself against Qt 6.2.0.
The instructions I found are outdated so I'm guessing how to compile:git clone https://code.qt.io/qt/qtopcua.git cd qtopcua git checkout 6.2.0 mkdir build && cd build export Qt6_DIR=~/Qt/6.2.0/gcc_64/lib/cmake/Qt6/ ~/Qt/Tools/CMake/bin/cmake ..
But it reports a lot of errors:
CMake Warning: No source or binary directory provided. Both will be assumed to be the same as the current working directory, but note that this warning will become a fatal error in future CMake releases. -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Could NOT find Qt6CoreTools (missing: Qt6CoreTools_DIR) CMake Warning at /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package): Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be NOT FOUND. Call Stack (most recent call first): CMakeLists.txt:20 (find_package) -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f") -- Found WrapOpenSSLHeaders: /usr/include (found version "1.1.1f") -- Could NOT find Qt6CoreTools (missing: Qt6CoreTools_DIR) CMake Warning at /home/user/Qt/Tools/CMake/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be NOT FOUND. Call Stack (most recent call first): /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency) /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Network/Qt6NetworkDependencies.cmake:91 (_qt_internal_find_dependencies) /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Network/Qt6NetworkConfig.cmake:40 (include) /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package) CMakeLists.txt:20 (find_package) CMake Warning at /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package): Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Network/Qt6NetworkConfig.cmake but it set Qt6Network_FOUND to FALSE so package "Qt6Network" is considered to be NOT FOUND. Reason given by package: Qt6Network could not be found because dependency Qt6Core could not be found. Call Stack (most recent call first): CMakeLists.txt:20 (find_package) CMake Error at CMakeLists.txt:20 (find_package): Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find Qt component "Core". Expected Config file at "/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake" exists Failed to find Qt component "Network". Expected Config file at "/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Network/Qt6NetworkConfig.cmake" exists
by the way I don't understand a message like the last ones:
"Failed to find <something>. Expected file at <path> exists."
so if it exists why it cannot find it?
Any hint to build this module? -
@Mark81 said in Cannot compile QtOpcUa:
The instructions I found are outdated so I'm guessing how to compile:
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 6.2.0
mkdir build && cd build
export Qt6_DIR=~/Qt/6.2.0/gcc_64/lib/cmake/Qt6/
~/Qt/Tools/CMake/bin/cmake ..this is correct until the last 2 lines. Instead simply call:
/path/to/Qt/6.2.0/bin/qt-configure-module .. cmake --build . --parallel cmake --install .
also read
https://www.qt.io/blog/qt-6-build-system -
This post is deleted! -
@raven-worx thanks, I was able to compile! Out of curiosity, is there a script for Linux to export all the relevant environment variables like in Windows (the "Qt Console") ? I spent a couple of hours to figure out why it cannot find the tools (CMake and Ninja). Then I had to export their paths and finally it compiled.