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

SDL build error on Windows Github Actions #9

Closed
Yamakaky opened this issue Jul 30, 2021 · 4 comments
Closed

SDL build error on Windows Github Actions #9

Yamakaky opened this issue Jul 30, 2021 · 4 comments

Comments

@Yamakaky
Copy link

Yamakaky commented Jul 30, 2021

Failed windows build:

Run actions-rs/cargo@v1
  with:
    command: vcpkg
    args: build --manifest-path gyromouse/Cargo.toml
    use-cross: false
C:\Rust\.cargo\bin\cargo.exe vcpkg build --manifest-path gyromouse/Cargo.toml
     Cloning https://github.com/microsoft/vcpkg
    Checkout rev a267ab118c09f56f3dae96c9a4b3410820ad2f0b
   Compiling vcpkg
  Installing sdl2
-- stdout --

-- stderr --

cargo-vcpkg: failed
Error: The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 1

Failed windows build (verbose):

Run actions-rs/cargo@v1
C:\Rust\.cargo\bin\cargo.exe vcpkg --verbose build --manifest-path gyromouse/Cargo.toml
vcpkg root is D:\a\joy\joy\target\vcpkg
     Cloning https://github.com/microsoft/vcpkg
Cloning into 'D:\a\joy\joy\target\vcpkg'...
Updating files:  42% (3347/7887)
Updating files: 100% (7887/7887), done.
    Checkout rev a267ab118c09f56f3dae96c9a4b3410820ad2f0b
Note: switching to 'a267ab118c09f56f3dae96c9a4b3410820ad2f0b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at a267ab118 [ffmpeg] add -fPIC (#17298)
   Compiling vcpkg
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2021-02-24-d67989bce1043b98092ac45996a8230a059a2d7e/vcpkg.exe -> D:\a\joy\joy\target\vcpkg/vcpkg.exe
Done.

  Installing sdl2
Computing installation plan...
cargo-vcpkg: failed
Error: The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 1

No problem on linux and mac builds with same workflow: https://github.com/Yamakaky/joy/blob/master/.github/workflows/rust.yml. I don't have access to a windows computer so I'm not sure how to debug this, any idea? Does it look like a vcpkg bug?

@waych
Copy link
Collaborator

waych commented Jul 30, 2021

I tried pulling your branch and building, and at least cargo vcpkg --verbose build seems to pass on first try locally:

C:\Users\mike\Windows-Code\joy [master ≡]> cargo build --verbose build --manifest-path .\gyromouse\Cargo.toml
error: Found argument 'build' which wasn't expected, or isn't valid in this context

USAGE:
    cargo.exe build --verbose

For more information try --help
C:\Users\mike\Windows-Code\joy [master ≡]> cargo vcpkg --verbose build --manifest-path .\gyromouse\Cargo.toml
vcpkg root is C:\Users\mike\Windows-Code\joy\target\vcpkg
     Cloning https://github.com/microsoft/vcpkg
Cloning into 'C:\Users\mike\Windows-Code\joy\target\vcpkg'...
remote: Enumerating objects: 116782, done.
remote: Counting objects: 100% (337/337), done.
remote: Compressing objects: 100% (189/189), done.
remote: Total 116782 (delta 203), reused 232 (delta 148), pack-reused 116445
Receiving objects: 100% (116782/116782), 37.00 MiB | 11.70 MiB/s, done.
Resolving deltas: 100% (72531/72531), done.
Updating files: 100% (7887/7887), done.
    Checkout rev a267ab118c09f56f3dae96c9a4b3410820ad2f0b
Note: switching to 'a267ab118c09f56f3dae96c9a4b3410820ad2f0b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at a267ab118 [ffmpeg] add -fPIC (#17298)
   Compiling vcpkg
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2021-02-24-d67989bce1043b98092ac45996a8230a059a2d7e/vcpkg.exe -> C:\Users\mike\Windo
ws-Code\joy\target\vcpkg/vcpkg.exe
Done.

  Installing sdl2
Computing installation plan...
A suitable version of cmake was not found (required v3.19.2). Downloading portable cmake v3.19.2...
Downloading cmake...
  https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-win32-x86.zip -> C:\Users\mike\Windows-Code\joy\target\vcpkg\downloads\cmake-3.1
9.2-win32-x86.zip
Extracting cmake...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
  https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\Users\mike\Windows-Code\joy\target\vcpkg\downloads\7-zip.commandline.18.1.0.nupkg
Extracting 7zip...
A suitable version of nuget was not found (required v5.5.1). Downloading portable nuget v5.5.1...
Downloading nuget...
  https://dist.nuget.org/win-x86-commandline/v5.5.1/nuget.exe -> C:\Users\mike\Windows-Code\joy\target\vcpkg\downloads\22ea847d-nuget.exe
The following packages will be built and installed:
    sdl2[core]:x64-windows-static-md -> 2.0.14#4
Detecting compiler hash for triplet x64-windows-static-md...
Could not locate cached archive: C:\Users\mike\AppData\Local\vcpkg\archives\b6\b62a282fa0e5d683a2e2b6526ba3f94eaa096b50.zip
   Compiling sdl2 (triplet x64-windows-static-md)
