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

When I don't want to use the vcpkg installation package, with:pkgs: "", but report an error? #14

Open
masx200 opened this issue May 5, 2023 · 13 comments

Comments

@masx200
Copy link

masx200 commented May 5, 2023

When I don't want to use the vcpkg to install package, with:pkgs: "", but report an error?
I intend to install package for other vcpkg manually.

@johnwason
Copy link
Owner

I have no idea what you are asking.

There is an issue that error messages may not be displayed due to the temporary file capturing output. It will be fixed sometime using tee when I have a chance.

@masx200
Copy link
Author

masx200 commented May 6, 2023

Run export VCPKG_DEFAULT_BINARY_CACHE=/Users/runner/work/leetcode-test/leetcode-test/vcpkg_cache
  export VCPKG_DEFAULT_BINARY_CACHE=/Users/runner/work/leetcode-test/leetcode-test/vcpkg_cache
  mkdir $VCPKG_DEFAULT_BINARY_CACHE
  "/Users/runner/work/leetcode-test/leetcode-test/vcpkg/vcpkg" install --dry-run --triplet    > vcpkg_dry_run.txt
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    VCPKG_ROOT: /Users/runner/work/leetcode-test/leetcode-test/vcpkg
Error: Process completed with exit code 1.

@masx200
Copy link
Author

masx200 commented May 6, 2023

- name: vcpkg-action

              uses: johnwason/vcpkg-action@v4
              with:
                   token: ${{ github.token }}
                   triplet: x64-osx-release
                   pkgs: ''
                   

@johnwason
Copy link
Owner

Can you try johnwason/vcpkg-action@master? It should print out an error message now.

@MangaD
Copy link

MangaD commented May 23, 2023

I have this exact same problem. The problem is that I previously used the vcpkg manifest file, but now I want to install the packages individually, while still keeping the vcpkg.json file in the project's root. vcpkg-action is picking this file and assuming manifest mode, thus giving an error. I only found out this was the case after doing what @johnwason instructed. The error is:

Mode                 LastWriteTime         Length Name                                                                 
----                 -------------         ------ ----                                                                 
d-----         5/22/2023  11:47 PM                vcpkg_cache                                                          
error: In manifest mode, `vcpkg install` does not support individual package arguments.
To install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.
See https://learn.microsoft.com/vcpkg/users/manifests for more information.
Using manifest file at D:\a\cpp-project-template\cpp-project-template\vcpkg.json.
example:
    vcpkg install --triplet x64-windows
Options:
  --allow-unsupported             Instead of erroring on an unsupported port, continue with a
                                  warning.
  --x-asset-sources=...           Add sources for asset caching. See 'vcpkg help assetcaching'.
  --binarysource=...              Add sources for binary caching. See 'vcpkg help binarycaching'.
  --x-buildtrees-root=...         (Experimental) Specify the buildtrees root directory.
  --clean-after-build             Clean buildtrees, packages and downloads after building each
                                  package.
  --clean-buildtrees-after-build  Clean buildtrees after building each package.
  --clean-downloads-after-build   Clean downloads after building each package.
  --clean-packages-after-build    Clean packages after building each package.
  --downloads-root=...            Specify the downloads root directory.
                                  (default: VCPKG_DOWNLOADS)
  --dry-run                       Do not actually build or install.
  --editable                      Disable source re-extraction and binary caching for libraries on
                                  the command line (classic mode)
  --enforce-port-checks           Fail install if a port has detected problems or attempts to use a
                                  deprecated feature
  --x-feature=...                 Additional feature from the top-level manifest to install
                                  (manifest mode).
  --head                          Install the libraries on the command line using the latest
                                  upstream sources (classic mode).
  --host-triplet=...              Specify the host architecture triplet. See 'vcpkg help triplet'.
                                  (default: 'VCPKG_DEFAULT_HOST_TRIPLET')
  --x-install-root=...            (Experimental) Specify the install root directory.
  --keep-going                    Continue installing packages on failure.
  --x-no-default-features         Don't install the default features from the top-level manifest
                                  (manifest mode).
  --no-downloads                  Do not download new sources.
  --no-print-usage                Don't print CMake usage information after install.
  --only-binarycaching            Fail if cached binaries are not available.
  --only-downloads                Make a best-effort attempt to download sources without building.
  --overlay-ports=...             Specify directories to be used when searching for ports.
                                  (also: 'VCPKG_OVERLAY_PORTS')
  --overlay-triplets=...          Specifiy directories containing triplets files.
                                  (also: 'VCPKG_OVERLAY_TRIPLETS')
  --x-packages-root=...           (Experimental) Specify the packages root directory.
  --recurse                       Allow removal of packages as part of installation.
  --triplet=...                   Specify the target architecture triplet. See 'vcpkg help triplet'.
                                  (default: 'VCPKG_DEFAULT_TRIPLET')
  --x-use-aria2                   Use aria2 to perform download tasks.
  --vcpkg-root=...                Specify the vcpkg root directory.
                                  (default: 'VCPKG_ROOT')
  --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.



Error: Process completed with exit code 1.

Is there any way to keep the file vcpkg.json and install the packages individually?

@johnwason
Copy link
Owner

@MangaD I think it is vcpkg itself picking up the manifest file rather than this action. Try adding
-DVCPKG_MANIFEST_MODE=OFF to your cmake command line.

@johnwason
Copy link
Owner

Also the manifest-dir must be removed from the action config.

@MangaD
Copy link

MangaD commented May 23, 2023

@johnwason I removed the manifest-dir entry and also tried to set it to the empty string. Both attempts failed. Adding -DVCPKG_MANIFEST_MODE=OFF to the cmake command line will not fix the issue because I only invoke cmake after this action runs. But perhaps I may try setting this as an environment variable and see if it works for vcpkg-action. I'll let you know soon after my current action runs. :)

@johnwason
Copy link
Owner

Can you link me to the workflow file and the action log?

@MangaD
Copy link

MangaD commented May 23, 2023

Sorry, I deleted the action as I'm rewriting history as I attempt to solve this problem. The workflow file is temporarily available here: https://github.com/MangaD/cpp-project-template/blob/main/.github/workflows/build-release.yml#L106

@johnwason
Copy link
Owner

I have recreated the problem... I will see if I can fix it.

@MangaD
Copy link

MangaD commented May 23, 2023

I just tried setting the environment variable VCPKG_MANIFEST_MODE: OFF for this step, but it did not work.

@johnwason
Copy link
Owner

https://github.com/microsoft/vcpkg-tool/blob/a179fecfc4b5c28cba267d9b3db65806c16973c8/src/vcpkg/vcpkgpaths.cpp#LL246C35-L246C35

It appears that vcpkg will search the parent directory tree for vcpkg.json, and there is no easy way to disable this behavior. My suggestion is you check out the source in a src directory instead of having it check out to the root directory. This way vcpkg won't find the vcpkg.json file. I have found checking out the source in a subdirectory helps with a lot of other issues. This is a very complicated example but it shows how I use a source subdirectory: https://github.com/robotraconteur/robotraconteur/blob/master/.github/workflows/main.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants