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

Can't make "Visual Studio build" install listed dependencies in vcpkg.json using manifest mode in Azure DevOps #32681

Closed
amasciotta opened this issue Jul 21, 2023 · 5 comments
Assignees
Labels
category:question This issue is a question

Comments

@amasciotta
Copy link

amasciotta commented Jul 21, 2023

I have a fairly simple VS 2022 solution, which uses vcpkg in manifest mode. I can build locally without issues, but I can’t make my Azure DevOps pipeline to install the dependencies listed in the vcpkg.json file.

I'm building using VS2022 and the windows-2022 image on Azure DevOps on a hosted agent.

Here is my azure-pipelines.yaml

trigger:
- master

pool:
  vmImage: windows-2022

steps:

- checkout: self
  submodules: recursive

- task: NuGetCommand@2
  displayName: 'Restore of NuGet packages'
  inputs:
    command: 'restore'
    restoreSolution: 'AD.Diva.sln'

- task: VSBuild@1
  displayName: 'Build AD.Diva'
  inputs:
    solution: 'AD.Diva.sln'
    vsVersion: '17.0'
    msbuildArgs: '-verbosity:diag'
    platform: 'x64'
    configuration: 'Release'
    msbuildArchitecture: 'x64'

- task: CopyFiles@2
  displayName: 'Copy .artifactignore to the target directory'
  inputs:
    Contents: '.artifactignore'
    TargetFolder: 'x64\Release'

- task: PublishPipelineArtifact@1
  displayName: 'Publish AD.Diva'
  inputs:
    targetPath: 'x64\Release'
    artifact: 'AD.Diva'
    publishLocation: 'pipeline'

The build fails because it can’t find the includes that should have been installed by vcpkg. What is happening is that the build step simply does not install the required dependencies listed in the vcpkg.json file. Here is the log of the failing job.

PrepareForBuild:
  Creating directory "x64\Release\".
  Creating directory "x64\Release\AD. BEMStub.tlog\".
InitializeBuildStatus:
  Creating "x64\Release\AD. BEMStub.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\CL.exe /c /I.. /BEM.MT_AD. Common/include /Zi /nologo /W4 /WX- /diagnostics:column /sdl /MP /O2 /Oi /GL /D _WIN32_WINNT=0x0A00 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /std:c++20 /permissive- /Fo"x64\Release\\" /Fd"x64\Release\vc143.pdb" /external:W4 /Gd /TP /FC /errorReport: queue main.cpp Receiver.cpp
  main.cpp
  Receiver.cpp
##[error]AD. BEMStub\Receiver.h(8,10): Error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file main.cpp)
D:\a\1\s\AD. BEMStub\Receiver.h(8,10): fatal  error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file main.cpp) [D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj]
##[error]AD. BEMStub\Receiver.h(8,10): Error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file Receiver.cpp)
D:\a\1\s\AD. BEMStub\Receiver.h(8,10): fatal  error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file Receiver.cpp) [D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj]
Done Building Project "D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\a\1\s\AD. Diva.sln" (default targets) -- FAILED.

Build FAILED.

"D:\a\1\s\AD. Diva.sln" (default target) (1) ->
"D:\a\1\s\AD. Diva\AD. Diva.vcxproj" (default target) (2) ->
"D:\a\1\s\AD. Diva.Library\AD. Diva.Library.vcxproj" (default target) (3) ->
(ClCompile target) -> 
  D:\a\1\s\AD. Diva.Library\src\Settings.cpp(2,10): fatal  error C1083: Cannot open include file: 'toml.hpp': No such file or directory [D:\a\1\s\AD. Diva.Library\AD. Diva.Library.vcxproj]
  D:\a\1\s\AD. Diva.Library\src\ConcreteLoggers.cpp(3,10): fatal  error C1083: Cannot open include file: 'colorconsole.hpp': No such file or directory [D:\a\1\s\AD. Diva.Library\AD. Diva.Library.vcxproj]

"D:\a\1\s\AD. Diva.sln" (default target) (1) ->
"D:\a\1\s\AD. Diva.Sandbox\AD. Diva.Sandbox.vcxproj" (default target) (5) ->
  D:\a\1\s\AD. Diva.Sandbox\src\Info.cpp(3,10): fatal  error C1083: Cannot open include file: 'magic_enum.hpp': No such file or directory [D:\a\1\s\AD. Diva.Sandbox\AD. Diva.Sandbox.vcxproj]
  D:\a\1\s\AD. Diva.Sandbox\src\main.cpp(5,10): fatal  error C1083: Cannot open include file: 'AudioFile.h': No such file or directory [D:\a\1\s\AD. Diva.Sandbox\AD. Diva.Sandbox.vcxproj]

"D:\a\1\s\AD. Diva.sln" (default target) (1) ->
"D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj" (default target) (7) ->
  D:\a\1\s\AD. BEMStub\Receiver.h(8,10): fatal  error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file main.cpp) [D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj]
  D:\a\1\s\AD. BEMStub\Receiver.h(8,10): fatal  error C1083: Cannot open include file: 'asio.hpp': No such file or directory (compiling source file Receiver.cpp) [D:\a\1\s\AD. BEMStub\AD. BEMStub.vcxproj]

0 Warning(s)
    6 Error(s)

Time Elapsed 00:03:24.29

The projects in the solution all share the following vcpkg settings:

Immagine

The vcpkg.json file is very simple:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
  "name": "ad-diva",
  "version": "0.0.1",
  "dependencies": [
    "color-console",
    "audiofile",
    "toml11",
    "asio"
  ]
}

I've also tried to run msbuild on a new clone of my repo inside a clean machine with only VS2022 and vcpkg, and everything works as expected: in the first steps of the build process, msbuild installs the required vcpkg dependencies and then the build goes on with no issues.

What am I missing here?

@jimwang118 jimwang118 self-assigned this Jul 21, 2023
@jimwang118 jimwang118 added the category:port-bug The issue is with a library, which is something the port should already support label Jul 21, 2023
@jimwang118
Copy link
Contributor

  1. When vs uses vcpkg in manifest mode, you need to restart vs and reopen your own project. This is a known bug and we will fix it in a future release.
  2. You need to confirm whether the corresponding port in the vcpkg_installed directory under the project directory is installed.
    If you have any other questions, please let me know in time.

@jimwang118 jimwang118 added category:question This issue is a question and removed category:port-bug The issue is with a library, which is something the port should already support labels Jul 24, 2023
@amasciotta
Copy link
Author

The problem occurs in Azure DevOps: locally everything works fine! I can't restart/reopen my project, nor I can check the vcpkg_intsalled directory on the build machine, since I'm using a hosted build agent.

@github-actions
Copy link

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

@ras0219-msft
Copy link
Contributor

This looks like vcpkg may not be integrated into MSBuild on the hosted agent. Can you try adding a vcpkg integrate install step before your build?

@jimwang118
Copy link
Contributor

Thanks for posting this issue. Please reopen this issue if this is still a problem for you.

@jimwang118 jimwang118 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

3 participants