Starting package 1/1: sdl2:x64-windows-static-md
Building package sdl2[core]:x64-windows-static-md...
-- Using community triplet x64-windows-static-md. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: C:\Users\mike\Windows-Code\joy\target\vcpkg\triplets\community\x64-windows-static-md.cmake
-- Downloading https://www.libsdl.org/release/SDL2-2.0.14.tar.gz -> SDL2-2.0.14.tar.gz...
-- Extracting source C:/Users/mike/Windows-Code/joy/target/vcpkg/downloads/SDL2-2.0.14.tar.gz
-- Applying patch 0001-sdl2-Enable-creation-of-pkg-cfg-file-on-windows.patch
-- Applying patch 0002-sdl2-skip-ibus-on-linux.patch
-- Applying patch 0003-sdl2-fix-uwp-build.patch
-- Applying patch 0004-sdl2-macos-thread-detection-fix.patch
-- Using source at C:/Users/mike/Windows-Code/joy/target/vcpkg/buildtrees/sdl2/src/SDL2-2-7c9b885cf4.clean
-- Found external ninja('1.10.2').
-- Configuring x64-windows-static-md
-- Building x64-windows-static-md-dbg
-- Building x64-windows-static-md-rel
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst -> msys-mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst..
.
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst -> msys-mingw-w64-i686-libwinpthread-git
-8.0.0.5906.c9a21571-1-any.pkg.tar.zst...
-- Using msys root at C:/Users/mike/Windows-Code/joy/target/vcpkg/downloads/tools/msys2/50864d9fae363d6e
-- Fixing pkgconfig file: C:/Users/mike/Windows-Code/joy/target/vcpkg/packages/sdl2_x64-windows-static-md/lib/pkgconfig/sdl2.pc
-- Fixing pkgconfig file: C:/Users/mike/Windows-Code/joy/target/vcpkg/packages/sdl2_x64-windows-static-md/debug/lib/pkgconfig/sdl2.pc
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\mike\AppData\Local\vcpkg\archives\b6\b62a282fa0e5d683a2e2b6526ba3f94eaa096b50.zip
Building package sdl2[core]:x64-windows-static-md... done
Installing package sdl2[core]:x64-windows-static-md...
Installing package sdl2[core]:x64-windows-static-md... done
Elapsed time for package sdl2:x64-windows-static-md: 21.96 s

Total elapsed time: 24.98 s

The package sdl2:x64-windows-static-md provides CMake targets:

    find_package(SDL2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE SDL2::SDL2main SDL2::SDL2-static)

    Finished in 58.62s

Could it be that the target in your actions/cache@v2 section is interfering with the build? ./target/vcpkg is where the vcpkg tree winds up by default and it may not like the cached artifacts it finds.

@waych
Copy link
Collaborator

waych commented Jul 30, 2021

Hmm noticed there is no cache hit in your CI. I think that rules that idea out. 🤔

@waych
Copy link
Collaborator

waych commented Jul 30, 2021

Hmm. I think something is wrong with vcpkg at that commit.

I tried instrumenting cargo-vcpkg to see if I could get more data out of the windows-latest workflow run, but couldn't find any more information as to why the underlying vcpkg.exe install is failing.

I tried updating the vcpkg pointer to top-of-tree as follows

--- a/gyromouse/Cargo.toml
+++ b/gyromouse/Cargo.toml
@@ -30,7 +30,7 @@ default-features = false
 [package.metadata.vcpkg]
 dependencies = ["sdl2"]
 git = "https://github.com/microsoft/vcpkg"
-rev = "a267ab118c09f56f3dae96c9a4b3410820ad2f0b"
+rev = "261c458af6e3eed5d099144aff95d2b5035f656b"

 [package.metadata.vcpkg.target]
 x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }

and now it seems to work 🤷‍♂️ ?

It was me that picked out that pointer (a267ab118) last for rust-sdl2, which is probably where it was copied from. It was arbitrarily the top-of-tree when I picked it that allowed that project to move past various link issues. Seemed to work fine for the CI testing, though I'm guessing something has changed in windows-latest (maybe the version of cmake installed?). Not quite sure.

Probably best to just update the pointer.

@Yamakaky
Copy link
Author

That was it, the latest commit fixes the problem. Thanks for the PR!

waych added a commit to waych/rust-sdl2 that referenced this issue Jul 31, 2021
Something happened that broke the `vcpkg.exe install` invocation for
sdl2 on Windows when using github actions with `windows-latest`.

I have not been able to determine what is actually causing the break,
however updating to a more recent version of vcpkg seems to have fixed
the issue, so that is what is proposed here.

The commit selected is current top of tree.

Original report: mcgoo/cargo-vcpkg#9
waych added a commit to waych/rust-sdl2 that referenced this issue Jul 31, 2021
Something happened that broke the `vcpkg.exe install` invocation for
sdl2 on Windows when using github actions with `windows-latest`.

I have not been able to determine what is actually causing the break,
however updating to a more recent version of vcpkg seems to have fixed
the issue, so that is what is proposed here.

The commit selected is current top of tree.

Original report: mcgoo/cargo-vcpkg#9
Cobrand pushed a commit to Rust-SDL2/rust-sdl2 that referenced this issue Aug 1, 2021
Something happened that broke the `vcpkg.exe install` invocation for
sdl2 on Windows when using github actions with `windows-latest`.

I have not been able to determine what is actually causing the break,
however updating to a more recent version of vcpkg seems to have fixed
the issue, so that is what is proposed here.

The commit selected is current top of tree.

Original report: mcgoo/cargo-vcpkg#9
sypwex pushed a commit to sypwex/rust-sdl2 that referenced this issue Jun 2, 2024
Something happened that broke the `vcpkg.exe install` invocation for
sdl2 on Windows when using github actions with `windows-latest`.

I have not been able to determine what is actually causing the break,
however updating to a more recent version of vcpkg seems to have fixed
the issue, so that is what is proposed here.

The commit selected is current top of tree.

Original report: mcgoo/cargo-vcpkg#9
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

2 participants