quantumfoam
quantumfoam

Reputation: 55

VCPKG package installation fails on wrong path with semicolon

I'm new to MSYS2, VCPKG and CMAKE. I want to build package MSDFGEN via MSYS2/UCRT64 and VCPKG on Windows. What I did so far:

 pacman -Syu
 pacman -Su
 pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain git cmake
 git clone https://github.com/Microsoft/vcpkg.git
 cd vcpkg
./bootstrap-vcpkg.bat -disableMetrics
./vcpkg.exe integrate install
./vcpkg.exe install msdfgen

Result:

Computing installation plan...
The following packages will be built and installed:
  * brotli[core]:x86-windows -> 1.0.9#4
  * bzip2[core,tool]:x86-windows -> 1.0.8#3
  * freetype[brotli,bzip2,core,png,zlib]:x86-windows -> 2.12.1#3
  * libpng[core]:x86-windows -> 1.6.39
    msdfgen[core]:x86-windows -> 1.9.2
  * vcpkg-cmake[core]:x64-windows -> 2022-10-30
  * vcpkg-cmake-config[core]:x64-windows -> 2022-02-06#1
  * zlib[core]:x86-windows -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
error: while detecting compiler information:
The log file content at "C:\msys64\home\myname\vcpkg\buildtrees\detect_compiler\stdout-x64-windows.log" is:
CMake Error at C:/msys64/home/myname/vcpkg/scripts/ports.cmake:110 (message):
  Cannot find port:

    Directory does not exist: C;/msys64/home/myname/vcpkg/scripts/detect_compiler

error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output. 

Directory detect_compiler exists, but notice that path includes semicolon. How do I fix this?

Upvotes: 1

Views: 3873

Answers (2)

Anomalous Underdog
Anomalous Underdog

Reputation: 260

To anyone else experiencing this problem, I had the same error, but slightly different goals (I wanted to use vcpkg for Visual Studio, but I also had an install of MSys2. I prefer using MSys2 MinGW, but a large project I wanted to compile only came with a VS solution).

The problem was that vcpkg ended up using the CMake from MSys2 due to the ordering of values in the System Path environment variable. Basically, MSys2 added itself to the System Path environment variable when it was installed.

I just had to make sure vcpkg would see the Windows install of CMake, instead of the MSys2 install of CMake. Put CMake path above the MSys2 path:

enter image description here

If your System Path variable doesn't have an entry for Windows CMake, then add one. The exact paths for your computer will obviously be different, but the idea is the same. Then click OK to save. That's it. No need to uninstall anything. You might need to restart Powershell/bash if you had it open for the new Path variable to take effect.

Upvotes: 1

Milan Š.
Milan Š.

Reputation: 1638

Most likely the issue is with some incorrectly set environment variable in your system (or any other CMake variable) to debug this issue I would start by figuring out if you can find the variable responsible (maybe it's the PATH) variable. To debug this, try running this command in powershell:

dir env: | out-string -stream | Select-String -Pattern "C;/msys64" 

Or just:

dir env: | out-string -stream | Select-String -Pattern "C;"

After you figure out which variable it is, then you can set it properly.

EDIT: I've noticed that you aren't using the correct triplets (I've mentioned it in the comments, but here it may have better formatting): Try exporting these variables, so that you download the correct triplets when using mingw64:

export VCPKG_DEFAULT_TRIPLET=x64-mingw-dynamic
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-dynamic

As is mentioned here in this link

EDIT2: It may seem that the UCRT64 environment is not supported by VCPKG, hence I am not sure if the MinGW triplets will solve the issue (but you may try).

Upvotes: 0

Related Questions