microsoft / vcpkg

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

vcpkg_copy_pdbs() does not work #41400

Open SHIINASAMA opened 4 days ago

SHIINASAMA commented 4 days ago

Describe the bug Failed to match the vcpkg_copy_pdbs() string due to a non-English environment.

Environment

To Reproduce Steps to reproduce the behavior:

  1. visual studio installs non-English language packages
  2. install packages with pdb files

Expected behavior The vcpkg temporarily changes the locale to English and then correctly identifies the pdb path

Failure logs I did some simple debugging with message() and extracted the key valid information. image

Full logs

vcpkg on  master [!⇡]
❯ ./vcpkg install sese
warning: The vcpkg D:\workspaces\vcpkg\vcpkg.exe is using detected vcpkg root D:\workspaces\vcpkg and ignoring mismatched VCPKG_ROOT environment value C:\vcpkg. To suppress this message, unset the environment variable or use the --vcpkg-root command line switch.
Computing installation plan...
The following packages will be built and installed:
    sese[core,sqlite3]:x64-windows@2.3.0
Detecting compiler hash for triplet x64-windows...
-- Automatically setting %HTTP(S)_PROXY% environment variables to "127.0.0.1:7890".
Compiler found: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from D:\vcpkg-archives in 132 us. Use --debug to see more details.
Installing 1/1 sese[core,sqlite3]:x64-windows@2.3.0...
Building sese[core,sqlite3]:x64-windows@2.3.0...
-- Using cached libsese-sese-2.3.0.tar.gz.
-- Cleaning sources at D:/workspaces/vcpkg/buildtrees/sese/src/2.3.0-9f7df747cd.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/workspaces/vcpkg/downloads/libsese-sese-2.3.0.tar.gz
-- Applying patch 001-msvc-pdbs.patch
-- Using source at D:/workspaces/vcpkg/buildtrees/sese/src/2.3.0-9f7df747cd.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
 找到 PDB 文件(在“D:\workspaces\vcpkg\buildtrees\sese\x64-windows-rel\sese\sese.core.pdb”中)
 = 0
 找到 PDB 文件(在“D:\workspaces\vcpkg\buildtrees\sese\x64-windows-dbg\sese\sese.core.pdb”中)
 = 0
CMake Warning at scripts/cmake/vcpkg_copy_pdbs.cmake:44 (message):
  Could not find a matching pdb file for:

      D:/workspaces/vcpkg/packages/sese_x64-windows/bin/sese.core.dll
      D:/workspaces/vcpkg/packages/sese_x64-windows/debug/bin/sese.core.dll

Call Stack (most recent call first):
  ports/sese/portfile.cmake:43 (vcpkg_copy_pdbs)
  scripts/ports.cmake:192 (include)

-- Installing: D:/workspaces/vcpkg/packages/sese_x64-windows/share/sese/usage
-- Performing post-build validation
Stored binaries in 1 destinations in 1.4 s.
Elapsed time to handle sese:x64-windows: 3.4 min
sese:x64-windows package ABI: 278acb9dc776a932fd813de8323fe6dbdf20ae287ab9766c96487367a741089b
Total install time: 3.4 min
sese provides CMake targets:

    find_package(sese CONFIG REQUIRED)
    # build full features
    target_link_libraries(main PRIVATE Sese::Core)
    # build only plugin
    target_link_libraries(main PRIVATE Sese::Plugin)

Additional context

I found this problem while updating my package, and it can be repeated when other packages are installed (e.g. zlib)

SHIINASAMA commented 4 days ago

I found that vcpkg will switch to the English environment, but it seems impossible to tell if the user has installed the English language pack, can output some information in this regard to guide the user to install the language pack?

autoantwort commented 4 days ago

It was documented, but it seems that they removed it 😅 https://github.com/microsoft/vcpkg/pull/39655/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L64

SHIINASAMA commented 3 days ago

It was documented, but it seems that they removed it 😅 https://github.com/microsoft/vcpkg/pull/39655/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L64

Well, at least I think it needs to be a more user friendly prompt. Like when vcpkg fails to download it alerts the user that it may be due to a proxy environment variable being set.

autoantwort commented 3 days ago

I don't know if there is a good was to detect the installed languages

dg0yt commented 3 days ago

Duplicates https://github.com/microsoft/vcpkg/issues/25846.

dg0yt commented 3 days ago

I don't know if there is a good was to detect the installed languages

Well, bootstrap could run dumpbin on vcpkg.exe and check for a known DLL.

autoantwort commented 3 days ago

I guess the best solution is remove the dependency on dumpbin completely

We already have like 95% of the code necessary to replace dumpbin in https://github.com/BillyONeal/vcpkg-tool/tree/replace-powershell which avoids needing to download separate LLVM stuff. @BillyONeal

dg0yt commented 3 days ago

The missing 5% didn't come in 2 years.

autoantwort commented 3 days ago

Right, but implementing that should not be that hard.