Qt6 Android CMake project fails at start: Failed to find Qt component "Core" config file at ""
-
Are you developing on a Linux VM? After some troubleshooting I found I had to install OpenGL.
sudo apt-get install libgl1-mesa-dev
I found my problem by doing the following.
To troubleshoot this, you can do the following. Go to directory with your CMakeLists.txt for your project. Open a shell there.
Set the CMAKE_PREFIX_PATH to wherever you installed Qt (your path will be different and you are using android)
Here's what mine looked like:
export $CMAKE_PREFIX_PATH=/home/dev/Qt/6.0.0/gcc_64mkdir build
cd build
cmake ..My output is:
-- 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 - 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 OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY OPENGL_INCLUDE_DIR)
-- Could NOT find WrapOpenGL (missing: WrapOpenGL_FOUND)
CMake Warning at /usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
Found package configuration file:/home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake
but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be
NOT FOUND. Reason given by package:Qt6Gui could not be found because dependency WrapOpenGL could not be found.
Call Stack (most recent call first):
/home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickDependencies.cmake:86 (find_dependency)
/home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake:38 (include)
/home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:83 (find_package)
CMakeLists.txt:28 (find_package)CMake Warning at /home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:83 (find_package):
Found package configuration file:/home/dev/Qt/6.0.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
but it set Qt6Quick_FOUND to FALSE so package "Qt6Quick" is considered to
be NOT FOUND. Reason given by package:The following imported targets are referenced, but are missing: Qt6::Qml
Qt6::QmlModels Qt6::QmlModelsPrivate Qt6::QmlPrivateCall Stack (most recent call first):
CMakeLists.txt:28 (find_package)CMake Error at CMakeLists.txt:28 (find_package):
Found package configuration file:/home/dev/Qt/6.0.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 "Quick" config file at ""
-- Configuring incomplete, errors occurred!
See also "/home/dev/NodeDev/build/CMakeFiles/CMakeOutput.log".
See also "/home/dev/NodeDev/build/CMakeFiles/CMakeError.log". -
Are you developing on a Linux VM?
No, I am on Windows.
After it deleted my
Qt6 android kits
(as I mentioned in my Update), I reinstalled the Kits and it works now. There is no problem with finding components. I don't know what caused the error.But I also noticed other small problem like: Creating Template Android project, creates the project(
android
folder), but is not displaying it in project structure in QtCreator even that I have this line inCMakeLists.txt
:set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
and it displays error
Could not update the project file "C:\Users\user\QtProjects\qttutorials\Test\."
But its ok, this problem is not related to the posted Question.
-
I had this issue with Qt6.2.2 on Fedora 35 in a VM... I had to install the GL libraries but it seemed that mesa wasn't right. What worked for me is:
sudo dnf install libglvnd-devel
PS: Sorry for the the necropost... but this was the closest thread to my issue and the GL dev library hint was what helped me.
-
I have the issue described by jhorns above and am running Ubuntu 20.04.
I installed the 2 packages: libgl1-mesa-dev, libglvnd-devel
I still get similar OpenGL errors in the CMake phase. -
@Frostybeard-0 said in Qt6 Android CMake project fails at start: Failed to find Qt component "Core" config file at "":
I still get similar OpenGL errors in the CMake phase
Can you post those?
-
Think is late but I had the same error with Ubuntu 22.04 and Clion, so to fix this i installed libgl1-mesa-dev and libglvnd-dev libraries, then Clion will ask for 'Qt CMake prefix path', and you need to choose the directory where the files are stored, in my case was:
/y/y/y/Qt/6.3.1/gcc_64/lib/cmakeNow, it works. Hope it helps.