kblaschke / qt6vcpkgissue

Demo repository to show/test an issue with the qt6base port in vcpkg
0 stars 0 forks source link

Linux build #1

Open greenozon opened 2 months ago

greenozon commented 2 months ago

Hi! what is the correct way to install qt6 under Linux so that this test sample proj will find it?

Ubuntu 22.04:

$ cmake .
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:

    Qt6Config.cmake
    qt6-config.cmake

  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!
kblaschke commented 2 months ago

This project demonstrates the issue https://github.com/microsoft/vcpkg/issues/39832 (from where you came here, obviously) with the qtbase port in vcpkg, and thus it's meant to be run only in vcpkg's manifest mode.

This can be done by passing the vcpkg toolchain file to CMake like this, from the project's root dir:

mkdir build
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
greenozon commented 2 months ago

thanks a lot! it builds lots of stuff, almost 10 minutes....

kblaschke commented 2 months ago

Yes, The base Qt package is huge already. Building all the Qt components easily takes 1.5hrs. vcpkg also builds it in Release and Debug variants, so it's being built twice. Luckily, vcpkg caches it locally, and as long as your vcpkg repo or toolchain don't change, you only need to build it once.

The actual issue happens right after vcpkg is done, when CMake tries to find/use the Qt6 package.

greenozon commented 2 months ago

well, after initial cmake command above I was able to compile/link/run the test app what issue do you hit in your case?

kblaschke commented 1 month ago

It's documented in my vcpkg bug report linked above. Might possibly be fixed now, didn't try again for a few weeks since I've opened the report. Helped myself with a local overlay port that replaces the problematic path.