Search code examples
c++visual-studioconanuwebsockets

Getting uWebSockets for Visual 2017 via Conan


I'm trying to add uWebSockets as a dependency in my conan.txt

conan install .. returns the following error:

ERROR: uwebsockets/18.3.0: Invalid configuration: uwebsockets requires a compiler that supports at least C++17

How can I handle this ?

  • The error comes from https://github.com/conan-io/conan-center-index/blob/master/recipes/uwebsockets/all/conanfile.py
  • I do have 15.9 : ** Visual Studio 2017 Developer Command Prompt v15.9.25
  • Adding a print() in the recipe show that conan thinks I have version 15 (expanded to 15.0.0)
  • Passing -s compiler.version=15.9 returns an "invalid" error
  • Reducing the minimal version to 15 in the recipe works, but clearly it's a hack, v15.0 did not support C++17, so this requirement is correct.

Solution

  • By default, Conan settings supports Visual Studio versions as integer numbers only.

    Passing -s compiler.version=15.9 returns an "invalid" error

    It complains because your custom version, it is not listed in settings.yml, however you can add your version there, there is section explaining how to customize your settings.

    You just need to update your settings.yml, adding 15.9 to Visual Studio version list and it should work.

    You could update your default profile, or create a new one, based on that Visual Studio version.

    Besides that, 15.9 is not 15, therefore, you will need to build all dependencies from sources, due the incompatible package ID. You can make them compatible, but you will need to change the recipe locally and build again. Read compatible compilers section for more information.