Search code examples
vcpkg

vcpkg on MinGW looks for Visual Studio


Following instructions at https://learn.microsoft.com/en-us/vcpkg/users/platforms/mingw

However, vcpkg requires Visual Studio to work. It seems that is related with vcpkg-cmake package.

$ git clone https://github.com/microsoft/vcpkg.git vcpkg-mingw-64-ucrt64
Cloning into 'vcpkg-mingw-64-ucrt64'...
remote: Enumerating objects: 194198, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 194198 (delta 21), reused 27 (delta 20), pack-reused 194157
Receiving objects: 100% (194198/194198), 69.75 MiB | 3.82 MiB/s, done.
Resolving deltas: 100% (125287/125287), done.
Updating files: 100% (10229/10229), done.
$ cd vcpkg-mingw-64-ucrt64/
$ ./bootstrap-vcpkg.bat
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2023-04-07/vcpkg.exe -> D:\Pro
jects\vcpkg-mingw-64-ucrt64\vcpkg.exe... done.
Validating signature... done.

Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md
$ ./vcpkg install zlib:x64-mingw-dynamic
Computing installation plan...
The following packages will be built and installed:
  * vcpkg-cmake[core]:x64-windows -> 2022-12-22
    zlib[core]:x64-mingw-dynamic -> 1.2.13
Additional packages (*) will be modified to complete this operation.
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance

Solution

  • Looking at:

      * vcpkg-cmake[core]:x64-windows -> 2022-12-22
        zlib[core]:x64-mingw-dynamic -> 1.2.13
    

    shows that the host triplet is not set and the default is used.

    Try ./vcpkg install zlib --triplet x64-mingw-dynamic --host-triplet x64-mingw-dynamic instead or set the according environment variables VCPKG_DEFAULT_TRIPLET and VCPKG_DEFAULT_HOST_TRIPLET to change the default.