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 build applied to an already-installed port always prints: "Value was null" #13933

Closed
krismattheus opened this issue Oct 8, 2020 · 8 comments · Fixed by microsoft/vcpkg-tool#492
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof

Comments

@krismattheus
Copy link
Contributor

Describe the bug
When executing "vcpkg build" for any installed package, it immediately returns with "Value was null".
No error or context is shown.

Environment

  • OS: Windows 10 Pro x64 1909
  • Compiler: CMake 3.18.4
  • Vcpkg version 2020.06.15 (cloned on 8 oct 2020)

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install jsoncpp: builds OK
  2. ./vcpkg build jsoncpp
  3. The build command immediately returns with "Value was null".

Expected behavior
A new build starts.

Failure logs
.\vcpkg.exe build jsoncpp --debug
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'manifests' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Using vcpkg-root: D:\mosquitto_build_1.6.12\vcpkg
[DEBUG] Using installed-root: D:\mosquitto_build_1.6.12\vcpkg\installed
[DEBUG] Using buildtrees-root: D:\mosquitto_build_1.6.12\vcpkg\buildtrees
[DEBUG] Using downloads-root: D:\mosquitto_build_1.6.12\vcpkg\downloads
[DEBUG] Using packages-root: D:\mosquitto_build_1.6.12\vcpkg\packages
[DEBUG] Using scripts-root: D:\mosquitto_build_1.6.12\vcpkg\scripts
[DEBUG] Default binary cache path is: C:\Users\KMAT\AppData\Local\vcpkg\archives
[DEBUG] CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" --version)
[DEBUG] cmd_execute_and_stream_data() returned 0 after 33850 us
[DEBUG] CreateProcessW("C:\Program Files\CMake\bin\cmake.exe" -DVCPKG_ROOT_DIR=D:/mosquitto_build_1.6.12/vcpkg -DPACKAGES_DIR=D:/mosquitto_build_1.6.12/vcpkg/packages -DBUILDTREES_DIR=D:/mosquitto_build_1.6.12/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=D:/mosquitto_build_1.6.12/vcpkg/installed -DDOWNLOADS=D:/mosquitto_build_1.6.12/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P "D:\mosquitto_build_1.6.12\vcpkg\buildtrees\0.vcpkg_dep_info.cmake")
[DEBUG] cmd_execute_and_stream_data() returned 0 after 24453 us
Value was null
[DEBUG] D:\mosquitto_build_1.6.12\vcpkg\toolsrc\src\vcpkg\build.cpp(1065)
[DEBUG] Exiting after 98725 us (87780 us)

@JackBoosY JackBoosY self-assigned this Oct 9, 2020
@JackBoosY
Copy link
Contributor

We are trying to update cmake to 3.18 in PR #12612 now.

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

JackBoosY commented Apr 8, 2022

I can confirm this issue is still exists.

@JackBoosY
Copy link
Contributor

https://github.com/microsoft/vcpkg-tool/blob/48be135568c3930571adb03ff1632b8c159c2787/src/vcpkg/build.cpp#L193-L199:

        for (auto& install_action : action_plan.already_installed)
        {
            if (install_action.spec == full_spec.package_spec)
            {
                action = &install_action;
            }
        }

action_plan.already_installed[*].source_control_file_and_location is a null ptr, caused this issue.

@BillyONeal
Copy link
Member

Does not repro for me :(

@BillyONeal
Copy link
Member

PS C:\Dev\vcpkg> .\bootstrap-vcpkg.bat
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2022-03-30/vcpkg.exe -> C:\Dev\vcpkg\vcpkg.exe... done.
Validating signature... done.

Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.

Read more about vcpkg telemetry at docs/about/privacy.md
PS C:\Dev\vcpkg> .\vcpkg.exe depend-info jsoncpp
vcpkg-cmake:
vcpkg-cmake-config:
jsoncpp: vcpkg-cmake, vcpkg-cmake-config
PS C:\Dev\vcpkg> .\vcpkg.exe install vcpkg-cmake vcpkg-cmake-config
Computing installation plan...
The following packages will be built and installed:
    vcpkg-cmake[core]:x86-windows -> 2022-04-05
    vcpkg-cmake-config[core]:x86-windows -> 2022-02-06
Detecting compiler hash for triplet x86-windows...
Restored 0 packages from C:\Users\billy\AppData\Local\vcpkg\archives in 527.9 us. Use --debug to see more details.
Starting package 1/2: vcpkg-cmake:x86-windows
Building package vcpkg-cmake[core]:x86-windows...
CMake Warning at ports/vcpkg-cmake/portfile.cmake:3 (message):
  vcpkg-cmake is a host-only port; please mark it as a host port in your
  dependencies.
Call Stack (most recent call first):
  scripts/ports.cmake:145 (include)


-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/vcpkg_cmake_get_vars.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/cmake_get_vars
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/cmake_get_vars/CMakeLists.txt
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x86-windows/share/vcpkg-cmake/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\billy\AppData\Local\vcpkg\archives\da\da839c0606ac65eee166792e2049106dba6fe94aa603742c422d1a70e1a6503a.zip
Installing package vcpkg-cmake[core]:x86-windows...
Elapsed time for package vcpkg-cmake:x86-windows: 144.2 ms
Starting package 2/2: vcpkg-cmake-config:x86-windows
Building package vcpkg-cmake-config[core]:x86-windows...
CMake Warning at ports/vcpkg-cmake-config/portfile.cmake:3 (message):
  vcpkg-cmake-config is a host-only port; please mark it as a host port in
  your dependencies.
Call Stack (most recent call first):
  scripts/ports.cmake:145 (include)


-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x86-windows/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x86-windows/share/vcpkg-cmake-config/vcpkg-port-config.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x86-windows/share/vcpkg-cmake-config/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\billy\AppData\Local\vcpkg\archives\dc\dca8af28a2a6e02d91b7aaaf4654bca2594e2b307ed96471d1ab7e26208f28b2.zip
Installing package vcpkg-cmake-config[core]:x86-windows...
Elapsed time for package vcpkg-cmake-config:x86-windows: 112.5 ms

Total elapsed time: 4.168 s

PS C:\Dev\vcpkg> .\vcpkg.exe build jsoncpp
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Elapsed time for package jsoncpp:x86-windows: 7.4 us
The build command requires all dependencies to be already installed.
The following dependencies are missing:

    vcpkg-cmake[core]:x64-windows
    vcpkg-cmake-config[core]:x64-windows

PS C:\Dev\vcpkg> .\vcpkg.exe install vcpkg-cmake vcpkg-cmake-config --triplet:x64-windows
Unknown option(s) for command 'install':
    '--triplet:x64-windows'

Example:
  vcpkg install zlib zlib:x64-windows curl boost

Options:
  --dry-run                       Do not actually build or install
  --head                          Install the libraries on the command line using the latest
                                  upstream sources (classic mode)
  --no-downloads                  Do not download new sources
  --only-downloads                Download sources but don't build packages
  --only-binarycaching            Fail if cached binaries are not available
  --recurse                       Allow removal of packages as part of installation
  --keep-going                    Continue installing packages on failure
  --editable                      Disable source re-extraction and binary caching for libraries on
                                  the command line (classic mode)
  --x-use-aria2                   Use aria2 to perform download tasks
  --clean-after-build             Clean buildtrees, packages and downloads after building each
                                  package
  --clean-buildtrees-after-build  Clean buildtrees after building each package
  --clean-packages-after-build    Clean packages after building each package
  --clean-downloads-after-build   Clean downloads after building each package
  --x-no-default-features         Don't install the default features from the top-level manifest
                                  (manifest mode).
  --enforce-port-checks           Fail install if a port has detected problems or attempts to use a
                                  deprecated feature
  --allow-unsupported             Instead of erroring on an unsupported port, continue with a
                                  warning.
  --x-write-nuget-packages-config=...
                                  Writes out a NuGet packages.config-formatted file for use with
                                  external binary caching.
                                  See `vcpkg help binarycaching` for more information.
  --x-feature=...                 Additional feature from the top-level manifest to install
                                  (manifest mode).
  --triplet=<t>                   Specify the target architecture triplet. See 'vcpkg help triplet'
                                  (default: %VCPKG_DEFAULT_TRIPLET%)
  --host-triplet=<t>              Specify the host architecture triplet. See 'vcpkg help triplet'
                                  (default: %VCPKG_DEFAULT_HOST_TRIPLET%)
  --overlay-ports=<path>          Specify directories to be used when searching for ports
                                  (also: %VCPKG_OVERLAY_PORTS%)
  --overlay-triplets=<path>       Specify directories containing triplets files
                                  (also: %VCPKG_OVERLAY_TRIPLETS%)
  --binarysource=<path>           Add sources for binary caching. See 'vcpkg help binarycaching'
  --x-asset-sources=<path>        Add sources for asset caching. See 'vcpkg help assetcaching'
  --downloads-root=<path>         Specify the downloads root directory
                                  (default: %VCPKG_DOWNLOADS%)
  --vcpkg-root=<path>             Specify the vcpkg root directory
                                  (default: %VCPKG_ROOT%)
  --x-buildtrees-root=<path>      (Experimental) Specify the buildtrees root directory
  --x-install-root=<path>         (Experimental) Specify the install root directory
  --x-packages-root=<path>        (Experimental) Specify the packages root directory
  --x-json                        (Experimental) Request JSON output
PS C:\Dev\vcpkg> .\vcpkg.exe install vcpkg-cmake vcpkg-cmake-config --triplet x64-windows
Computing installation plan...
The following packages will be built and installed:
    vcpkg-cmake[core]:x64-windows -> 2022-04-05
    vcpkg-cmake-config[core]:x64-windows -> 2022-02-06
Detecting compiler hash for triplet x64-windows...
Restored 0 packages from C:\Users\billy\AppData\Local\vcpkg\archives in 697.8 us. Use --debug to see more details.
Starting package 1/2: vcpkg-cmake:x64-windows
Building package vcpkg-cmake[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_get_vars.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/cmake_get_vars
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/cmake_get_vars/CMakeLists.txt
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\billy\AppData\Local\vcpkg\archives\fe\fe8e7b4c9a1023e9048efa59e98b02ce7c59f42b130b503bc3a081d48833854f.zip
Installing package vcpkg-cmake[core]:x64-windows...
Elapsed time for package vcpkg-cmake:x64-windows: 135.2 ms
Starting package 2/2: vcpkg-cmake-config:x64-windows
Building package vcpkg-cmake-config[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg-port-config.cmake
-- Installing: C:/Dev/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\billy\AppData\Local\vcpkg\archives\40\40c16026a4a11012c59b0179ffc5562088e5112868269e7178ee225c189b0bea.zip
Installing package vcpkg-cmake-config[core]:x64-windows...
Elapsed time for package vcpkg-cmake-config:x64-windows: 120.3 ms

Total elapsed time: 2.798 s

PS C:\Dev\vcpkg> .\vcpkg.exe build jsoncpp
Detecting compiler hash for triplet x86-windows...
-- Using cached open-source-parsers-jsoncpp-1.9.5.tar.gz.
-- Extracting source C:/Dev/vcpkg-downloads/open-source-parsers-jsoncpp-1.9.5.tar.gz
-- Using source at C:/Dev/vcpkg/buildtrees/jsoncpp/src/1.9.5-13b47286ba
-- Found external ninja('1.10.2').
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: C:/Dev/vcpkg/packages/jsoncpp_x86-windows/share/jsoncpp/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\billy\AppData\Local\vcpkg\archives\92\928249896cc3aab0626be9f77c283c6c9a12f961bc9c99295bc742b4f9d075d4.zip
Elapsed time for package jsoncpp:x86-windows: 9.637 s
PS C:\Dev\vcpkg>

@BillyONeal
Copy link
Member

Oh I missed the 'already installed' condition.

@BillyONeal BillyONeal changed the title vcpkg build always returns: "Value was null" vcpkg build applied to an already-installed port always prints: "Value was null" Apr 8, 2022
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Apr 8, 2022
Resolves microsoft/vcpkg#13933

Rather than attempting to deal with the condition that the plan created thinks the thing we want to build is already installed, this version just "removes" the thing we want to build from the in-memory status database before creating the plan.
@BillyONeal BillyONeal added the requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof label Apr 12, 2022
@BillyONeal BillyONeal reopened this Apr 12, 2022
@BillyONeal BillyONeal reopened this Apr 12, 2022
@BillyONeal
Copy link
Member

Careful @JackBoosY :D

@BillyONeal
Copy link
Member

Fixed by #24526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants