holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
694 stars 31 forks source link

Error with musl toolchain installed #102

Open fenhl opened 1 year ago

fenhl commented 1 year ago

I'm getting this error when running cargo sweep on Ubuntu 23.04:

[INFO] Using all installed toolchains: ["stable-x86_64-unknown-linux-gnu", "stable-x86_64-unknown-linux-musl"]
[ERROR] Failed to clean "/home/fenhl/wslgit/github.com/midoshouse/rust-ootr-utils/target"

Caused by:
    failed to determine fingerprint for toolchain stable-x86_64-unknown-linux-musl: Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so)
    Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so)
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetRegionStart: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetTextRelBase: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_RaiseException: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_SetIP: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_Resume: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_DeleteException: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_Resume_or_Rethrow: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetIPInfo: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetDataRelBase: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_SetGR: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetLanguageSpecificData: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_Resume: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetTextRelBase: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetDataRelBase: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetRegionStart: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_FindEnclosingFunction: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_DeleteException: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_SetGR: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_SetIP: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetCFA: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetLanguageSpecificData: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_RaiseException: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetIP: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetIPInfo: symbol not found
    Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_Backtrace: symbol not found
jyn514 commented 1 year ago

@fenhl what does rustc +stable-x86_64-unknown-linux-musl --version output? If your toolchain already has an error, cargo sweep can't bypass it somehow, it needs to know the metadata hash of the version.

jyn514 commented 1 year ago

As a workaround, you can specify an individual toolchain: cargo sweep --toolchains stable-x86_64-unknown-linux-gnu

fenhl commented 1 year ago

The rustc command also errors. I didn't think to check it since cross-compiling for musl works.

According to the cargo help sweep entry for --toolchains, the suggested workaround will delete musl artifacts, which is not what I want.

fenhl commented 1 year ago

I opened rust-lang/rustup#3254 for the rustc error. Maybe cargo sweep could improve its error handling to indicate that the error is in rustc.

jyn514 commented 1 year ago

@fenhl cargo-sweep already says "failed to determine fingerprint for toolchain stable-x86_64-unknown-linux-musl" - how could that be improved?

jyn514 commented 1 year ago

The rustc command also errors. I didn't think to check it since cross-compiling for musl works.

According to the cargo help sweep entry for --toolchains, the suggested workaround will delete musl artifacts, which is not what I want.

Like jubilee said in https://github.com/rust-lang/rust/issues/108907#issuecomment-1463679981, the musl host toolchain is unrelated to the musl target standard library.

fenhl commented 1 year ago

It wasn't clear to me from the error message that the error was happening in rustc. Maybe preface the part of the error message quoted from rustc with “rustc:” or “rustc output:” or something?