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

conflict config with dependency #1619

Closed
4 of 11 tasks
ibigbug opened this issue Jan 29, 2025 · 6 comments · Fixed by #1623
Closed
4 of 11 tasks

conflict config with dependency #1619

ibigbug opened this issue Jan 29, 2025 · 6 comments · Fixed by #1623

Comments

@ibigbug
Copy link

ibigbug commented Jan 29, 2025

Checklist

Describe your issue

I have a Cross.toml for my workspace and today the build is giving error about conflict config from one of the dependencies

[cross] warning: Found conflicting cross configuration in `/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.15/Cargo.toml`, use `[workspace.metadata.cross]` in the workspace manifest instead.

https://github.com/Watfaq/clash-rs/actions/runs/13025744515/job/36334424027?pr=686

i tried setting the env to disable the warning and the build actually fails so it looks like a real issue.

any idea how to fix the conflict?

What target(s) are you cross-compiling for?

x86_64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross v0.2.5

Example

No response

Additional information / notes

No response

@Emilgardis
Copy link
Member

Emilgardis commented Jan 29, 2025

The suggestion you saw about the warning is for making it into a hard error (I think?).

The way to fix this is for getrandom to use workspace.metadata here: https://github.com/rust-random/getrandom/blob/7385d1348954b100044843bbd661faa0f19459f7/Cargo.toml#L94

This is unfortunate that it even happens, I think its our fault, were not handling the manifest correctly.

Im not sure if this is fixed on newer cross, could you update cross and report back what you get?

cargo install cross --git https://github.com/cross-rs/cross

@ibigbug
Copy link
Author

ibigbug commented Jan 29, 2025

hey thanks for looking into this.

the suggestion in the warning actually bypass the check but raise build time error instead.

and i tried installing the latest checkout

   Compiling cross v0.2.5 (/home/runner/.cargo/git/checkouts/cross-f0189a1dc141e2d9/4090bec)

https://github.com/Watfaq/clash-rs/actions/runs/13030614288/job/36348854987?pr=686#step:5:87

would it make sense for me to send a PR to getrandom to change it to workspace.metadata?

@Emilgardis
Copy link
Member

You could do that, its more correct.
We should however fix this in cross

@ibigbug
Copy link
Author

ibigbug commented Jan 30, 2025

had a quick look here and the warning is originated from

cross/src/lib.rs

Lines 967 to 979 in 4090bec

if let Some(cross) = package_metadata.get("cross") {
if let Some(found) = &found {
msg_info.warn(format_args!("Found conflicting cross configuration in `{}`, use `[workspace.metadata.cross]` in the workspace manifest instead.\nCurrently only using configuration from `{}`", package.to_utf8()?, found))?;
continue;
}
let (workspace_config, _) = CrossToml::parse_from_deserializer(
cross,
Some(metadata.workspace_root.join("Cargo.toml").to_utf8()?),
msg_info,
)?;
config = config.merge(workspace_config)?;
found = Some(package.to_utf8()?.into());
}

however i don't have enough knowledge to understand what is the correct logic to make the build work.

@quietlychris
Copy link

quietlychris commented Feb 3, 2025

Just mentioning that I believed I'm also running into this issue, including on cross 0.2.5 and cross 0.2.4 from crates.io and from the git repository per cross v0.2.5 (~/.cargo/git/checkouts/cross-f0189a1dc141e2d9/4090bec). This is resulting in a compile-time error, primarily around dealing with locating manifests for local dependencies.

This is currently a pretty hard blocker for me on a project; if there's anything that I can do to help support the resolution of this issue in the near-term, just let me know!

Edit: Actually, my issue might be unrelated? My issue looks like it might be due to optional workspace dependencies not being picked up in the right way. If I can reproduce, I'll file a new issue.

@YJDoc2
Copy link

YJDoc2 commented Feb 5, 2025

Hey, we are running in the same error at youki - https://github.com/youki-dev/youki/actions/runs/13001125933/job/36259846628

After setting CROSS_NO_WARNINGS=0 as the error suggested, the build passed as seen here https://github.com/youki-dev/youki/actions/runs/13156685086/job/36715314853 (ignore the ci which are failing, that is breaking changes).

One potential reason we had this issue was that in our dep tree we had two versions of getrandom, 0.2.* and 0.3.0 . As this was dep of dep, we can't upgrade to latest, one dep still needs old version. As mentioned on this issue rust-random/getrandom#601 , it might be because cross might be running into issues when it finds two versions of same dep with their own cross config.

However, we run the CI on x68_64/aarch64 and gun/musl combo on Linux. The getrandom specifies cross config only for netbsd https://github.com/rust-random/getrandom/blob/master/Cargo.toml#L94 .

Is there anything I can help with to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants