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

[question] Conan 2.x Transition - MSVC Compiler Version #17118

Open
1 task done
radonish opened this issue Oct 4, 2024 · 6 comments
Open
1 task done

[question] Conan 2.x Transition - MSVC Compiler Version #17118

radonish opened this issue Oct 4, 2024 · 6 comments

Comments

@radonish
Copy link

radonish commented Oct 4, 2024

What is your question?

Transitioning my company from Conan 1.x to 2.x and after successfully building packages with Linux-based profiles, I ran into an issue with our single Windows profile.

Question: What is required to add a new MSVC compiler version to settings.yml so the generator helpers (e.g. Autotools*) can be used?

We are using MSVC compiler version 16.0.40219.1 which translates to 160 per the Microsoft guidance. Originally I had simply updated my settings.yml to include version 160:

msvc:
    version: [160, 170, 180, 190, 191, 192, 193]

Our Windows profile looks like:

[settings]
os=Windows
arch=x86
compiler=msvc
compiler.version=160
compiler.runtime=dynamic
build_type=Release

[options]
zlib/:shared=True
openssl/:shared=True

While some packages built fine with the Windows profile, I ran into an issue with the OpenSSL package in generate(). I originally thought it was specific to the package but now believe it's a general problem related to the MSVC version I added. When using AutotoolsToolchain.generate() I get an error:

ERROR: openssl/1.1.1l: Error in generate() method, line 193
       tc.generate(env)
       KeyError: '160'

After some debug I found the '160' was referring to the new MSVC version I had added. So, it feels like there is more to adding an allowed version than the simple settings.yml update I did.

Any help would be greatly appreciated.

Thanks

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@radonish
Copy link
Author

radonish commented Oct 4, 2024

After some more digging and looking at the settings.yml reference, I added the following to our global.conf:
tools.microsoft.msbuild:vs_version = 10

That got me past the AutotoolsToolchain.generate() error. I'm assuming some sort of internal lookup was failing due to my added MSVC 160 version? Is this conf better in the global.conf or within the profile file?

Thanks

@memsharded
Copy link
Member

Sorry, do you mean that you are still using VS 2010 (compiler.version=160)?

Conan 2 defined a base minimum of VS 2015 (compiler.version=190) with CMake 3.15.
I am not saying it will be impossible to support it, but most likely VS 2010 is not supported out of the box.

@radonish
Copy link
Author

radonish commented Oct 7, 2024

Yes, correct - our Windows build machines are currently using VS 2010. Thank you for the background on what versions are supported with Conan 2.

I am going to attempt getting MSBuild 2022 installed and working for all of our Windows build machines in hopes of avoiding any conanfile.py hacking to make VS 2010 work.

@radonish
Copy link
Author

radonish commented Oct 8, 2024

@memsharded, I installed the latest "Build Tools for Visual Studio 2022" distribution. The compiler version is reported as:

Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34120 for x64

Looking at the settings.yml documentation it looks like I should have compiler.version=194 but your commit makes it look like I need to leave compiler.version=193 and set compiler.update=14.

Could you provide some guidance as to the correct configuration to use given the compiler version above, please?

Thanks!

@memsharded
Copy link
Member

Looking at the settings.yml documentation it looks like I should have compiler.version=194 but your commit makes it look like I need to leave compiler.version=193 and set compiler.update=14.

The recommendation would be to use compiler.version=194. That will by default use the latest 19.4X compiler version you have installed. Using the compiler.update=1 will explicitly model 19.41 as a dependency, but then it will require new binaries build for the next VS update when it installs 19.42 version and so on. In general Conan assumes that the update is not necessary for binary compatibility for most us cases.

@memsharded
Copy link
Member

Yes, correct - our Windows build machines are currently using VS 2010. Thank you for the background on what versions are supported with Conan 2.

Yes, supporting VS2010 might be a bit of an effort, because both Conan client, but also recipes in ConanCenter do not generally provide support for it. In the case above it seems the openssl could have limited support for those old versions. But it would be necessary to go case by case (I'd recommend to file a dedicated specific ticket for different build systems in Conan client if viable, but probably for ConanCenter recipes it would be necessary to work on a fork to be able to customize the recipes you need).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants