Manifests should install dependencies earlier in build process, before the CustomBuild
target
#21601
Replies: 4 comments
-
@vicroms, could you help double confirm? |
Beta Was this translation helpful? Give feedback.
-
A little bit related if you have thoughts on this as well: #20846 (It would be really nice if |
Beta Was this translation helpful? Give feedback.
-
I think this is the same issue as #20884. |
Beta Was this translation helpful? Give feedback.
-
Investigating the bug filed by @dahubley made me realize my initial proposed fix is no good. I'm updating my report above with more details. Even after the issue with my original fix is corrected, using |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Manifests should install dependencies before the
CustomBuild
target because their failure to do so means custom build tool items in a project cannot reliably usevcpkg
installed dependencies.This bug/issue is motivated by tools such as
grpc
andprotobuf
, which provide code generation tools to generate.h
,.cpp
.,.py
files and more. A typical way to use them is to add a.proto
file to your project and provide a custom build action that invokesprotoc.exe
or one of thegrpc
tools, generating files that are also part of the project.grpc
andprotobuf
are both ports invcpkg
, sovcpkg
is a natural way to obtain them. Then the custom build action can just point to their tools in thevcpkg
installed directory, e.g.,"$(_ZVcpkgCurrentInstalledDir)tools\protobuf\protoc.exe"
The problem comes when using manifest mode. The targets in
vcpkg.targets
are specified withBeforeTargets=ClCompile
, which means that the manifest dependencies are installed after any files with custom build tools specified are processed. That is, in a clean setup wherevcpkg
has not installed anything, a.proto
file will fail to be processed by theprotobuf
orgrpc
tools that are specified, because those tools do not have a chance to be installed until after the.proto
file is compiledSimply changing
VcpkgInstallManifestDependencies
andVcpkgTripletSelection
invcpkg.targets
to haveBeforeTargets="CustomBuild"
BeforeTargets="CustomBuild;ClCompile"
addresses the issue. Note: I updated from the strikethrough to include bothClCompile
andCustomBuild
, since not specifyingClCompile
breaks the most common usage :-P . But even this isn't great, as it doesn't cover other build actions, e.g.,CudaBuild
as hit by @dahubley in #20884 .Is there any reason to not make this change in
vcpkg.targets
? I'm happy to submit the PR, but I'm not an expert in msbuild and the targets, so I'm not 100% sure that won't have any side effects.Environment
To Reproduce
Steps to reproduce the behavior:
vcpkg
and run.\bootstrap_vcpkg.bat
, and then.\vcpkg.exe integrate install
vcpkg_installed\x86-windows\...
hierarchy next tovcpkg.json
or any mention in the compile output aboutvcpkg
installing dependencies. This is the bug/issue - because custom build tool items don't causevcpkg
dependencies to install, they can't reliably use them.Expected behavior
Install manifest dependencies before any custom build items run
Failure logs
N/A
Additional context
N/A
Beta Was this translation helpful? Give feedback.
All reactions