microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.82k stars 6.3k forks source link

VS2017 support #446

Closed OlafvdSpek closed 5 years ago

OlafvdSpek commented 7 years ago

The build fails with VS2017..

C:\vc\vcpkg>powershell -exec bypass scripts\bootstrap.ps1
The system cannot find the path specified.
Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 23-12-2016 13:27:38.
     1>Project "C:\vc\vcpkg\toolsrc\vcpkg.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|x86".
     1>Project "C:\vc\vcpkg\toolsrc\vcpkg.sln" (1) is building "C:\vc\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj" (3) on node 3 (default targets).
     3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools.  Alternatively, you may upgra
       de to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\vc\vcpkg\toolsrc\vcpkglib\vcpkglib.vcxproj]
OlafvdSpek commented 7 years ago

c:\vc\vcpkg\toolsrc\src\tests_dependencies.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vc\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj] c:\vc\vcpkg\toolsrc\src\tests_paragraph.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vc\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj]

sol-prog commented 7 years ago

I've opened the project directly in VS 2017 RC and retargeted the solution, saved the changes and build the project. The vcpkg executable seems to be built and working. Still errors like in the above message:

c:\vcpkg\toolsrc\src\tests_dependencies.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj] c:\vcpkg\toolsrc\src\tests_paragraph.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj]

No package can be installed with vcpkg, e.g. error:

C:\vcpkg>.\vcpkg install sdl2 The system cannot find the path specified. Error: building package sdl2:x86-windows failed Please ensure sure you're using the latest portfiles with `vcpkg update`, then submit an issue at https://github.com/Microsoft/vcpkg/issues including: Package: sdl2:x86-windows Vcpkg version: 0.0.65-ff10939203b7694f21d8e8e0464f092dff1b4eb0 Additionally, attach any relevant sections from the log files above.
barcharcraz commented 7 years ago

this is because the way to find the C compiler has changed with VS 2017. I have a prototype that uses vs2017 but it needs more work to figure out how to integrate it with the VS14 way of doing things

LYP951018 commented 7 years ago

I tried installing directxtk and had the same issue here. Here is what I've tried. Hope this helps. I found that VS2017 RC doesn't set VS150COMNTOOLS as VS2015 does. So I use vcpkg under the Visual Studio 2017 RC Developer Command Prompt and the prompt set environment variables for me.

  1. Replace the vcvarsall path in commands_build.cpp line 33 with %%VCINSTALLDIR%%\Auxiliary\Build\vcvarsall.bat;

  2. Replace post_build_lint.cpp line 18 (as the prompt has added the Tools\MSVC\xxxx\HostXxx\Xxx to PATH for us) with

    static const fs::path DUMPBIN_EXE = R"(dumpbin.exe)";
  3. Rebuild vcpkg;

  4. As I have uninstalled the VS2015 completely, I replaced the sln file name in vcpkg\ports\directxtk\portfile.cmake with the 2017 version;

  5. Enjoy it!

alexkaratarakis commented 7 years ago

Should be fixed after ab33a7fd49904b5a4ff25af6f87d32ddf15fcd6c (vcpkg v0.0.70).

OlafvdSpek commented 7 years ago
Build FAILED.

       "C:\vc\vcpkg\toolsrc\vcpkg.sln" (default target) (1) ->
       "C:\vc\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj" (default target) (7) ->
       (ClCompile target) ->
         c:\vc\vcpkg\toolsrc\src\tests_dependencies.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vc\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj]
         c:\vc\vcpkg\toolsrc\src\tests_paragraph.cpp(1): fatal error C1083: Cannot open include file: 'CppUnitTest.h': No such file or directory [C:\vc\vcpkg\toolsrc\vcpkgtest\vcpkgtest.vcxproj]

    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:37.26

PS C:\vc\vcpkg> git pull
Already up-to-date.
alexkaratarakis commented 7 years ago

After d04e78815a82b52af8b36d14fd68703936199ce3 the test project is not being built as part of bootstrap.ps1 any more. This should remove this error.

japj commented 7 years ago

Just to let you know, I have successfully used latest git vcpkg on a clean W10 system with VS2017 installed.