microsoft / microsoft/vcpkg

[dbghelp and crashrpt] dbghelp not respecting VCPKG_CMAKE_SYSTEM_VERSION for headers and lib

Open
#16,655 16 comments 0 reactions 2 assignees Claimed by @FrankXie05 View on GitHub
category:port-bug
Dominant language
CMake
Stars
27.5k
Forks
7.7k
Avg merge
2d 19h
Merged PRs (30d)
321

Description

**Describe the bug**
I had problems building crashrpt. The problem was erroneous macro definitions in the headers in recent Windows SDK versions, which is a [known problem](https://needleinathreadstack.wordpress.com/2020/08/25/fixing-compile-failure-minidumpapiset-h1328-0-error-c2143-syntax-error-missing-before/). The fix is to revert to an older version.

Even though I have a custom triplet with `set(VCPKG_CMAKE_SYSTEM_VERSION 10.0.17134.0)`) I get the following from the build log of dbghelp (with my added debug output):

```
CMAKE_SYSTEM_NAME:
CMAKE_HOST_SYSTEM_NAME: Windows
CMAKE_HOST_SYSTEM_VERSION:
CMAKE_SYSTEM_VERSION:
VCPKG_CMAKE_SYSTEM_VERSION: 10.0.17134.0
Using Windows SDK: 10.0.19041.0
Using Windows SDK dir: C:\Program Files (x86)\Windows Kits\10\
LIBFILEPATH: C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x64\dbghelp.lib
DLLFILEPATH: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll
HEADERPATH: C:\Program Files (x86)\Windows Kits\10\Debuggers\inc\dbghelp.h
```

Even though I have a custom triplet with `set(VCPKG_CMAKE_SYSTEM_VERSION 10.0.17134.0)` which isn't the same version. The install always uses dbghelp from the (latest?) installed SDK, so it isn't possible to override it.

By searcing for dbhelp in `C:\Program Files (x86)\Windows Kits\10` i see that `dbghelp.dll` is only available at `C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll` but the .lib and .h have separate versions.

I'm not sure if this is safe to do, depends on the stability of the dll, but I would expect this result instead (with a custom triplet with `set(VCPKG_CMAKE_SYSTEM_VERSION 10.0.17134.0)`):

LIBFILEPATH: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64\dbghelp.lib
DLLFILEPATH: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll
HEADERPATH: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\dbghelp.h

**Environment**
- OS: Windows
- Compiler: tested on current hosted azure pipelines vs2019

**To Reproduce**
Steps to reproduce the behavior:
1. ./vcpkg install crashrpt with the v142 toolset

the triplet I'm using (x64-windows-v142) is:

```
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET v142)
set(VCPKG_CMAKE_SYSTEM_VERSION 10.0.17134.0)
```

2. See error
Repro code when

**Expected behavior**
Working build with dbghelp (headers and lib) from the correct SDK version.

**Failure logs**
from failed build of crashrpt because of this problem with dbghelp:
[install-x64-windows-v142-dbg-out.log](https://github.com/microsoft/vcpkg/files/6123388/install-x64-windows-v142-dbg-out.log)

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.