vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

[zlib] build failure on custom triplet with VCPKG_BUILD_TYPE set to "debug"

Open sjperkins opened this issue 2 years ago • 8 comments

Operating system

Linux

Compiler

Gcc

Steps to reproduce the behavior

Checkout https://github.com/microsoft/vcpkg/commit/e21c414460498b0c7c94d815ad6d1a3d313ff28b

Create the following triplet in `custom-triplets/x64-linux-dynamic-dbg.cmake`


set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE debug)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)



Then run `./vcpkg install zlib:x64-linux-dynamic-dbg --overlay-triplets=custom-triplets`

Failure logs

Computing installation plan... The following packages will be built and installed: zlib:x64-linux-dynamic-dbg -> 1.3 Detecting compiler hash for triplet x64-linux-dynamic-dbg... Restored 0 package(s) from /home/simon/.cache/vcpkg/archives in 491 us. Use --debug to see more details. Installing 1/1 zlib:x64-linux-dynamic-dbg... Building zlib:x64-linux-dynamic-dbg... -- [OVERLAY] Loading triplet configuration from: /home/simon/code/vcpkg/custom-triplets/x64-linux-dynamic-dbg.cmake -- Using cached madler-zlib-v1.3.tar.gz. -- Cleaning sources at /home/simon/code/vcpkg/buildtrees/zlib/src/v1.3-8825ee792f.clean. Use --editable to skip cleaning for the packages you specify. -- Extracting source /home/simon/code/vcpkg/downloads/madler-zlib-v1.3.tar.gz -- Applying patch 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch -- Applying patch 0002-skip-building-examples.patch -- Applying patch 0003-build-static-or-shared-not-both.patch -- Applying patch 0004-android-and-mingw-fixes.patch -- Using source at /home/simon/code/vcpkg/buildtrees/zlib/src/v1.3-8825ee792f.clean -- Configuring x64-linux-dynamic-dbg -- Building x64-linux-dynamic-dbg-dbg -- Installing: /home/simon/code/vcpkg/packages/zlib_x64-linux-dynamic-dbg/share/zlib/vcpkg-cmake-wrapper.cmake -- Fixing pkgconfig file: /home/simon/code/vcpkg/packages/zlib_x64-linux-dynamic-dbg/debug/lib/pkgconfig/zlib.pc CMake Error at scripts/cmake/vcpkg_replace_string.cmake:2 (file): file failed to open for reading (No such file or directory):

/home/simon/code/vcpkg/packages/zlib_x64-linux-dynamic-dbg/include/zconf.h

Call Stack (most recent call first): ports/zlib/portfile.cmake:49 (vcpkg_replace_string) scripts/ports.cmake:147 (include)

error: building zlib:x64-linux-dynamic-dbg failed with: BUILD_FAILED Elapsed time to handle zlib:x64-linux-dynamic-dbg: 3.3 s Please ensure you're using the latest port files with git pull and vcpkg update. Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+zlib You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?title=[zlib]+Build+error&body=Copy+issue+body+from+%2Fhome%2Fsimon%2Fcode%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

Additional context

No response

sjperkins avatar Aug 30 '23 09:08 sjperkins

I'm not able to repro this on x64-linux.

Adela0814 avatar Aug 30 '23 10:08 Adela0814

set(VCPKG_BUILD_TYPE debug)

Don't use this setup. It is unsupported.

If you really want a custom debug-only single-config triplet, use the release type but with debug flags as needed.

dg0yt avatar Aug 30 '23 10:08 dg0yt

set(VCPKG_BUILD_TYPE debug)

Don't use this setup. It is unsupported.

If you really want a custom debug-only single-config triplet, use the release type but with debug flags as needed.

Thanks. Is there a compiler-independent way to do this (CMAKE_RELEASE_TYPE?) or are you referring to adding compiler-specific debug flags?

sjperkins avatar Aug 30 '23 10:08 sjperkins

set(VCPKG_BUILD_TYPE debug)

Don't use this setup. It is unsupported.

If you really want a custom debug-only single-config triplet, use the release type but with debug flags as needed.

I don't understand what you mean. Is this also the cause of #36945 ?

When I just use the default triplets, vcpkg+cmake seem to get confused about when to build/link debug versus release libraries.

HunterZ avatar Feb 25 '24 00:02 HunterZ

When I just use the default triplets, vcpkg+cmake seem to get confused about when to build/link debug versus release libraries.

This issue is not about default triplets,

dg0yt avatar Feb 25 '24 05:02 dg0yt

When I just use the default triplets, vcpkg+cmake seem to get confused about when to build/link debug versus release libraries.

This issue is not about default triplets,

I never said it was. I only mentioned issues with default triplets as context for why I was using custom ones.

Anyway, it seems the "correct" way to do this is to not force debug-versus-release at the vcpkg triplet level (which unfortunately results in it building both flavors even if you only need one) and then stay away from any CMake build types other than Debug and Release (also unfortunate since I wanted to use MinSizeRel).

HunterZ avatar Feb 25 '24 05:02 HunterZ

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

github-actions[bot] avatar Aug 24 '24 01:08 github-actions[bot]

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

github-actions[bot] avatar Feb 21 '25 02:02 github-actions[bot]