nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.25k stars 41 forks source link

libgit2 not loaded, fixed with reinstall #224

Closed RileyLeff closed 1 year ago

RileyLeff commented 1 year ago

I'm running MacOS 13.2.1 on a M1 Pro. I updated libgit2 via homebrew this morning and that seems to have broken cargo-update. I was getting this message any time I tried to run it:

rileyleff@redwood % `cargo install-update -a`
dyld[54025]: Library not loaded: /opt/homebrew/opt/libgit2/lib/libgit2.1.5.dylib
  Referenced from: <12F83569-42EC-3C9F-8799-C0CC973938AC> /Users/rileyleff/.cargo/bin/cargo-install-update
  Reason: tried: '/opt/homebrew/opt/libgit2/lib/libgit2.1.5.dylib' (no such file),
  '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libgit2/lib/libgit2.1.5.dylib' (no such file),
  '/opt/homebrew/opt/libgit2/lib/libgit2.1.5.dylib' (no such file),
  '/Users/rileyleff/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/libgit2.1.5.dylib' (no such file),
  '/Users/rileyleff/lib/libgit2.1.5.dylib' (no such file),
  '/usr/local/lib/libgit2.1.5.dylib' (no such file),
  '/usr/lib/libgit2.1.5.dylib' (no such file, not in dyld cache),
  '/opt/homebrew/Cellar/libgit2/1.6.2/lib/libgit2.1.5.dylib' (no such file),
  '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/libgit2/1.6.2/lib/libgit2.1.5.dylib' (no such file),
  '/opt/homebrew/Cellar/libgit2/1.6.2/lib/libgit2.1.5.dylib' (no such file),
  '/Users/rileyleff/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/libgit2.1.5.dylib' (no such file),
  '/Users/rileyleff/lib/libgit2.1.5.dylib' (no such file),
  '/usr/local/lib/libgit2.1.5.dylib' (no such file),
  '/usr/lib/libgit2.1.5.dylib' (no such file, not in dyld cache)
zsh: abort      cargo install-update --help

After reinstalling cargo-update with cargo install cargo-update --force it's back to working as expected.

Just wanted to have this on here in case anyone else runs into a similar issue, or if this error message indicates the need for a minor fix, etc. Appreciate everyone's work on this tool!

Guara92 commented 1 year ago

Same on Asahi Linux after last git update

eduarddejong commented 1 year ago

Same issue here, on Arch Linux (with package rustup installed from the distro using pacman, everything else via rustup and cargo), but with a slightly different way the error was written and also without that stack trace:

/home/eduard/.cargo/bin/cargo-install-update: error while loading shared libraries: libgit2.so.1.5: cannot open shared object file: No such file or directory

Nevertheless, a cargo uninstall cargo-update, followed by a cargo install cargo-update fixed it for me as well, triggering a recompile of a lot of packages.

If it's something I can prevent as a user of this package, it would be great to know about it for learning experience.

nabijaczleweli commented 1 year ago

Ultimately the answer to "i changed my system libraries" is "rebuild their dependents".

If you want to embed fixed versions of some libraries you also have on your system you can do cargo install-update-config -f vendored-openssl -f vendored-libgit2 -f vendored-libcurl cargo-update.

alban-semana commented 1 year ago

@eduarddejong libgit2 version has switch, you just need to compile cargo-update :

cargo install -f cargo-update