conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
972 stars 1.79k forks source link

[package] qt/5.15.6: "ConanException: option 'with_atspi' doesn't exist" error when compiling on Windows, both with MinGW and MSVC #13816

Open Isaac-Martinez-Forte opened 2 years ago

Isaac-Martinez-Forte commented 2 years ago

Description

Compiling qt version 5.15.6 on Windows gives me the following error "ConanException: option 'with_atspi' doesn't exist" using both MinGW and MSVC:

ERROR: qt/5.15.6: Error in config_options() method, line 232 self.options.with_atspi = False ConanException: option 'with_atspi' doesn't exist Possible options are ['shared', 'commercial', 'opengl', 'with_vulkan', 'openssl', 'with_pcre2', 'with_glib', 'with_doubleconversion', 'with_freetype', 'with_harfbuzz', 'with_libjpeg', 'with_libpng', 'with_sqlite3', 'with_mysql', 'with_pq', 'with_odbc', 'with_zstd', 'with_dbus', 'with_md4c', 'gui', 'widgets', 'device', 'cross_compile', 'sysroot', 'config', 'multiconfiguration', 'qtsvg', 'qtdeclarative', 'qtactiveqt', 'qtscript', 'qtmultimedia', 'qttools', 'qtxmlpatterns', 'qttranslations', 'qtdoc', 'qtlocation', 'qtsensors', 'qtconnectivity', 'qtwayland', 'qt3d', 'qtimageformats', 'qtgraphicaleffects', 'qtquickcontrols', 'qtserialbus', 'qtserialport', 'qtwinextras', 'qtandroidextras', 'qtwebsockets', 'qtwebchannel', 'qtwebengine', 'qtwebview', 'qtquickcontrols2', 'qtpurchasing', 'qtcharts', 'qtdatavis3d', 'qtvirtualkeyboard', 'qtgamepad', 'qtscxml', 'qtspeech', 'qtnetworkauth', 'qtremoteobjects', 'qtwebglplugin', 'qtlottie', 'qtquicktimeline', 'qtquick3d']

Package and Environment Details

Conan profile

[settings] os=Windows os_build=Windows arch=x86_64 arch_build=x86_64 compiler=Visual Studio compiler.version=17 build_type=Release [options] [build_requires] [env]

Steps to reproduce

File conanfile.py

`from conans import ConanFile, tools import platform

class ModuleConan(ConanFile): name = "QFTbx" description = "An example for Qt with Conan" settings = "os", "compiler", "build_type", "arch" generators = "qt", "cmake", "cmake_find_package_multi", "cmake_paths" default_options = { "qt:qttools": True, "qcustomplot:with_opengl" : True }

def configure(self):
    del self.settings.compiler.cppstd

def requirements(self):
    self.requires("qt/5.15.6")
    self.requires("qcustomplot/2.1.0")
    self.requires("llvm-openmp/12.0.1")
    self.requires("doxygen/1.9.4")
    self.requires("glog/0.6.0")`

and use conan install .. --build=missing

Logs

Click to expand log ``` Configuration: [settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=Visual Studio compiler.runtime=MD compiler.version=17 os=Windows os_build=Windows [options] [build_requires] [env] WARN: pcre2/10.40: requirement zlib/1.2.13 overridden by qt/5.15.6 to zlib/1.2.12 WARN: qcustomplot/2.1.0: requirement qt/6.3.0 overridden by QFTbx/None to qt/5.15.6 ERROR: qt/5.15.6: Error in config_options() method, line 232 self.options.with_atspi = False ConanException: option 'with_atspi' doesn't exist Possible options are ['shared', 'commercial', 'opengl', 'with_vulkan', 'openssl', 'with_pcre2', 'with_glib', 'with_doubleconversion', 'with_freetype', 'with_harfbuzz', 'with_libjpeg', 'with_libpng', 'with_sqlite3', 'with_mysql', 'with_pq', 'with_odbc', 'with_zstd', 'with_dbus', 'with_md4c', 'gui', 'widgets', 'device', 'cross_compile', 'sysroot', 'config', 'multiconfiguration', 'qtsvg', 'qtdeclarative', 'qtactiveqt', 'qtscript', 'qtmultimedia', 'qttools', 'qtxmlpatterns', 'qttranslations', 'qtdoc', 'qtlocation', 'qtsensors', 'qtconnectivity', 'qtwayland', 'qt3d', 'qtimageformats', 'qtgraphicaleffects', 'qtquickcontrols', 'qtserialbus', 'qtserialport', 'qtwinextras', 'qtandroidextras', 'qtwebsockets', 'qtwebchannel', 'qtwebengine', 'qtwebview', 'qtquickcontrols2', 'qtpurchasing', 'qtcharts', 'qtdatavis3d', 'qtvirtualkeyboard', 'qtgamepad', 'qtscxml', 'qtspeech', 'qtnetworkauth', 'qtremoteobjects', 'qtwebglplugin', 'qtlottie', 'qtquicktimeline', 'qtquick3d'] ```
ericLemanissier commented 2 years ago

I reproduced it with the same recipe, and I could reduce the recipe down to:

from conan import ConanFile

class ModuleConan(ConanFile):
    def requirements(self):
        self.requires("qt/5.15.6")
        self.requires("qcustomplot/2.1.0")

it happens because qcustomplot require qt/6.3.0, which recipe does not have a with_atspi option, but then you override qt/6.3.0 with qt/5.15.6, which recipe tries to delete with_atspi option. As far as I understand, the bug is in conan, not in conan-center-index. Could you please report it in https://github.com/conan-io/conan/issues/new/choose ? (or maybe a mod can move this report directly ?)

prince-chrismc commented 2 years ago

I think it's a recipe bug 🤔 it sounds like qcustomplot should be improved to support qt5

Though the error message is bad...

ericLemanissier commented 2 years ago

A bug in which recipe? Qcustomplot never touches this option. The root cause here is that qt5 and qt6 do not have the same options

prince-chrismc commented 2 years ago

I didn't understand the issue, I'll flag this to the client pro :)

memsharded commented 2 years ago

I think this is related to some inconsistencies in the dependency graph when there are versions conflicts or overrides in it. I think I have seen this before, and resulted in something really difficult to fix in Conan, and with an evident solution that is just moving the dependencies to a consistent version, to avoid overrides.

It would be very useful to have a repro case in form of a very simple test (something that we can add to the Conan codebase), in order to test what is the behavior in Conan 2.0, which I think it might solve this issues.

Isaac-Martinez-Forte commented 2 years ago

Hello, thanks for the answers, indeed it seems to be a compatibility problem between QT versions. On the other hand, as already mentioned, QCustomPlot does not need QT6 to compile, so it would be ideal if it supports QT5 as well.

I have tried to use QT6 with qt5compat enabled, but then it gives me other compilation problems.

It seems to me that the compilation of Qt is complex and not very robust at the moment.

ericLemanissier commented 2 years ago

@memsharded I could reduce the test case down to https://github.com/ericLemanissier/conan-center-index-bug-13816 see how it fails in https://github.com/ericLemanissier/conan-center-index-bug-13816/actions/runs/3361342852/jobs/5571618352#step:5:79 there is actually no link to the fact that qt5 and qt6 have a different recipe. The root cause is https://github.com/ericLemanissier/conan-center-index-bug-13816/blob/896728a074e0428a3ec33a56873cbddbbe738876/qcustomplot/conanfile.py#L5

These are the steps to trigger the problem:

conan export qt qt/1.0@
conan export qcustomplot qcustomplot/1.0@
conan install .
ericLemanissier commented 1 year ago

This still happens on conan 1.55.0 https://github.com/ericLemanissier/conan-center-index-bug-13816/actions/runs/3618295587/jobs/6097986904#step:5:79

phamelin commented 1 year ago

I'm having the same error but with a slightly different use case.

To reproduce the bug:

  1. Create PackageA using cmake template conan new PackageA/0.1 --template=cmake_lib
  2. In PackageA, add qt5 requirement requires = "qt/5.15.4"
  3. In Package A, add custom options for Qt
    def configure(self):
    self.options["qt"].qttranslations = True
    self.options["qt"].qtsvg = True
  4. Create PackageB using the following conanfile.txt
    [requires]
    qt/5.15.4
    PackageA/0.1
    [generators]
    CMakeDeps
  5. In PackageB, call conan install .

Then, we have the following error:

ERROR: qt/5.15.4: Error in config_options() method, line 228
        self.options.with_atspi = False
        ConanException: option 'with_atspi' doesn't exist

Note that the requires order in conanfile.txt seems to be important, i.e. it works if I put PackageA before qt. I can also reproduce the same problem using a conanfile.py. Tested with Conan 1.54.0.

ericLemanissier commented 1 year ago

@memsharded the problem is still present with conan 1.56.0 https://github.com/ericLemanissier/conan-center-index-bug-13816/actions/runs/3910004202/jobs/6681699774#step:5:78 It happens even in the absence of version overriding or conflicts That said, the test case I made on https://github.com/ericLemanissier/conan-center-index-bug-1381 passes with conan 2 pre version https://github.com/ericLemanissier/conan-center-index-bug-13816/actions/runs/3910072011/jobs/6681843401

loopless commented 1 year ago

Did anyone resolve this issue in Conan 1.x ? Or come up with a workaround.
We are using qcustomplot, but version 2.0.1 which should not require QT6, yet we get, seemingly randomly, the

ERROR: qt/5.15.2: Error in config_options() method, line 231 self.options.with_atspi = False

RobertHabrich commented 11 months ago

Getting the "option 'with_atspi' doesn't exist" error as well with qt/5.15.11. However, in my case enabling the "openssl" option triggers it.

my requirements in conanfile.py:

self.requires("qt/5.15.11")
self.options["qt"].shared = True
self.options["qt"].openssl = True # setting this to False will fix the error
self.options["qt"].qttools = True
self.options["qt"].qtsvg = True
self.options["qt"].qttranslations = True

conan install output:

ERROR: qt/5.15.11: Error in config_options() method, line 195
self.options.with_atspi = False
ConanException: option 'with_atspi' doesn't exist

I'm guessing there is still no good workaround?