cmake does not find QtQuick even if it's installed - c++

I installed Qt 6.2.0 with the online installer and selected most of the module for Desktop development.
I get this strange message:
/home/user/Qt/Examples/Qt-6.2.0/multimedia/video/mediaplayer/CMakeLists.txt:28: error: 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 "Quick". Expected Config file at "/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake" exists
English is not my primary language, and I'm not sure what the last sentence really means:
"Expected Config file at <path> exists"
Actually the file exists:
$ ls /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
I don't understand why it don't find QtQuick and then I don't know how to fix it...

Failed to find Qt component "Quick".
see the file lib/cmake/Qt6Quick/Qt6QuickTargets.cmake
the variable _IMPORT_PREFIX tells cmake
where to find the include/ and lib/ files for QtQuick
usually its the parent-parent-parent folder of the cmake file
so /home/user/Qt/6.2.0/gcc_64 in your case
for debugging, add this to Qt6QuickTargets.cmake
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# ...
message("debug: _IMPORT_PREFIX = ${_IMPORT_PREFIX}")
the file libQt6Quick.so should be in the _IMPORT_PREFIX path
otherwise find it by
cd /home/user/Qt/6.2.0/gcc_64
find . -name 'libQt6Quick.so*'
related:
the environment variable QT_ADDITIONAL_PACKAGES_PREFIX_PATH
helps qt to find the lib/cmake/Qt6(modulename)/Qt6(modulename)Targets.cmake files

Related

cannot use Qt Xlsx

I have Qt 5.15 Beta-2 in /opt. I've also downloaded from here and built the Qt5::Xlsx module [qmake, sudo make, sudo make install]. Now in /opt/Qt/5.15.0/gcc_64/include there's a directory QtXlsx but it contains only one file QtXlsxDepends. No xlsxdocument.h, xlsxcell.h or anything like that, so Qt Creator says file not found if I try to include them as in here.
the output of the build commands
The sought-for headers are in /opt/Qt/5.15.0/gcc_64/mkspecs/features/include/QtXlsx. So I added target_include_directories(target PRIVATE /opt/Qt/5.15.0/gcc_64/mkspecs/features/include/QtXlsx) to my CMakeLists.txt and the problem went away.

pugixml include dir set to not found from pugixml config cmake files

I am trying to compile this project: https://github.com/computationalpathologygroup/ASAP.git from source.
Pugixml is a dependency
I have built pugixml from source and set PugiXML_DIR and PUGIXML_INCLUDE_DIR And it still gives me error: "CMake Error: The following variables are used in this project, but they are set to NOTFOUND."
Things I have tried:
I am doing this on windows, using cmake 3.14 and visual studio 2017.
I have successfully built pugixml from source and included the .lib file as well
I have tried including and excluding combinations of PUGIXML_INCLUDE_DIR, PUGIXML_LIBRARY, PugiXML_DIR.
This is the error I get:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
cpp/ASAP/annotation/PUGIXML_INCLUDE_DIR
used as include directory in directory
/cpp/ASAP/annotation
cpp/ASAP/multiresolutionimageinterface/PUGIXML_INCLUDE_DIR
used as include directory in directory cpp/ASAP/multiresolutionimageinterface
Other information: setting PugiXML_DIR is mandatory, and the cmake looks for a file named "pugixml-config.cmake" in that directory. And the config cmake file is supposed to point to compiled lib file. But when it wasn't able to find, I simply copied the lib file I compiled to the location pugixml-config.cmake was pointing.
In ASAP versions before 4.04.2019 they play dirty games with extracting include directory from the IMPORTED target. annotation/CMakeLists.txt:30:
get_target_property(PUGIXML_INCLUDE_DIR pugixml INTERFACE_INCLUDE_DIRECTORIES)
In some cases this results in setting PUGIXML_INCLUDE_DIR variable to "-NOTFOUND", thus you got corresponded error message from CMake.
In commit 36d8bd75 they add FindPugiXML.cmake script, which handle find_package(PugiXML) call instead of configuration script shipped with PugiXML. In that find script they obtain include directory with find_path, which looks more natually:
find_path(PugiXML_INCLUDE_DIR pugixml.hpp)
Because in newer ASAP versions the configuration script (pugixml-config.cmake), shipped with PugiXML, is no longer used, one cannot hint about PugiXML location with PugiXML_DIR or PugiXML_ROOT. In case PugiXML is installed into non-system-default location, one may simply set PugiXML_INCLUDE_DIR variable to the PugiXML include directory.

