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 failing to build library #180

Closed
TheMaverickProgrammer opened this issue Feb 6, 2023 · 17 comments
Closed

VCPKG failing to build library #180

TheMaverickProgrammer opened this issue Feb 6, 2023 · 17 comments

Comments

@TheMaverickProgrammer
Copy link

I hope this is the right place. I don't have any issues using vcpkg + cmake on any of my desktops (win + linux) but with run-vcpkg action, I am getting the following issue:

   Running 'vcpkg install,--recurse,--clean-after-build,--x-install-root,/home/runner/work/Client/Client/vcpkg/installed,--triplet,x64-linux' in directory '/home/runner/work/Client/Client' ...
  Running command '/home/runner/work/Client/Client/vcpkg/vcpkg' with args 'install,--recurse,--clean-after-build,--x-install-root,/home/runner/work/Client/Client/vcpkg/installed,--triplet,x64-linux' in current directory '/home/runner/work/Client/Client'.
  Error: discord-game-sdk:x64-linux@2.5.6#4 is only supported on '((x64 & (windows | osx | linux)) | (x86 & windows)) & !uwp & !static'

As you can see, the tuple is correctly selecting x64-linux for this library. I can build on archlinux and ubuntu just fine manually but not on github with this action module.

Here's my vcpkg.json file:

{
  "name": "my-client",
  "version-string": "1.0.0",
  "dependencies": [
    {
      "name": "pthreads",
      "version>=": "3.0.0#10"
    },
    {
      "name": "poco",
      "version>=": "1.11.1"
    },
    {
      "name": "openssl",
      "version>=": "1.1.1n#1"
    },
    {
      "name": "fluidsynth",
      "version>=": "2.2.6"
    },
    {
      "name": "lua",
      "version>=": "5.4.4#1"
    },
    {
      "name": "discord-game-sdk",
      "version>=": "2.5.6#4"
    }
  ],
  "builtin-baseline": "91dd61bd441a68b4017b61011d0350b2e6aeeccf"
}

And here's the run step where I include the action:

    - name: run-vcpkg
      # You may pin to the exact commit or the version.
      # uses: lukka/run-vcpkg@97a66cd144358612fab189bf2836619f392ef083
      uses: lukka/run-vcpkg@v10.7
      with:
        vcpkgDirectory: ${{ github.workspace }}/vcpkg
        # Run the installation of package by running `vcpkg install` on the directory of the discovered 'vcpkg.json' file. Default is false.
        runVcpkgInstall: true
        vcpkgGitCommitId: 91dd61bd441a68b4017b61011d0350b2e6aeeccf
        # Specify the URL Git repository to download vcpkg from
        vcpkgGitURL: https://github.com/microsoft/vcpkg.git
        # Avoid to update vcpkg (launching git) in the specified 'vcpkgDirectory'. This is useful when vcpkg is being checkout independently of the run-vcpkg action. Default is false.
        # doNotUpdateVcpkg: # optional
        # Disable the automatic caching mechanism by setting it to true. Default is false.
        # doNotCache: # optional
        # Specify the glob expression used to discover the vcpkg.json whose content's hash is added to the cache key. On Windows runners using `github.workspace` context to form the expression would not work as expected since it contains backslashes. Use instead `**/path/to/vcpkg.json` to match the desired `vcpkg.json` file.
        vcpkgJsonGlob: '**/vcpkg.json'

Is there an explicit "dynamic/static" setting I was supposed to provide somewhere? It seems odd that the tuple is matching the reported constraints and I can build fine with the same vcpkg on all my machines.

@lukka
Copy link
Owner

lukka commented Feb 7, 2023

@TheMaverickProgrammer thanks for reporting this issue. There is nothing wrong with how the action is being used, and if it is working for your on your local computer, it should be working on GH runner as well, although there may be some subtle difference that triggers this error.

If you are using GitHub hosted runners, I'd try to reproduce the problem on a Linux machine that is based on the exact same environment provided by the GH Image runners: https://github.com/actions/runner-images#available-images

If you can provide the content of the log of a workflow where this fail, it may be helpful to get more info.

@quyykk
Copy link

quyykk commented Feb 12, 2023

It seems odd that the tuple is matching the reported constraints

It does not! x64-linux is a static triplet, unlike x64-windows. Use x64-linux-dynamic instead. I don't know what you're doing locally, but you're probably using the dynamic triplet instead.

@TheMaverickProgrammer
Copy link
Author

TheMaverickProgrammer commented Feb 12, 2023

@quyykk

It does not! x64-linux is a static triplet, unlike x64-windows. Use x64-linux-dynamic instead. I don't know what you're doing locally, but you're probably using the dynamic triplet instead.

image

This is a first. I don't recall ever explicitly asking vcpkg for dynamic packages for as long as I've used it. Is the behavior different on windows versus linux? (Win defaults to dynamic, linux defaults to static?)

Yes even here in my windows folder, all of my vcpkg tuples show up as DLLs so this seems exceptional with the tuple's behavior on the two different OS.

image

@quyykk
Copy link

quyykk commented Feb 12, 2023

Yes, Windows defaults to dynamic, and MacOS and Linux default to static.

@TheMaverickProgrammer
Copy link
Author

That's awful!! I will try the static tuple on linux and report back and close the ticket if it fixes it then. I'm upset with vcpkg standardization.

@quyykk
Copy link

quyykk commented Feb 12, 2023

I will try the static tuple on linux and report back and close the ticket if it fixes it then

You mean dynamic?

@TheMaverickProgrammer
Copy link
Author

Haha yes I mean dynamic. :)

@TheMaverickProgrammer
Copy link
Author

TheMaverickProgrammer commented Feb 13, 2023

It will be a little while longer before I am able to confirm this is the issue on github workflow: see here

I use vcpkg.json for the heavy lifting of installing the packages I need and for some reason microsoft does not support specific triplets in this config file. It's an all-or-nothing approach (based on whatever the architecture was detected at the time of launch).

@quyykk
Copy link

quyykk commented Feb 13, 2023

Have a look at the quick start code of this repo (in the README). At the end it shows how to change the triplet used.

@TheMaverickProgrammer
Copy link
Author

Have a look at the quick start code of this repo (in the README). At the end it shows how to change the triplet used.

I don't see it:
https://github.com/lukka/CppCMakeVcpkgTemplate/blob/main/vcpkg.json

I checked the rest of the README and at the bottom it shows the triplet matrix -- which IIRC is used for all packages on a per platform-basis.

I don't need to change the triplet for all of my packages, just one package specifically to use the -static variant when on Ubuntu. And I don't want all of my packages to be static either.

@quyykk
Copy link

quyykk commented Feb 19, 2023

I don't need to change the triplet for all of my packages, just one package specifically to use the -static variant when on Ubuntu. And I don't want all of my packages to be static either.

You'll need to write a custom triplet then, see this link.

@TheMaverickProgrammer
Copy link
Author

I don't need to change the triplet for all of my packages, just one package specifically to use the -static variant when on Ubuntu. And I don't want all of my packages to be static either.

You'll need to write a custom triplet then, see this link.

That is absolutely horrific. Thanks for the link. I was expecting a vpkg optional switch flag or something. Is there no other alternative?

@lukka
Copy link
Owner

lukka commented Mar 31, 2023

@TheMaverickProgrammer If I understood correctly the issue is related to vcpkg itself, could you please ask support to the vcpkg's team by creating a new vcpkg issue?

@lukka
Copy link
Owner

lukka commented Apr 3, 2023

@TheMaverickProgrammer closing this issue as not related to something run-vcpkg can help with.

@lukka lukka closed this as completed Apr 3, 2023
@netcorefan1
Copy link

I'm also trying to understand what the correct way to achieve this. Unless I misunderstood, it should be done through expressions, but it is not working.

@lukka
Copy link
Owner

lukka commented Apr 4, 2023

@netcorefan1 hopefully the instructions they provided on the vcpkg issue list is helpful, let us know if we can improve the docs on run-vcpkg as well.

@TheMaverickProgrammer
Copy link
Author

@netcorefan1 hopefully the instructions they provided on the vcpkg issue list is helpful, let us know if we can improve the docs on run-vcpkg as well.

lol it definitely does not. Our only option is to write our own port.

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

4 participants