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

Loosen dependency contraints #1963

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Loosen dependency contraints #1963

wants to merge 9 commits into from

Conversation

n8henrie
Copy link
Contributor

@n8henrie n8henrie commented May 4, 2024

Loosen dependency contraints to allow API-compatible dependency updates, update
Cargo.lock accordingly

Update Cargo.lock with new constraints. This should allow several crates
to update and make it easier for use to update major versions of several
dependencies.

See also: espanso#1825
@n8henrie
Copy link
Contributor Author

n8henrie commented May 4, 2024

There are several stragglers I can add to this PR as well, assuming the tests pass (locally was hanging on tests::ipc_multiple_clients).

@AucaCoyan
Copy link
Member

Great! This looks promising. I merged the clippy fixes and skipped that test it's causing you problems. In my machine took longer than a couple of minutes (4-5?), so probably something is going south when cargo tries to run that specific test.
Try merging dev again and see if you have better results 💯

@n8henrie
Copy link
Contributor Author

n8henrie commented May 5, 2024

I should have mentioned but I am able to recreate Cargo.lock without any trouble here (#1953). Just rm Cargo.lock, cargo clean, then cargo build and Bob's your uncle.

@AucaCoyan
Copy link
Member

Oh (click soud) nice!
CI is acting weird, I think every machine is downloading different versions of the crates, and that collides with the code we were using (chrono, for example).
Is it possible to you to make the CI green? Watch out this line. You can delete that if it's causing trouble, and then we re-add it (compile times lasts aeons)

@AucaCoyan
Copy link
Member

Hi! Just as another comment, you can check my pr trying this same steps of updating chrono and the like here #1872

@n8henrie
Copy link
Contributor Author

n8henrie commented May 5, 2024

Looks like most of the failures were just a clippy lint. Not sure what's up with Windows though.

@AucaCoyan
Copy link
Member

...
 Compiling espanso v2.2.1 (D:\a\espanso\espanso\espanso)
error: linking with `link.exe` failed: exit code: 1169
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" 
...
   = note: wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipAlloc already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCloneImage already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateBitmapFromFile already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateBitmapFromFileICM already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipCreateHBITMAPFromBitmap already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipDisposeImage already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdipFree already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdiplusShutdown already defined in windows.0.52.0.lib(gdiplus.dll)
          wxmsw31u_core.lib(corelib_gdiplus.obj) : error LNK2005: GdiplusStartup already defined in windows.0.52.0.lib(gdiplus.dll)
          D:\a\espanso\espanso\target\debug\deps\espanso.exe : fatal error LNK1169: one or more multiply defined symbols found
          

error: could not compile `espanso` (bin "espanso") due to 1 previous error

Oh damn. I hitted this error many times, and I don't have any idea why it happens. The log says that it can't link the librearies, or it doesn't find the linker (link.exe). I mildly assume that is something related to the C++ code, in which I have totally null experience 😢
I asked Federico once, and he didn't had a solution for this error

@n8henrie
Copy link
Contributor Author

The find_tool function from the cc crate doesn't seem to be working in CI / GitHub Actions, at least on newer versions.

@n8henrie
Copy link
Contributor Author

cc >= 1.0.84 requires a full target (including arch): rust-lang/cc-rs#1071

@n8henrie
Copy link
Contributor Author

I hitted this error many times, and I don't have any idea why it happens.

@AucaCoyan It looks like @federico-terzi may have used the avoid-gdi to work around this issue:

$ git log --grep gdiplus
commit 04720212e571e7f1e22a4f9587a1bb9fd3d73e3a
Author: Federico Terzi <federico-terzi@users.noreply.github.com>
Date:   Fri May 21 22:00:02 2021 +0200

    feat(ui): add feature to avoid double linking gdiplus

commit ccb3e11d9329d17583a3d30b1849b9675d11f995
Author: Federico Terzi <federico-terzi@users.noreply.github.com>
Date:   Fri May 21 21:59:29 2021 +0200

    feat(clipboard): add feature to avoid double linking gdiplus

@AucaCoyan
Copy link
Member

It had never occurred to me we could grep the issue in git history. Thank you for that TIL!
I'm on the phone now, but later I would like to what changes introduced those 2 commits and if they are necessary again in these new deps.

Great work here!

@n8henrie
Copy link
Contributor Author

Just checking in -- still have this on my mind, but still unclear on how to fix the windows gdiplus linking issues.

@n8henrie
Copy link
Contributor Author

Even prior to this PR, we've known that some dependency is breaking windows if we run cargo update (even without bumping any version number in Cargo.toml: #1953

To try to flesh this out, I ran the script below, which starts from a working Cargo.lock and then:

  1. runs cargo update --dry-run and filters for any dependencies that would have been updated
  2. updates each of the deps individually (cargo update depname)
  3. makes a commit including the name of the updated dependency
  4. pushes to GitHub to try to build for windows in CI
  5. resets back to the working Cargo.lock
  6. continues with the next dependency
#!/usr/bin/env bash

set -x

main() {
  while read -r dep; do
    git reset --hard c25d419d8fd233751dfa6f97d4385afe78febb98
    cargo update "${dep}"
    git add Cargo.lock
    git commit -m "Update ${dep}"
    git push --force-with-lease
  done < <(cargo update --dry-run |& awk '/Updating/ && /->/ { print $2 }')
}
main "$@"

You can see my pages of results at: https://github.com/n8henrie/espanso/actions/workflows/ci.yml

Unfortunately it's not immediately obvious how to tie a specific workflow run back to the culprit commit, but some work with the (authenticated) gh CLI tool helps:

$ gh api --paginate  -H "Accept: application/vnd.github+json"   -H "X-GitHub-Api-Version: 2022-11-28"   /repos/n8henrie/espanso/actions/workflows/ci.yml/runs

I'll need to jq through this a bit to see if I can tease apart which ones succeeded and which broke, but hopefully will have a little more info soon.

@AucaCoyan
Copy link
Member

Thanks for the thorough explanation!

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

Successfully merging this pull request may close these issues.

None yet

2 participants