Skip to content

[question] How to correctly setup comaptibility() for msvc compiler #3840

@ibrawada

Description

@ibrawada

What is your question?

Hello,

I am using Conan v1.62.0 on Windows 10
I have an upstream mylibrary that i compile for following configuration:
shared=true with msvc v193 compiler (in VS2022).
I have a downstream application that links against mylibrary. The application must be built with msvc v190 (also in VS2022). I have tried to link everything manually and it compiled and worked.

Inside the upstream mylibrary i have following compatibility function:

def compatibility(self):
    if self.settings.compiler == "msvc":
        return [{"settings": [("compiler.version", v)]}
                for v in ("190", "191", "192")]    

running conan install give me following error:

Configuration:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime_type=Debug
compiler.version=190
os=Windows
[options]
[build_requires]
[env]
[conf]
tools.microsoft.msbuild:vs_version=17

mylibrary/0.1.0: Compatible package ID 88ae9566af1a1f2192bd6d37261db5b8ec0258f8 equal to the default package ID
conanfile.py: Installing package
Requirements
    mylibrary/0.1.0 from local cache - Cache
Packages
    mylibrary/0.1.0:88ae9566af1a1f2192bd6d37261db5b8ec0258f8 - Missing

Installing (downloading, building) binaries...
ERROR: Missing binary: mylibrary/0.1.0:88ae9566af1a1f2192bd6d37261db5b8ec0258f8

mylibrary/0.1.0: WARN: Can't find a 'mylibrary/0.1.0' package for the specified settings, options and dependencies:
- Settings: arch=x86_64, build_type=Debug, compiler=msvc, compiler.cppstd=14, compiler.runtime=dynamic, compiler.runtime_type=Debug, compiler.version=190, os=Windows
- Options: shared=True
- Dependencies:
- Requirements:
- Package ID: 88ae9566af1a1f2192bd6d37261db5b8ec0258f8

ERROR: Missing prebuilt package for 'mylibrary/0.1.0'
Use 'conan search mylibrary/0.1.0@ --table=table.html -r=remote' and open the table.html file to see available packages
Or try to build locally from sources with '--build=mylibrary'

It seems that Conan recognizes that msvc v193 package is compatible but for some reason still doesn't want to use it.
Any idea how to rewrite compatibility() in order to tell Conan that package built in v193 is compatible for app built with v190?

Thanks

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions