Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcpkg_fixup_pkgconfig failed to replace the string when root path contains Upper charactor on windows #12709

Closed
PhoebeHui opened this issue Aug 3, 2020 · 13 comments
Assignees
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@PhoebeHui
Copy link
Contributor

vcpkg_fixup_pkgconfig failed to replace the string when the path contains Upper character on windows.

Repro steps:

  1. Git clone https://github.com/microsoft/vcpkg F:\VCPKG\test7
  2. ./bootstrap-vcpkg.bat
  3. ./vcpkg install zlib:x64-windows

Failures:
Starting package 1/1: zlib:x64-windows
Building package zlib[core]:x64-windows...
-- Using cached F:/vcpkg/test7/vcpkg/downloads/zlib1211.tar.gz
-- Cleaning sources at F:/vcpkg/test7/vcpkg/buildtrees/zlib/src/1.2.11-deec42f53b.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source F:/vcpkg/test7/vcpkg/downloads/zlib1211.tar.gz
-- Applying patch cmake_dont_build_more_than_needed.patch
-- Using source at F:/vcpkg/test7/vcpkg/buildtrees/zlib/src/1.2.11-deec42f53b.clean
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Fixing pkgconfig
-- Acquiring MSYS Packages...
-- Acquiring MSYS Packages... OK
-- Fixing pkgconfig - release
-- Checking file: F:/vcpkg/test7/vcpkg/packages/zlib_x64-windows/lib/pkgconfig/zlib.pc
-- Fixing pkgconfig - debug
-- Checking file: F:/vcpkg/test7/vcpkg/packages/zlib_x64-windows/debug/lib/pkgconfig/zlib.pc
-- CHECK_LIB_zlibd_DEBUG:CHECK_LIB_zlibd_DEBUG-NOTFOUND
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:239 (message):
Library "zlibd" was not found! If it is a system library use the
SYSTEM_LIBRARIES parameter for the vcpkg_fixup_pkgconfig call! Otherwise,
correct the *.pc file
Call Stack (most recent call first):
scripts/cmake/vcpkg_fixup_pkgconfig.cmake:351 (vcpkg_fixup_pkgconfig_check_files)
ports/zlib/portfile.cmake:46 (vcpkg_fixup_pkgconfig)
scripts/ports.cmake:79 (include)

Error: Building package zlib:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with .\vcpkg update, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: zlib:x64-windows
Vcpkg version: 2020.06.15-nohash

More info:

zlib.pc file with debug
prefix=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/debug
exec_prefix=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/debug
libdir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/lib
sharedlibdir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/lib
includedir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/../include

Name: zlib
Description: zlib compression library
Version: 1.2.11

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lzlibd
Cflags: -I${includedir}


zlib.pc file with release
prefix=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows
exec_prefix=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows
libdir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/lib
sharedlibdir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/lib
includedir=F:/VCPKG/test7/vcpkg/packages/zlib_x64-windows/include

Name: zlib
Description: zlib compression library
Version: 1.2.11

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lzlib
Cflags: -I${includedir}
@PhoebeHui PhoebeHui added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Aug 3, 2020
@PhoebeHui
Copy link
Contributor Author

cc @Neumann-A

@Neumann-A
Copy link
Contributor

Release worked so the issue should be not the path but somewhere else. set(PORT_DEBUG on) in the triplet or port for better debugging of the issue

@Neumann-A
Copy link
Contributor

PS E:\SPACE> .\vcpkg.exe install zlib
Your feedback is important to improve Vcpkg! Please take 3 minutes to complete our survey by running: vcpkg contact --survey
Computing installation plan...
The following packages will be built and installed:
    zlib[core]:x64-windows-static
Detecting compiler hash for triplet x64-windows-static...
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
Could not locate cached archive: E:\vcpkg_cache\binaries\99\993051106a04936938fda9b5dc16a36419b98b54.zip
-- Using cached E:/vcpkg_cache/downloads/zlib1211.tar.gz
-- Cleaning sources at E:/SPACE/buildtrees/zlib/src/1.2.11-deec42f53b.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source E:/vcpkg_cache/downloads/zlib1211.tar.gz
-- Applying patch cmake_dont_build_more_than_needed.patch
-- Using source at E:/SPACE/buildtrees/zlib/src/1.2.11-deec42f53b.clean
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Fixing pkgconfig
-- Acquiring MSYS Packages...
-- Acquiring MSYS Packages... OK
-- [DEBUG] Using pkg-config from: E:/vcpkg_cache/downloads/tools/msys2/msys64/usr/bin/pkg-config.exe
-- Fixing pkgconfig - release
-- [DEBUG] Files: E:/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/zlib.pc
-- Checking file: E:/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/zlib.pc
-- [DEBUG] Checking package (RELEASE): zlib
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:
-- [DEBUG] pkg-config error output:
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:-L/E/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib -lzlib
-- [DEBUG] pkg-config error output:
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:-L/E/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib
-- [DEBUG] pkg-config error output:
-- [DEBUG] -L LIST TRANSFORMATION:';/E/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib'
-- [DEBUG] REMOVING:'/E/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib'
-- [DEBUG] FROM:'-L/E/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib -lzlib'
-- [DEBUG] LIBS AFTER -L<path> REMOVAL:';-lzlib'
-- [DEBUG] pkg-config output lib paths after replacement (cmake style):E:/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib
-- [DEBUG] pkg-config output lib after replacement (cmake style):-lzlib
-- [DEBUG] IGNORED FLAGS:''
-- [DEBUG] BEFORE IGNORE FLAGS REMOVAL: -lzlib
-- [DEBUG] SYSTEM LIBRARIES:'wsock32;Ws2_32'
-- [DEBUG] LIBRARIES in PC:'-lzlib'
-- [DEBUG] REMOVING:'wsock32'
-- [DEBUG] FROM:'-lzlib'
-- [DEBUG] AFTER REMOVAL:'-lzlib'
-- [DEBUG] REMOVING:'Ws2_32'
-- [DEBUG] FROM:'-lzlib'
-- [DEBUG] AFTER REMOVAL:'-lzlib'
-- [DEBUG] Library search paths:E:/SPACE/packages/zlib_x64-windows-static/lib/pkgconfig/../../lib
-- [DEBUG] Libraries to search:-lzlib
-- [DEBUG] Library match: CMAKE_MATCH_1:zlib
-- [DEBUG] CHECK_LIB_zlib_RELEASE before:
-- [DEBUG] CHECK_LIB_zlib_RELEASE after: E:/SPACE/packages/zlib_x64-windows-static/lib/zlib.lib
-- [DEBUG] CHECK_LIB_zlib_RELEASE after unset:
-- Fixing pkgconfig - debug
-- [DEBUG] Files: E:/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/zlib.pc
-- Checking file: E:/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/zlib.pc
-- [DEBUG] Checking package (DEBUG): zlib
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:
-- [DEBUG] pkg-config error output:
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:-L/E/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib -lzlibd
-- [DEBUG] pkg-config error output:
-- [DEBUG] pkg-config returned:0
-- [DEBUG] pkg-config output:-L/E/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib
-- [DEBUG] pkg-config error output:
-- [DEBUG] -L LIST TRANSFORMATION:';/E/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib'
-- [DEBUG] REMOVING:'/E/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib'
-- [DEBUG] FROM:'-L/E/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib -lzlibd'
-- [DEBUG] LIBS AFTER -L<path> REMOVAL:';-lzlibd'
-- [DEBUG] pkg-config output lib paths after replacement (cmake style):E:/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib
-- [DEBUG] pkg-config output lib after replacement (cmake style):-lzlibd
-- [DEBUG] IGNORED FLAGS:''
-- [DEBUG] BEFORE IGNORE FLAGS REMOVAL: -lzlibd
-- [DEBUG] SYSTEM LIBRARIES:'wsock32;Ws2_32'
-- [DEBUG] LIBRARIES in PC:'-lzlibd'
-- [DEBUG] REMOVING:'wsock32'
-- [DEBUG] FROM:'-lzlibd'
-- [DEBUG] AFTER REMOVAL:'-lzlibd'
-- [DEBUG] REMOVING:'Ws2_32'
-- [DEBUG] FROM:'-lzlibd'
-- [DEBUG] AFTER REMOVAL:'-lzlibd'
-- [DEBUG] Library search paths:E:/SPACE/packages/zlib_x64-windows-static/debug/lib/pkgconfig/../../lib
-- [DEBUG] Libraries to search:-lzlibd
-- [DEBUG] Library match: CMAKE_MATCH_1:zlibd
-- [DEBUG] CHECK_LIB_zlibd_DEBUG before:
-- [DEBUG] CHECK_LIB_zlibd_DEBUG after: E:/SPACE/packages/zlib_x64-windows-static/debug/lib/zlibd.lib
-- [DEBUG] CHECK_LIB_zlibd_DEBUG after unset:
-- Fixing pkgconfig --- finished
-- Installing: E:/SPACE/packages/zlib_x64-windows-static/share/zlib/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: E:\vcpkg_cache\binaries\99\993051106a04936938fda9b5dc16a36419b98b54.zip
Building package zlib[core]:x64-windows-static... done
Installing package zlib[core]:x64-windows-static...
Installing package zlib[core]:x64-windows-static... done
Elapsed time for package zlib:x64-windows-static: 4.975 s

Total elapsed time: 6.631 s

The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

@Neumann-A
Copy link
Contributor

ah wait that is with #12709

@JackBoosY
Copy link
Contributor

@Neumann-A I think it's a vcpkg bug and we shouldn't fix it in other ways.

@JackBoosY JackBoosY added category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly and removed category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) labels Aug 4, 2020
@Neumann-A
Copy link
Contributor

I am unable to repro this failure on my local machine

@JackBoosY
Copy link
Contributor

@Neumann-A It's hard to reproduce.

@PhoebeHui
Copy link
Contributor Author

PhoebeHui commented Aug 7, 2020

It should has some issue somewhere else, I noticed same issue #12788 reported, it might not related to the Upper case. For me, After I changed it to lowercase, everything works. I will test Jack's PR.

@PhoebeHui
Copy link
Contributor Author

PhoebeHui commented Aug 7, 2020

The vcpkg root returns with lowercase, that cause the string replace failed here. Test with PR #12774, it doesn't work.

PS F:\vcpkg\test7\vcpkg> ./vcpkg install zlib --debug
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Using vcpkg-root: F:\vcpkg\test7\vcpkg
[DEBUG] Using installed-root: F:\vcpkg\test7\vcpkg\installed
[DEBUG] Using buildtrees-root: F:\vcpkg\test7\vcpkg\buildtrees
[DEBUG] Using downloads-root: F:\vcpkg\test7\vcpkg\downloads
[DEBUG] Using packages-root: F:\vcpkg\test7\vcpkg\packages
[DEBUG] Using scripts-root: F:\vcpkg\test7\vcpkg\scripts

When debug vcpkg with VS IDE, it returns correct path:
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Using vcpkg-root: F:\VCPKG\test7\vcpkg
[DEBUG] Using installed-root: F:\VCPKG\test7\vcpkg\installed
[DEBUG] Using buildtrees-root: F:\VCPKG\test7\vcpkg\buildtrees
[DEBUG] Using downloads-root: F:\VCPKG\test7\vcpkg\downloads
[DEBUG] Using packages-root: F:\VCPKG\test7\vcpkg\packages
[DEBUG] Using scripts-root: F:\VCPKG\test7\vcpkg\scripts

@Neumann-A
Copy link
Contributor

So my take away now is that this is a bug in vcpkg.exe (or maybe even VS) and not the scripts. So I'll ignore this issue for know and you will somehow solve/fix it.

@strega-nil strega-nil self-assigned this Aug 11, 2020
@PhoebeHui PhoebeHui added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Aug 31, 2020
@PhoebeHui
Copy link
Contributor Author

Test with PR #13144, it works.

@PhoebeHui
Copy link
Contributor Author

This issue would be fixed by PR #13537

@PhoebeHui
Copy link
Contributor Author

The PR #13537 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

No branches or pull requests

4 participants