Unsolved Build Qt cmake project without Qt Creator
-
I'm trying to build "Lights example" from windows console.
I'm using these 2 command lines:
"S:/Qt601/Tools/CMake_64/bin/cmake.exe" -S S:/Qt601/Examples/Qt-6.0.1/quick3d/lights -B S:/Qt601/Examples/Qt-6.0.1/quick3d/build-lights-Desktop_Qt_6_0_1_MinGW_64_bit-Debug -GNinja "-DCMAKE_BUILD_TYPE:String=Debug" "-DQT_QMAKE_EXECUTABLE:STRING=S:/Qt601/6.0.1/mingw81_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:STRING=S:/Qt601/6.0.1/mingw81_64" "-DCMAKE_C_COMPILER:STRING=S:/Qt601/Tools/mingw810_64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:STRING=S:/Qt601/Tools/mingw810_64/bin/g++.exe" "S:/Qt601/Tools/CMake_64/bin/cmake.exe" --build . --target all
The first line I copied from Qt Creator and while in the creator there are no errors, when I execute this line manually from console I get this error:
-- The CXX compiler identification is unknown -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: S:/Qt601/Tools/mingw810_64/bin/g++.exe -- Check for working CXX compiler: S:/Qt601/Tools/mingw810_64/bin/g++.exe - broken CMake Error at S:/Qt601/Tools/CMake_64/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message): The C++ compiler "S:/Qt601/Tools/mingw810_64/bin/g++.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: S:/Qt601/Examples/Qt-6.0.1/quick3d/build-lights-Desktop_Qt_6_0_1_MinGW_64_bit-Debug/CMakeFiles/CMakeTmp Run Build Command(s):S:/Qt601/Tools/Ninja/ninja.exe cmTC_bca0c && [1/2] Building CXX object CMakeFiles\cmTC_bca0c.dir\testCXXCompiler.cxx.obj FAILED: CMakeFiles/cmTC_bca0c.dir/testCXXCompiler.cxx.obj S:\Qt601\Tools\mingw810_64\bin\g++.exe -o CMakeFiles\cmTC_bca0c.dir\testCXXCompiler.cxx.obj -c testCXXCompiler.cxx ninja: build stopped: subcommand failed. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:4 (project) -- Configuring incomplete, errors occurred! See also "S:/Qt601/Examples/Qt-6.0.1/quick3d/build-lights-Desktop_Qt_6_0_1_MinGW_64_bit-Debug/CMakeFiles/CMakeOutput.log". See also "S:/Qt601/Examples/Qt-6.0.1/quick3d/build-lights-Desktop_Qt_6_0_1_MinGW_64_bit-Debug/CMakeFiles/CMakeError.log".
CMakeOutput.log is empty and here is CMakeError.log https://drive.google.com/file/d/1UFahipkoZa-J_3KmjNy1ECVKf4uzQS4K/view?usp=sharing
Also If I run the second line after the first one is executed in Qt Creator I get this error:
Error: could not load cache
I execute both commands from project directory.
What am I doing wrong? Google gives no information that could help. -
@Dmitry87 said in Build Qt cmake project without Qt Creator:
S:/Qt601/Tools/mingw810_64/bin/g++.exe
What happens when you try to just build a trivial test .cpp file with that compiler without using CMake?
-
@wrosecrans It shows a message box with "The program can't start because libwinpthread-1.dll is missing"
-
@Dmitry87 you need to properly set up the environment.
First you could open a Terminal from Creator with Build Environment (right click a file in your Projects side bar e.g.).
Regards
-
@aha_1980
Is there an instruction? I'm not sure if I understend your recomendation. If I can build the project from Qt Creator, why the environment setup is incorrect?
Isn't it a problem in the command line which I use to build the project from windows cmd?
I tried to build the project from the terminal, opened from creator, but still get these errors. -
I tried to build the project from the terminal, opened from creator, but still get these errors.
And you did open a terminal with build environment?
How does the path inside this terminal look like?
Regards
-
@aha_1980
Pardon, apparently I did something wrong, the first error has gone. Now it shows this message for the first line:-- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Found Vulkan: S:/VulkanSDK/1.2.154.1/Lib/vulkan-1.lib -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) -- Could NOT find WrapOpenSSLHeaders (missing: WrapOpenSSLHeaders_FOUND) -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: QT_QMAKE_EXECUTABLE -- Build files have been written to: S:/Qt601/Examples/Qt-6.0.1/quick3d/build-lights-Desktop_Qt_6_0_1_MinGW_64_bit-Debug
That seems to be OK.
For the second line I still get this error:Error: could not load cache
The path in terminal is: "S:\Qt601\Examples\Qt-6.0.1\quick3d\lights"
-
@Dmitry87 I meant the PATH environment variable. You need to set it if you want to build outside Creator, which automatically does it for you.
-
PATH=S:\Qt601\Tools\mingw810_64\bin;C:\Windows;S:\Qt601\Tools\Ninja;C:\MinGW\bin;C:\Windows\SysWOW64\WindowsPowerShell\v1.0