Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] qt/6.6.1: failed to build on msvc compiler in windows 11. #22511

Open
akashdiphazra opened this issue Jan 23, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@akashdiphazra
Copy link

akashdiphazra commented Jan 23, 2024

Description

I am trying to build gui qt application on windows my project structure is
image

conan.py

from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
from conan import ConanFile
import os

class Application(ConanFile):
name = "Application"

# Optional metadata
license = "BSD"
author = "Akashdip Hazra"
description = "Testing For Fun"

settings = "os", "compiler", "build_type", "arch"
exports_sources = "CMakeLists.txt", "src/*", "include/*"

def requirements(self):
    self.requires("fmt/10.2.1")
    self.requires("qt/6.6.1")

def configure(self):
    self.options["qt/*"].shared = False
    self.options["qt/*"].gui = True
    self.options["qt/*"].widgets = True
    
def layout(self):
    self.folders.generators = os.path.join("build")
    self.folders.build = "build"

def build(self):
    cmake = CMake(self)
    cmake.configure()
    cmake.build()

def generate(self):
    tc = CMakeToolchain(self) 
    kc = CMakeDeps(self)
    tc.user_presets_path = 'ConanPresets.json'
    tc.generate()
    kc.generate()

def package_info(self):
    self.cpp_info.libs = ["Application"]   

CMakeLists.txt

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set (CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(akash main.cpp
                     mainwindow.ui
                     mainwindow.cpp
                     mainwindow.h
)

target_link_libraries(akash PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)
set_target_properties(akash PROPERTIES    
    WIN32_EXECUTABLE ON
    MACOSX_BUNDLE OFF
)

Package and Environment Details

  • Package Name/Version: qt/6.6.1
  • Operating System+version: Windows 11
  • Compiler+version: msvc
  • Conan version: conan 2.0.17
  • Python version: Python 3.12.21

Conan profile

[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.version=193
os=Windows

Steps to reproduce

** just install qt/6.6.1 on windows 11 and use msvc compiler to build.

Logs

Click to expand log
[proc] Executing command: cmake --version
[proc] Executing command: cmake -E capabilities
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\Akashdip Hazra\AppData\Local\CMakeTools\cmake-tools-kits.json
[presetController] Successfully validated presets in D:\Qt\CMakePresets.json
[presetController] Successfully validated presets in D:\Qt\ConanPresets.json
[presetController] Successfully validated presets in D:\Qt\build\CMakePresets.json
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" --version
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" -E capabilities
[main] Configuring project: Qt 
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_TOOLCHAIN_FILE=D:/Qt/build/conan_toolchain.cmake -SD:/Qt -BD:/Qt/build -G "Visual Studio 17 2022" -T v143 -A x64
[cmake] -- Using Conan toolchain: D:/Qt/build/conan_toolchain.cmake
[cmake] -- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
[cmake] -- Conan toolchain: C++ Standard 20 with extensions OFF
[cmake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
[cmake] -- Conan: Component target declared 'Qt6::Core'
[cmake] -- Conan: Component target declared 'Qt6::Platform'
[cmake] -- Conan: Component target declared 'Qt6::Gui'
[cmake] -- Conan: Component target declared 'Qt6::QWindowsIntegrationPlugin'
[cmake] -- Conan: Component target declared 'Qt6::QWindowsVistaStylePlugin'
[cmake] -- Conan: Component target declared 'Qt6::QGifPlugin'
[cmake] -- Conan: Component target declared 'Qt6::QIcoPlugin'
[cmake] -- Conan: Component target declared 'Qt6::QSQLiteDriverPlugin'
[cmake] -- Conan: Component target declared 'Qt6::QPSQLDriverPlugin'
[cmake] -- Conan: Component target declared 'Qt6::Network'
[cmake] -- Conan: Component target declared 'Qt6::Sql'
[cmake] -- Conan: Component target declared 'Qt6::Test'
[cmake] -- Conan: Component target declared 'Qt6::Widgets'
[cmake] -- Conan: Component target declared 'Qt6::PrintSupport'
[cmake] -- Conan: Component target declared 'Qt6::OpenGL'
[cmake] -- Conan: Component target declared 'Qt6::OpenGLWidgets'
[cmake] -- Conan: Component target declared 'Qt6::Concurrent'
[cmake] -- Conan: Component target declared 'Qt6::Xml'
[cmake] -- Conan: Component target declared 'Qt6::EntryPointImplementation'
[cmake] -- Conan: Component target declared 'Qt6::EntryPointPrivate'
[cmake] -- Conan: Target declared 'qt::qt'
[cmake] -- Conan: Component target declared 'OpenSSL::Crypto'
[cmake] -- Conan: Component target declared 'OpenSSL::SSL'
[cmake] -- Conan: Target declared 'openssl::openssl'
[cmake] -- Conan: Target declared 'ZLIB::ZLIB'
[cmake] -- Conan: Including build module from 'C:/Conan/b/opensb111943c1d7ca/p/lib/cmake/conan-official-openssl-variables.cmake'
[cmake] -- Conan: Target declared 'double-conversion::double-conversion'
[cmake] -- Conan: Target declared 'harfbuzz::harfbuzz'
[cmake] -- Conan: Target declared 'Freetype::Freetype'
[cmake] -- Conan: Target declared 'BZip2::BZip2'
[cmake] -- Conan: Including build module from 'C:/Conan/b/bzip285068f66bc56e/p/lib/cmake/conan-official-bzip2-variables.cmake'
[cmake] -- Conan: Target declared 'PNG::PNG'
[cmake] -- Conan: Component target declared 'brotli::brotlicommon'
[cmake] -- Conan: Component target declared 'brotli::brotlidec'
[cmake] -- Conan: Component target declared 'brotli::brotlienc'
[cmake] -- Conan: Target declared 'brotli::brotli'
[cmake] -- Conan: Including build module from 'C:/Conan/b/freet9c823144d9ada/p/lib/cmake/conan-official-freetype-variables.cmake'
[cmake] -- Conan: Component target declared 'glib::glib-2.0'
[cmake] -- Conan: Component target declared 'glib::gmodule-no-export-2.0'
[cmake] -- Conan: Component target declared 'glib::gmodule-export-2.0'
[cmake] -- Conan: Component target declared 'glib::gmodule-2.0'
[cmake] -- Conan: Component target declared 'glib::gobject-2.0'
[cmake] -- Conan: Component target declared 'glib::gthread-2.0'
[cmake] -- Conan: Component target declared 'glib::gio-2.0'
[cmake] -- Conan: Component target declared 'glib::gresource'
[cmake] -- Conan: Component target declared 'glib::gio-windows-2.0'
[cmake] -- Conan: Target declared 'glib::glib'
[cmake] -- Conan: Target declared 'libffi::libffi'
[cmake] -- Conan: Component target declared 'PCRE2::8BIT'
[cmake] -- Conan: Component target declared 'PCRE2::POSIX'
[cmake] -- Conan: Component target declared 'PCRE2::16BIT'
[cmake] -- Conan: Component target declared 'PCRE2::32BIT'
[cmake] -- Conan: Target declared 'pcre2::pcre2'
[cmake] -- Conan: Target declared 'Intl::Intl'
[cmake] -- Conan: Target declared 'Iconv::Iconv'
[cmake] -- Conan: Component target declared 'SQLite::SQLite3'
[cmake] -- Conan: Component target declared 'libpq::pgport'
[cmake] -- Conan: Component target declared 'libpq::pgcommon'
[cmake] -- Conan: Component target declared 'libpq::pq'
[cmake] -- Conan: Target declared 'PostgreSQL::PostgreSQL'
[cmake] -- Conan: Component target declared 'md4c::md4c'
[cmake] -- Conan: Component target declared 'md4c::md4c-html'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Core/conan_qt_executables_variables.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Core/conan_qt_qt6_coreprivate.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Core/conan_qt_entry_point.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/Qt6ConfigExtras.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicAppleHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicCMakeHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicCMakeVersionHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicFinalizerHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicFindPackageHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicPluginHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicTargetHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicTestHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicToolHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicWalkLibsHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Core/Qt6CoreConfigExtras.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Gui/conan_qt_qt6_guiprivate.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Widgets/conan_qt_qt6_widgetsprivate.cmake'
[cmake] -- Conan: Including build module from 'C:/Conan/b/qt786ab487e9b0f/p/lib/cmake/Qt6Widgets/Qt6WidgetsMacros.cmake'
[cmake] -- Configuring done (9.6s)
[cmake] -- Generating done (1.8s)
[cmake] -- Build files have been written to: D:/Qt/build
[main] Building folder: Qt akash
[build] Starting build
[proc] Executing command: chcp
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" --build D:/Qt/build --config Debug --target akash
[build] MSBuild version 17.8.3+195e7f5a3 for .NET Framework
[build] 
[build]   Automatic MOC and UIC for target akash
[build]      Creating library D:/Qt/build/src/Debug/akash.lib and object D:/Qt/build/src/Debug/akash.exp
[build] Qt6Guid.lib(qrhid3d12.cpp.obj) : error LNK2019: unresolved external symbol D3D12SerializeVersionedRootSignature referenced in function "public: bool __cdecl QD3D12MipmapGenerator::create(class QRhiD3D12 *)" (?create@QD3D12MipmapGenerator@@QEAA_NPEAVQRhiD3D12@@@Z) [D:\Qt\build\src\akash.vcxproj]
[build] Qt6Guid.lib(qrhid3d12.cpp.obj) : error LNK2019: unresolved external symbol D3D12CreateDevice referenced in function "public: virtual bool __cdecl QRhiD3D12::create(class QFlags<enum QRhi::Flag>)" (?create@QRhiD3D12@@UEAA_NV?$QFlags@W4Flag@QRhi@@@@@Z) [D:\Qt\build\src\akash.vcxproj]
[build] Qt6Guid.lib(qrhid3d12.cpp.obj) : error LNK2019: unresolved external symbol D3D12GetDebugInterface referenced in function "public: virtual bool __cdecl QRhiD3D12::create(class QFlags<enum QRhi::Flag>)" (?create@QRhiD3D12@@UEAA_NV?$QFlags@W4Flag@QRhi@@@@@Z) [D:\Qt\build\src\akash.vcxproj]
[build] D:\Qt\build\src\Debug\akash.exe : fatal error LNK1120: 3 unresolved externals [D:\Qt\build\src\akash.vcxproj]
[proc] The command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" --build D:/Qt/build --config Debug --target akash exited with code: 1
[driver] Build completed: 00:01:45.008
[build] Build finished with exit code 1
[main] =======================================================
[main] No executable target was found to launch. Please check:
[main]  - Have you called add_executable() in your CMake project?
[main]  - Have you executed a successful CMake configure?
[main] No program will be executed

@akashdiphazra akashdiphazra added the bug Something isn't working label Jan 23, 2024
@akashdiphazra akashdiphazra changed the title [package] qt/6.61: failed to build on msvc compiler in windows 11. [package] qt/6.6.1: failed to build on msvc compiler in windows 11. Jan 23, 2024
@stevenwdv
Copy link
Contributor

stevenwdv commented Feb 1, 2024

I also have this issue. I think the cause is that, while DirectX/Direct3D 9 and 11 (d3d9, d3d11) are linked, DirectX 12 (d3d12) is not:

if self.settings.os == "Windows":
self.cpp_info.components["qtGui"].system_libs = ["advapi32", "gdi32", "ole32", "shell32", "user32", "d3d11",
"dxgi", "dxguid", "d2d1", "dwrite", "d3d9", "setupapi", "SHCore"]

@ashley-b
Copy link
Contributor

ashley-b commented Feb 2, 2024

That linker error looks related to PR #21676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants