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

buildRustCrate cannot handle dependency to two version of the same named crates #70270

Closed
oxalica opened this issue Oct 2, 2019 · 6 comments
Closed

Comments

@oxalica
Copy link
Contributor

oxalica commented Oct 2, 2019

Describe the bug
#68296 makes buildRustCrate support crate renaming. But the implementation use only crate name to identify a crate, which leads to problem if there are two crates with same name but different versions.
In this case, we cannot even provide a proper crateRenames.

From: #68296 (comment)

To Reproduce
Steps to reproduce the behavior:

  1. Crate a rust binary crate with these dependencies. And add use {a, b}; to main.rs
    a = { version = "0.1", package = "libc" }
    b = { version = "0.2", package = "libc" }
  2. We cannot write a correct invocation to buildRustCrate with current crateRenames to build it. Either a or b will be not found.

Expected behavior
It should be able to build it anyway.

@oxalica
Copy link
Contributor Author

oxalica commented Oct 2, 2019

I prefer using a set in dependencies like this

buildRustCrate {
  # ...
  dependencies = {
    a = libc_0_1_12;
    b = libc_0_2_62;
  };
}

Well, this seems to break lots of things. And looks different with the nix-like dependencies buildInputs = [ ... ].

If we stick on list type dependencies. Then I think package id is enough to identify a crate well. That is,

{
  crateRenames = {
    "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a";
    "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "b";
  };
}

I'm not sure if we can only use crate name and version here. And to be honest, it still looks weird to me since it should be semantically "a" = "libc 0.1.12 ..." but get reversed.

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@IslandUsurper
Copy link
Contributor

This bug prevents crate2nix from building rust-analyzer. I would like to see it fixed.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 18, 2020
@stale
Copy link

stale bot commented Feb 14, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 14, 2021
@oxalica
Copy link
Contributor Author

oxalica commented Feb 24, 2021

The issue still exists. Related: #89563

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 24, 2021
@kolloch
Copy link
Contributor

kolloch commented Feb 27, 2021

@oxalica I think that this should be fixed in crate2nix 0.9.0 nix-community/crate2nix#83

@oxalica oxalica closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants