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

Issues when trying to use the action #179

Open
4JX opened this issue Jan 27, 2023 · 11 comments
Open

Issues when trying to use the action #179

4JX opened this issue Jan 27, 2023 · 11 comments
Labels
documentation Improvements or additions to documentation

Comments

@4JX
Copy link

4JX commented Jan 27, 2023

I want to use this action since it significantly cuts down the build times thanks to the caching, but I cannot seem to get it to work in place of manually calling vcpkg.

If I use the action, the build scripts of my dependencies cannot seem to find the installed packages
https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/3999069155

However, if I revert to manually using vcpkg they are found just fine.
https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4008777116

Reading the logs the most prominent difference would be the place vcpkg is installed, but I do not believe that to be the issue.

@lukka
Copy link
Owner

lukka commented Jan 27, 2023

@4JX i think you spot already the issue: run-vcpkg by default puts the installed directory using --x-install-root,/home/runner/work/L5P-Keyboard-RGB/b/vcpkg_installed, while your build is trying to pull them from the $VCPKG_ROOT/installed:

2023-01-24T18:08:31.0955971Z   cargo:rustc-link-search=/home/runner/work/L5P-Keyboard-RGB/L5P-Keyboard-RGB/vcpkg/installed/x64-linux/lib
2023-01-24T18:08:31.0956681Z   cargo:include=/home/runner/work/L5P-Keyboard-RGB/L5P-Keyboard-RGB/vcpkg/installed/x64-linux/include

You can either customize the installed directory location in run-vcpkg by modifying the value of the env var VCPKG_INSTALLED_DIR which is then used when running vcpkg (see https://github.com/lukka/run-vcpkg/blob/main/action.yml#L53).
Or you can instruct your build system to pull them from the <root>/b/vcpkg_installed directory.

Let me know if this helps.

@4JX
Copy link
Author

4JX commented Jan 29, 2023

i think you spot already the issue

I was thinking about where vcpkg itself is installed, as I assumed that it (in tandem with VCPKG_ROOT) would determine the location of the installed packages.

Should I be manually creating the installed directory?

I tried setting it as VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed but it fails with "invalid directory"
https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4038536445/jobs/6942641088#step:5:78

@lukka
Copy link
Owner

lukka commented Jan 30, 2023

@4JX thanks a lot for trying this out! In the last failing run the root cause of the failure is that a vcpkg.json file was not found, hence the action does not know what to do and fails.
Follow ups:

  • the action needs better error handling and user message.
  • could you try adding the vcpkg.json to your repo and run the workflow again. The run-vcpkg action will then run the action from the directory containing vcpkg.json.
  • I think it makes sense to add a workflow showing how to leverage vcpkg with cargo, i'd look into your project and create a minimal project to show how would this work. If you have any pointer let me know.

@lukka
Copy link
Owner

lukka commented Jan 30, 2023

@4JX Let me know if your workflow runs correctly. I plan to add a new workflow to validate your scenario ('cargo'+'vcpkg'), and to improve run-vcpkg error reporting as well. I added a basic workflow, all it needs to be added is that the rust code should reference and link symbols pulled from packages installed by vcpkg, you may contribute as well to add the missing pieces in a PR, thanks!

@4JX
Copy link
Author

4JX commented Jan 30, 2023

the root cause of the failure is that a vcpkg.json file was not found

Completely forgot about re-adding the file, compiles fine now!

Spoke too soon, the windows build had yet to make an attempt at recompiling while linking https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4067795449/jobs/7006243710.

Seems like vcpkg gets set up in D:\a\L5P-Keyboard-RGB\L5P-Keyboard-RGB\vcpkg while the build scrip tries to go through -L 'C:\vcpkg\installed\x64-windows-static\lib' -L 'C:\vcpkg\installed\x64-windows-static\lib' for some reason?

Magically worked again https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4087432025/jobs/7047932976 (while also linking to the downloaded deps in the correct directory specified by $VCPKG_ROOT), no idea why the other would've failed.

I added a basic workflow

[package.metadata.vcpkg.target] comes from a different tool, currently building a minimal example over at https://github.com/4JX/vcpkg-action-test

It seems to be mostly working, but when using run-vcpkg it fails on MacOS due to these lines, which search for files inside of (if I'm not mistaken) $VCPKG_ROOT/installed/vcpkg/updates.

Is it correct to assume that such a directory will exist? Manually using vcpkg update && vcpkg install vpx finishes correctly.

@lukka
Copy link
Owner

lukka commented Feb 6, 2023

@4JX it is great to see a sample for cargo+vcpkg! I'll look into it to make it working on macOS and let you know.
Let me know if everything works fine for you as well!

@lukka
Copy link
Owner

lukka commented Feb 6, 2023

@4JX the sample of using vcpkg+cargo with run-vcpkg is properly working, take a look to the tip of the main branch: https://github.com/lukka/vcpkg-action-test/tree/ab6dd1bf5a9c2571f16f80afddd06ede3b84c8c0

This is the workflow run: https://github.com/lukka/vcpkg-action-test/actions/runs/4100509958

I am looking forward to add the scenario to the set of validation tests of run-vcpkg, thanks for creating a small test case!

@4JX
Copy link
Author

4JX commented Feb 6, 2023

Great! Thanks for the support provided on getting this working.

@lukka
Copy link
Owner

lukka commented Apr 1, 2023

@4JX are you currently using run-vcpkg and cargo on GitHub workflows? If so, I think the libvpx build is broken for Windows, and wonder which vcpkg commit id are you currently using.
Last run worked for macos, failed for Wndows, and for some unkown reason for Linux wont start: https://github.com/lukka/vcpkg-action-test/actions/runs/4581758239/jobs/8091515087

@4JX
Copy link
Author

4JX commented Apr 19, 2023

Had that just happen, updating to a more recent commit (and using v11) seems to have fixed it
https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4746484205/jobs/8430188222#step:5:1 (Ignore the otherwise failed build, run-vcpkg worked just fine for the linux one)
https://github.com/4JX/L5P-Keyboard-RGB/actions/runs/4746596729/jobs/8430436744#step:5:1 (for windows)

@lukka lukka added the documentation Improvements or additions to documentation label Apr 30, 2023
@lukka
Copy link
Owner

lukka commented Apr 30, 2023

@4JX I think that I could reference your project as a sample that shows how to integrate vcpkg with cargo in the documentation of run-vcpkg.

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

No branches or pull requests

2 participants