Private Headers issue compiling QtWebKit 5.212 against Qt 5.10.1

On Windows 10, Visual Studio 2015, I'm building QtWebKit (5.212) against Qt 5.10.1, and I'm running into an error during the configuration part of the build.
Here is the command line I use:
perl Tools\Scripts\build-webkit --qt --release --only-webkit --no-ninja --cmakeargs="-Thost=x64 -DCMAKE_GENERATOR_PLATFORM=x64" -G \"Visual Studio 14 2015 Win64\" --prefix=E:\Qt-5.10.1\QtWebKitBin -v
Here is the error:
-- Performing Test Qt5Gui_PRIVATE_HEADER_FOUND
-- Performing Test Qt5Gui_PRIVATE_HEADER_FOUND - Failed
CMake Error at Source/cmake/OptionsQt.cmake:75 (message):
Header private/qhexstring_p.h is not found. Please make sure that:
1. Private headers of Qt5Gui are installed
2. Qt5Gui_PRIVATE_INCLUDE_DIRS is correctly defined in Qt5GuiConfig.cmake
Call Stack (most recent call first):
Source/cmake/OptionsQt.cmake:612 (CHECK_QT5_PRIVATE_INCLUDE_DIRS)
Source/cmake/WebKitCommon.cmake:50 (include)
CMakeLists.txt:139 (include)
-- Configuring incomplete, errors occurred!
The private header that it's using to do the test does exist in the Qt5 include directory, as one would expect, in this location:
E:\Qt-5.10.1\QtBin\include\QtGui\5.10.1\QtGui\private\qhexstring_p.h
The Qt5GuiConfig.cmake file exists only in the E:\Qt-5.10.1\QtBin\lib\cmake\Qt5Gui directory of the Qt installation (not in the QtWebKit source installation). I don't know if it's making use of this in any way.
What do I need to do to make the build find this directory as desired? Adding 'include\QtGui\5.10.1\QtGui\' to the INCLUDE env var doesn't work, but I don't believe that's the correct solution anyway.
Here are the parts of my environment related to the Qt directories:
INCLUDE = ...;E:\Qt-5.10.1\QtBin\include;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\include
LIB = ...;E:\Qt-5.10.1\QtBin\lib;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\lib
PATH = E:\Qt-5.10.1\qt-everywhere-src-5.10.1\qtbase\bin;E:\Qt-5.10.1\qt-everywhere-src-5.10.1\gnuwin32\bin;E:\Qt-5.10.1\QtBin\bin;...
QtBin is the directory with my compiled Qt 5.10.1.
qt-everywhere-src-5.10.1 is the Qt 5.10.1 source package
Thanks in advance for any help. I couldn't find any answers searching Google or StackOverflow.
According to the wiki, you should try to define CMAKE_PREFIX_PATH to point to your Qt installation
For example :
perl Tools\Scripts\build-webkit --qt --release --only-webkit --no-ninja --cmakeargs="-Thost=x64 -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_PREFIX_PATH=c:\Qt\Qt5.6.0\5.6\msvc2015" -G \"Visual Studio 14 2015 Win64\" --prefix=E:\Qt-5.10.1\QtWebKitBin -v
Build on Windows using build-webkit fails because it was unable to find the location for this header file qhexstring_p.h. How to fix this error and although is not a standard way but it works.
Located the file qhexstring_p.h in your prefix directory, or your
preferred Qt Installation SDK
Go to this file Source\cmake\OptionsQt.cmake and change this
From this CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui private/qhexstring_p.h)
to this below
CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui
C:/SDK/qt5-5.7.0-vs2015/qt5-x86-static-release/include/QtGui/5.7.0/QtGui/private/qhexstring_p.h)
The path here must match the path to your Qt installation and to the exact location the missing file is located. This ensures the test to look for the private director for the Qt installation is successful.
Then locate the file Qt5GuiConfig.cmake in your Qt installation directory and set the variable Qt5Gui_PRIVATE_INCLUDE_DIRS to the location were you private headers are found with this below.
set(Qt5Gui_PRIVATE_INCLUDE_DIRS "${_qt5Gui_install_prefix}/include/QtGui/${Qt5Gui_VERSION_STRING}/QtGui" "${_qt5Gui_install_prefix}/include/QtCore/${Qt5Gui_VERSION_STRING}/QtCore")
And note this version QtWebKit (5.212) of is known to have several
bugs, so its best you go for those stable ones.
The Save and run
perl Tools\Scripts\build-webkit --qt --release --only-webkit --no-ninja --cmakeargs="-Thost=x64 -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_PREFIX_PATH=c:\Qt\Qt5.6.0\5.6\msvc2015" -G \"Visual Studio 14 2015 Win64\" --prefix=E:\Qt-5.10.1\QtWebKitBin -v
As you wanted, that should be able to run as expected.

Package Qt5GStreamerQuick-1.0 not found

Did anybody got the luck to know the reason for:
"Project ERROR: Package Qt5GStreamerQuick-1.0 not found".
I have installed: qt-gstreamer-dev package
Not working even after manually adding PKG_CONFIG_LIBDIR:
export PKG_CONFIG_LIBDIR=/home/manojsahu/qt-gstreamer-1.2.0/src/QGst/QtGStreamer-1.0.pc.in
I have also added PKGCONFIG alternatively in .pro file like:
PKGCONFIG += Qt5GStreamerQuick-1.0
PKGCONFIG += QtGStreamer-1.0
Can anybody help to resolve this error.
I am trying to compile example in below mentioned link:
https://github.com/detrout/qt-gstreamer/tree/master/examples/qmlplayer
Thanks, I have got one work around to solve "Project ERROR: Package Qt5GStreamerQuick-1.0 not found".
"Qt5GStreamerQuick-1.0" has dependency with "gstreamer-1".
Download "gstreamer-1.6.3" and perform
make then
make install.
Download the qt-gstreamer code, extract freshly and navigate to extracted folder. In my case it is
cd ~/home/manojsahu/qt-gstreamer-1.2.0/
cmake CMakeLists.txt then
make then
sudo make install
Image of the qmlplayer built
Now the example qmlplayer gets built.
But facing error "Failed to create qtvideosink. Make sure it is installed correctly".
Perhaps It did not installed properly. Any workaround to build completely would be appreciated highly.

CMake FIND_PACKAGE succeeds but returns wrong path

I'm trying to have CMake 2.8.6 link to boost::program_options using the following code in my CMakeLists.txt
FIND_PACKAGE(Boost COMPONENTS program_options REQUIRED)
INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR})
ADD_EXECUTABLE (segment segment.cpp)
TARGET_LINK_LIBRARIES (segment ${Boost_LIBRARIES})
The find command seems to succeed but passes the wrong directory to the linker. The package is actually in:
`/usr/lib64/libboost_program_options-mt.so.5`
but CMakeFiles/segment.dir/link.txt lists the following:
/cm/shared/apps/gcc/4.4.6/bin/c++ CMakeFiles/segment.dir/segment.cpp.o -o segment -rdynamic /usr/lib64/lib64/libboost_program_options-mt.so.5 -lpthread -lrt -Wl,-rpath,/usr/lib64/lib64
Note the extra lib64 in the path. Also, the -l flag in front of the path seems to be missing.
When running CMake it reports that it correctly finds the package, and the {$Boost_LIBRARIES} variable seems to list the correct libs:
Boost found.
Found Boost components:
program_options
${Boost_LIBRARIES} - optimized;boost_program_options-mt-shared;debug;boost_program_options-mt-shared-debug
The generated CMakeCache.txt file starts with:
//The directory containing a CMake configuration file for Boost.
Boost_DIR:PATH=/usr/lib64/boost
//Boost include directory
Boost_INCLUDE_DIR:FILEPATH=/usr/include
Which seems to be correct. But when running make it uses the path in link.txt above and I get the error:
make[2]: *** No rule to make target `/usr/lib64/lib64/libboost_program_options-mt.so.5', needed by `segment'. Stop.
make[1]: *** [CMakeFiles/segment.dir/all] Error 2
make: *** [all] Error 2
What might cause this extra injection of a subdir into the path? What might cause link.txt to be generated in this way? And how do I fix it (or work around it)?
This problem occurs when using some older versions of boost with cmake-2.8.6-rc2 or later, where the boost package finding code was changed.
The problem can be worked around by specifying -DBoost_NO_BOOST_CMAKE=ON on the cmake command line.
The actual commit where this problem is introduced is 7da796d1fdd7cca07df733d010cd343f6f8787a9, and can be viewed here.
The problem is with the boost-devel distributed file: /usr/lib64/boost/Boost-relwithdebinfo.cmake
The cmake-2.6 package does not use this file at all, because the FindBoost.cmake file returns (correct) full-paths to boost libraries. The cmake28-2.8.8 FindBoost.cmake file returns library strings like "boost_date_time-mt-shared", which are targets defined in /usr/lib64/boost/Boost-relwithdebinfo.cmake.
At the very top of /usr/lib64/boost/Boost-relwithdebinfo.cmake, a variable named _IMPORT_PREFIX is defined from the location of the cmake file itself, and then used like so:
#----------------------------------------------------------------
# Generated CMake target import file for configuration "RelWithDebInfo".
#----------------------------------------------------------------
# Commands may need to know the format version.
SET(CMAKE_IMPORT_FILE_VERSION 1)
# Compute the installation prefix relative to this file.
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# Import target "boost_date_time-static" for configuration "RelWithDebInfo"
SET_PROPERTY(TARGET boost_date_time-static APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
SET_TARGET_PROPERTIES(boost_date_time-static PROPERTIES
IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib64/libboost_date_time.a"
)
This sets _IMPORT_PREFIX to "/usr/lib64", which is concatenated with another string that has /lib64/ in it as well. I found that if I simply change the file to include a 3rd GET_FILENAME_COMPONENT call, it works fine. Like so:
#----------------------------------------------------------------
# Generated CMake target import file for configuration "RelWithDebInfo".
#----------------------------------------------------------------
# Commands may need to know the format version.
SET(CMAKE_IMPORT_FILE_VERSION 1)
# Compute the installation prefix relative to this file.
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# Import target "boost_date_time-static" for configuration "RelWithDebInfo"
SET_PROPERTY(TARGET boost_date_time-static APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
SET_TARGET_PROPERTIES(boost_date_time-static PROPERTIES
IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib64/libboost_date_time.a"
)
This seems to be an issue with CMake 2.8.6 on CentOS. When doing the same with 2.6.4 or 2.8.3 it works correctly. Also with 2.8.7 on OS X it also works correctly.
I also see the problem on the pre-compiled cmake version 2.8.8 using CentOS 64-bit 6.2
I noticed this issue on cmake version 2.8.11.2 with boost-1.41.0-18.el6.x86_64
The approved answer does not seem satisfactory because appending this define to the cmake runtime I get:
CMake Warning:
Manually-specified variables were not used by the project:
Boost_NO_BOOST_CMAKE
I can't seem to comment or downvote due to not participating in stackoverflow enough. That is a chicken and egg problem!
I also can't seem to upvote the explanation by Kai Meyer. However, I think this really explains the problem.
From what I am gathering it seems that in summary, FindBoost.cmake provided by CMake seems to all of a sudden fail to find Boost, so the find code is now searching via the boost provided script for cmake, which in turn has a bug and seems to not return the correct path.
while building package from AUR following prefix helped to find Boost:
BOOST_ROOT=/usr
example:
BOOST_ROOT=/usr makepkg -si