0

I am trying to install expat/2.5.0 using the command python -m conans.conan install expat/2.5.0@ -pr <profile> where my profile is identical in both cases but only using, compiler.version=193 and compiler.version=194. This is primarily for msvc in a Windows environment.

When performing the install I receive

expat/2.5.0: Main binary package 'bb496eac3d86e85e9282f15fbff7e4d38fef491e' missing. Using compatible package '8e589e066a19f700666be77ed94ff8e8bc88ee10'

and

expat/2.5.0: Main binary package '35008919e57d73db0c4e0b6ee1736abd51fe0f4f' missing. Using compatible package '8e589e066a19f700666be77ed94ff8e8bc88ee10'

However, after reading the documentation for ABI compatibility and then reading the conanfile.py for expat, I could not fine any code that suggests that 194 and 193 are binary compatible. Could anyone explain to me how these are evaluated to get the same packageID for differing compiler versions? I was expecting lines as explained in the documentation such as,

from conans import ConanFile

class Pkg(ConanFile):
    settings = "os", "compiler", "arch", "build_type"

    def package_id(self):
        if self.settings.compiler == "gcc" and self.settings.compiler.version == "4.9":
            for version in ("4.8", "4.7"):
                compatible_pkg = self.info.clone()
                compatible_pkg.settings.compiler.version = version
                self.compatible_packages.append(compatible_pkg)

however, I see nothing like this in the expat conanfile.py

3
  • I think, in this case this is hard-coded into conan's implementation. C.f. here Commented Oct 23, 2024 at 7:40
  • I am currently using 1.63.0, but thanks for this. I had to slightly modify the code to allow a 194 to 193 mapping in the msvc_version_to_vs_ide_version functions (It had this issue, github.com/conan-io/conan/issues/16239). Comparing to 1.63.0, it does not seem to have this mapping. Could it be somewhere else within 1.63.0? Commented Oct 23, 2024 at 21:15
  • From the code, if hasattr(conanfile, "compatibility") and callable(conanfile.compatibility): I was expecting a "compatibility" implemented but inspectation of the conanfile.py, github.com/conan-io/conan-center-index/blob/master/recipes/… this is not implemented. Commented Oct 23, 2024 at 21:30

1 Answer 1

0

The fallback from msvc compiler.version=194 to compiler.version=193 is only implemented in Conan 2, not Conan 1.

The relevant functionality is in the compatibility.py plugin, check this page

if compiler == "msvc":
   msvc_fallback = {"194": "193"}.get(compiler_version)
   if msvc_fallback:
       factors.append([{"compiler.version": msvc_fallback}])

This plugin is designed to be user customizable, so you can removed those lines from the plugin. Recall to remove also the first line comments:

# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.

Or otherwise the next Conan update might replace your changes with a clean default file. Recall that the compatibility.py plugin can be shared and distributed (together with other files) with the conan config install/install-pkg commands.

Sign up to request clarification or add additional context in comments.

2 Comments

I am currently restricted to using conan==1.63.0. I should have stated that sorry, I am looking at the present conanfile.py from the master conan center index. I was trying to understand this fallback behaviour and expected it to be within the expat conanfile.py
Up to my knowledge there is no fallback binary compatibility between msvc compiler.version=194 and 193 in Conan 1.X. Neither in the ConanCenter recipes, they do not implement compatibility fallbacks, at least it is not expected. This would need a report in the Conan issue tracker, providing full details, like exact commands to execute and full output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.