BtbN / FFmpeg-Builds

MIT License
7.43k stars 1.03k forks source link

can't build due to cargo compiler errors for the local making images #320

Closed MartinEesmaa closed 10 months ago

MartinEesmaa commented 10 months ago

Hi! I have a problem for compiling targeting Windows x64 with non-free. I tried run ./makeimage.sh win64 nonfree, in the beginning it ran well, but during compilation of making image, I got an error messages like this:

81.06 error[E0277]: the trait bound `MacKeychain: cargo_credential::Credential` is not satisfied
81.06    --> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-0.74.0/src/cargo/util/auth/mod.rs:455:45
81.06     |
81.06 455 |           let provider: Box<dyn Credential> = match process {
81.06     |  _____________________________________________^
81.06 456 | |             "cargo:token" => Box::new(TokenCredential::new(config)),
81.06 457 | |             "cargo:paseto" => Box::new(PasetoCredential::new(config)),
81.06 458 | |             "cargo:token-from-stdout" => Box::new(BasicProcessCredential {}),
81.06 ...   |
81.06 462 | |             process => Box::new(CredentialProcessCredential::new(process)),
81.06 463 | |         };
81.06     | |_________^ the trait `cargo_credential::Credential` is not implemented for `MacKeychain`
81.06     |
81.06 help: trait impl with same name found
81.06    --> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-credential-0.4.1/src/lib.rs:61:1
81.06     |
81.06 61  | impl Credential for UnsupportedCredential {
81.06     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
81.06     = note: perhaps two different versions of crate `cargo_credential` are being used?
81.06     = help: the following other types implement trait `cargo_credential::Credential`:
81.06               UnsupportedCredential
81.06               BasicProcessCredential
81.06               PasetoCredential<'a>
81.06               CredentialProcessCredential
81.06               TokenCredential<'a>
81.06     = note: required for the cast from `std::boxed::Box<MacKeychain>` to `std::boxed::Box<dyn cargo_credential::Credential>`
81.06
81.06 error[E0277]: the trait bound `LibSecretCredential: cargo_credential::Credential` is not satisfied
81.06    --> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-0.74.0/src/cargo/util/auth/mod.rs:455:45
81.06     |
81.06 455 |           let provider: Box<dyn Credential> = match process {
81.06     |  _____________________________________________^
81.06 456 | |             "cargo:token" => Box::new(TokenCredential::new(config)),
81.06 457 | |             "cargo:paseto" => Box::new(PasetoCredential::new(config)),
81.06 458 | |             "cargo:token-from-stdout" => Box::new(BasicProcessCredential {}),
81.06 ...   |
81.06 462 | |             process => Box::new(CredentialProcessCredential::new(process)),
81.06 463 | |         };
81.06     | |_________^ the trait `cargo_credential::Credential` is not implemented for `LibSecretCredential`
81.06     |
81.06 help: trait impl with same name found
81.06    --> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-credential-libsecret-0.3.2/src/lib.rs:104:5
81.06     |
81.06 104 |     impl Credential for LibSecretCredential {
81.06     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
81.06     = note: perhaps two different versions of crate `cargo_credential` are being used?
81.06     = help: the following other types implement trait `cargo_credential::Credential`:
81.06               UnsupportedCredential
81.06               BasicProcessCredential
81.06               PasetoCredential<'a>
81.06               CredentialProcessCredential
81.06               TokenCredential<'a>
81.06     = note: required for the cast from `std::boxed::Box<LibSecretCredential>` to `std::boxed::Box<dyn cargo_credential::Credential>`
81.06
81.63 For more information about this error, try `rustc --explain E0277`.
81.65 error: could not compile `cargo` (lib) due to 2 previous errors
81.68 error: failed to compile `cargo-c v0.9.27+cargo-0.74.0`, intermediate artifacts can be found at `/tmp/cargo-installWTeN5n`.
81.68 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
------
WARNING: local cache import at .cache/ghcr.io/btbn/ffmpeg-builds/base_latest not found due to err: could not read .cache/ghcr.io/btbn/ffmpeg-builds/base_latest/index.json: open .cache/ghcr.io/btbn/ffmpeg-builds/base_latest/index.json: no such file or directory
Dockerfile:24
--------------------
  23 |     ENV CARGO_HOME="/opt/cargo" RUSTUP_HOME="/opt/rustup" PATH="/opt/cargo/bin:${PATH}"
  24 | >>> RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path && \
  25 | >>>     cargo install cargo-c && rm -rf "${CARGO_HOME}"/registry "${CARGO_HOME}"/git
  26 |
--------------------
ERROR: failed to solve: process "/bin/sh -c curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path &&     cargo install cargo-c && rm -rf \"${CARGO_HOME}\"/registry \"${CARGO_HOME}\"/git" did not complete successfully: exit code: 101
+ rm -f /tmp/tmp.SFJmuRx4uP.toml

Feel free to reply me with anytime! :)

Thank you!

Regards

BtbN commented 10 months ago

My guess would be that you are using stale images. Everything builds just fine for me. Try to clean up any potential stale local images you might have.

MartinEesmaa commented 10 months ago

Hi, @BtbN. Thank you for replying to me. I deleted and pruned the docker images with system:

docker rmi -f $(docker images -a -q)
docker system prune -af
docker image prune -af

After cleaning docker images, I ran the script again and it failed again. Tried my Arch Linux (CLI only) and Ubuntu 22.04.3, I get same error result.

BtbN commented 10 months ago

Then I don't know what's wrong. It seems to be failing super early as well, when installing rust. I have no controll over that step, so maybe upstream broke something. Hopefully it gets fixed soon if that's the case.

MartinEesmaa commented 10 months ago

Okay, @BtbN. Thank you for the information. I guess I had to wait for cargo build fix compile issues by rust... Waiting for two errors to be fixed:

91.38 error: could not compile `cargo` (lib) due to 2 previous errors

Update just found issue same error: https://github.com/rust-lang/cargo/issues/13002 Update 2: it was only cargo build issue, not ffmpeg-builds issue

madepal commented 10 months ago

Going off of a linked workaround (https://github.com/AOMediaCodec/libavif/pull/1785), I tried modifying cargo install cargo-c to cargo install cargo-c --locked and it successfully bypassed the issue for me.

The workaround also mentions "using --locked might be advisable anyway to ensure reproducible builds.".

madepal commented 10 months ago

@BtbN unless you have concerns with this solution, would you mind helping to merge this PR? Thanks!