question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conan not detecting "clean" installation of VS 2017

See original GitHub issue

Hi everyone,

After setting up VS 2017 without the older SDKs or build tools and trying to execute conan v0.22.1 for the first time (with the devenv environment variables initialised of cource) I get this message (there is no problem if the VS 2015 build system or VS 2015 itself has been installed on the machine at the same time):

It seems to be the first time you've ran conan
Auto detecting your dev setup to initialize conan.conf
ERROR: Unable to find a working compiler
Default conan.conf settings
        os=Windows
        arch=x86_64
        build_type=Release
*** You can change them in ~/.conan/conan.conf ***
*** Or override with -s compiler='other' -s ...s***

CMake does detect my compiler as “Visual Studio 15 2017”.

Is there a workaround for this or a fix planned in an upcoming release?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ghostcommented, Jun 17, 2017

While we’re on this subject, and to distribute knowledge that I acquired after much pain and suffering, I would suggest that you also open your Visual Studio 2017 Installer and make sure that the Windows 8.1 SDK is installed in addition to the Windows 10 SDK:

sdk8 1

When building existing old VS projects, many times the referenced Windows SDK fails to be upgraded to v10 and just gets stuck at v8.1. This can happen even when upgrading from the interface of Visual Studio. Obviously, I have no idea why. For your own projects of course I guess you will make sure you are using the right SDK, setting it by hand, but when your scripts execute, downloading and automatically upgrading dependencies this will save you some time and brain cells murdered by extreme frustration.

3reactions
ghostcommented, Jun 17, 2017

To my understanding Visual Studio used to set the VSxxxCOMNTOOLS variable before, and conan (and other tools) could rely on it. For some reason that escapes me, VS has just stopped doing this in version 2017, so we need to either set an environment variable or execute this before running our builds:

set vs150comntools=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\

If conan has already been executed on your system before this variable was set, it may be missing the highlighted lines below at the bottom, so you need to add them manually, like this if you want them the way conan would do it in previous VS versions by default:

[settings_defaults]

arch=x86_64 build_type=Release os=Windows compiler=Visual Studio compiler.version=15 compiler.runtime=MD

… or like this, also changing arch, if you want to be able to just run conan install, cmake and cmake build on the command line for your project without the cmake -G flag and the cmake build --config flag (I mention them here for example), which are needed not because of a conan issue but because of VS’s quirks.

[settings_defaults]

arch=x86 build_type=Debug os=Windows compiler=Visual Studio compiler.version=15 compiler.runtime=MDd <---- Attention MD becomes MDd

Of course, if you don’t mind being verbose, here’s an example of how you can skip all of that about conan.conf (still needing VS150COMNTOOLS though) and build a project while specifying everything on the command line:

mkdir build
cd build
conan install .. -s arch=x86_64 -s build_type=Debug -s os=Windows -s compiler="Visual Studio" -s compiler.version=15 -s compiler.runtime=MDd --build missing
cmake -G"Visual Studio 15 2017 Win64" ..
cmake --build . --config Debug
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Visual Studio 2017 - CMake integration - Conan Docs
This code will manage to download the cmake-conan CMake script, and use it automatically, calling a conan install automatically. There could be an...
Read more >
CMake cant find instance of Visual Studio 15 2017 generator ...
My understanding is that this should work, I should have the appropriate tools. When I run cmake -G "Visual Studio 16 2019" ../....
Read more >
Troubleshooting Omnibus GitLab installation issues
To our knowledge there is no clean way to install Debian or RPM packages as a non-privileged user. You cannot install Omnibus GitLab...
Read more >
CMake Presets integration in Visual Studio and Visual Studio ...
I would like to configure a preset that will set `”CMAKE_TOOLCHAIN_FILE”: “conan_toolchain.cmake”` as a Configure Preset but I do not care about ...
Read more >
conan Changelog - pyup.io
Feature: New custom user commands, that can be built using the public PythonAPI and can be shared and installed with ``conan config install``...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found