Giter Club home page Giter Club logo

Comments (14)

kolloch avatar kolloch commented on July 19, 2024 1

Thank you for testing!

I think that noDefaultFeatures/default-features=false is broken and therefore the error case is not triggered anymore. Keeping this open until that is resolved :(

For dbus_codegen, I do not see any extern parameter. Something is quite wrong :( Could you please create another bug with a reproducing repro? I would be appreciated...

from crate2nix.

cpcloud avatar cpcloud commented on July 19, 2024

@kolloch This is the problem I reference in the FIXME here.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Thank you. I could reproduce this problem but have trouble understanding why this happens.

I would expect two flags of similar to --extern lazy_static=/nix/store/d08mk7m3j57kadk1vykjvmdc0sjmsf4d-rust_lazy_static-1.4.0/lib/liblazy_static-28e1bf1896.rlib to be specified when building it. Instead, I do not see any and wonder how it picks up two of them.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Ah, okay, we might need to filter duplicate ones in filterDependencies.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

If you have some time, I'd love a minimal reproducible example for this.

I could reproduce this before with the "with_problematic_crates" example when using "tracing" with default features. See #51 (comment)

Now, I cannot reproduce it anymore. Can you?

I'd love a minimal project example which has only a small number of dependencies.

I suspect that my nixpkgs update fixed it.

from crate2nix.

evanjs avatar evanjs commented on July 19, 2024

I was actually able to reproduce by only adding tracing_core an otherwise empty new project.
With ffc06fd, I can't seem to reproduce anymore.

Another error popped up, though...
Seems similar to #4 and #5:

rust_crate2nix> Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=8 --edition 2018 --cfg feature="default" --out-dir target/build/crate2nix-51 --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow -L native=/nix/store/y2irx4ldvz8c6823skr37rw8ywidwz2a-dbus-1.12.16-lib/lib -l dbus-1 --color always
rust_crate2nix> error[E0432]: unresolved import `dbus_codegen`
rust_crate2nix>  --> build.rs:3:5
rust_crate2nix>   |
rust_crate2nix> 3 | use dbus_codegen;
rust_crate2nix>   |     ^^^^^^^^^^^^ no `dbus_codegen` external crate
rust_crate2nix> error: aborting due to previous error
rust_crate2nix> For more information about this error, try `rustc --explain E0432`.
builder for '/nix/store/7hlx61n1dxgjbimb3hwq9v911li9iw0l-rust_crate2nix-51-0.1.0.drv' failed with exit code 1; last 10 log lines:
  Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=8 --edition 2018 --cfg feature="default" --out-dir target/build/crate2nix-51 --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow -L native=/nix/store/y2irx4ldvz8c6823skr37rw8ywidwz2a-dbus-1.12.16-lib/lib -l dbus-1 --color always
  error[E0432]: unresolved import `dbus_codegen`
   --> build.rs:3:5
    |
  3 | use dbus_codegen;
    |     ^^^^^^^^^^^^ no `dbus_codegen` external crate
  
  error: aborting due to previous error
  
  For more information about this error, try `rustc --explain E0432`.

I can open another issue for that 😛


In any case, this particular issue with lazy_static and tracing_core seems to be resolved.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

So this builds but I think that the dependency with the more specific target should probably override the features of the general dependency. crate2nix will currently merge their feature sets.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Let's reopen if this becomes a concrete problem again.

from crate2nix.

bbigras avatar bbigras commented on July 19, 2024

I have a similar problem. Tell me if you want me to open a new issue:

Cargo.toml

futures = { version = "0.3", default-features = false, features = ["compat"] }
futures01 = { package = "futures", version = "0.1" }

main.rs

use futures01::future::IntoFuture;

fn something(
) -> impl futures01::Future<Item = (), Error = std::io::Error> {
    Ok(()).into_future()
}

fn main() {
    println!("Hello, world!");
}

log

error[E0465]: multiple rlib candidates for `futures01` found
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
  |
note: candidate #1: /nix/store/jwjxndqbg3jncs0fp3jdw5gxn06bdwfm-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
note: candidate #2: /nix/store/bikk5jmdrkj84lhwnbvdvld29g7awc8k-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^

error[E0463]: can't find crate for `futures01`
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^ can't find crate

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

That looks like this issue.

Do you use nixpks-unstable?

Can you include the rustc command lines?

from crate2nix.

bbigras avatar bbigras commented on July 19, 2024

Do you use nixpks-unstable?

Yes

Can you include the rustc command lines?

Do you mean the full build log like this:

these derivations will be built:
  /nix/store/q6xrcw6srxkdkxpqyd9f1cxzfj6rdj7y-rust_test-crate2nix-0.1.0.drv
  /nix/store/cwrfdph4g7ps653yfgf9mb6n9xdxaynp-all-workspace-members.drv
building '/nix/store/q6xrcw6srxkdkxpqyd9f1cxzfj6rdj7y-rust_test-crate2nix-0.1.0.drv'...
unpacking sources
unpacking source archive /nix/store/d3nqc9v4113kmpkkgj0pbvar7zkvq3c9-source
source root is source
patching sources
configuring
Running cd .
building
Building test-crate2nix (src/main.rs)
Running rustc --crate-name test_crate2nix src/main.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --remap-path-prefix=/build=/ --extern futures01=/nix/store/bikk5jmdrkj84lhwnbvdvld29g7awc8k-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib --extern futures01=/nix/store/jwjxndqbg3jncs0fp3jdw5gxn06bdwfm-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib --cfg feature="default" --edition 2018 --out-dir target/bin -L dependency=target/deps --cap-lints allow --color always
error[E0465]: multiple rlib candidates for `futures01` found
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
  |
note: candidate #1: /nix/store/jwjxndqbg3jncs0fp3jdw5gxn06bdwfm-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
note: candidate #2: /nix/store/bikk5jmdrkj84lhwnbvdvld29g7awc8k-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^

error[E0463]: can't find crate for `futures01`
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
builder for '/nix/store/q6xrcw6srxkdkxpqyd9f1cxzfj6rdj7y-rust_test-crate2nix-0.1.0.drv' failed with exit code 1
cannot build derivation '/nix/store/cwrfdph4g7ps653yfgf9mb6n9xdxaynp-all-workspace-members.drv': 1 dependencies couldn't be built
error: build of '/nix/store/cwrfdph4g7ps653yfgf9mb6n9xdxaynp-all-workspace-members.drv' failed

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

This is an instance of #83.

The generated command line is definitely wrong:

Running rustc --crate-name test_crate2nix src/main.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --remap-path-prefix=/build=/ --extern futures01=/nix/store/bikk5jmdrkj84lhwnbvdvld29g7awc8k-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib --extern futures01=/nix/store/jwjxndqbg3jncs0fp3jdw5gxn06bdwfm-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib --cfg feature="default" --edition 2018 --out-dir target/bin -L dependency=target/deps --cap-lints allow --color always

There is a regression test that is very similar, so I suspect you are not using a recent crate2nix (from master) version or not an updated nixpkgs-unstable version. Try updating both. You need this PR.

from crate2nix.

bbigras avatar bbigras commented on July 19, 2024

I should be up-to-date now and I still have the problem:

I don't have to use -n '<nixos-unstable>' right? Since I'm on unstable and I don't have the stable channel.

crate2nix 0.9.0-alpha.1

  • system: "x86_64-linux"
  • host os: Linux 5.4.42, NixOS, 20.09pre227294.46f975f81e0 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.4
  • channels(bbigras): "home-manager, unstable-20.09pre227294.46f975f81e0"
  • channels(root): "nixos-20.09pre227294.46f975f81e0, nixos-hardware"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
crate2nix generate
nix-build Cargo.nix

[...]

Running rustc --crate-name test_crate2nix src/main.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --remap-path-prefix=/build=/ --extern futures01=/nix/store/psw2biiczndm4jlifxjbjhpiksqsl1fr-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib --extern futures01=/nix/store/lpz991aqha42z48s7hvp1sa4ykss25vv-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib --cfg feature="default" --edition 2018 --out-dir target/bin -L dependency=target/deps --cap-lints allow --color always
error[E0465]: multiple rlib candidates for `futures01` found
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
  |
note: candidate #1: /nix/store/psw2biiczndm4jlifxjbjhpiksqsl1fr-rust_futures-0.1.29-lib/lib/libfutures-935dbfd7d6.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^
note: candidate #2: /nix/store/lpz991aqha42z48s7hvp1sa4ykss25vv-rust_futures-0.3.5-lib/lib/libfutures-a0288b50d7.rlib
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^

error[E0463]: can't find crate for `futures01`
 --> src/main.rs:1:5
  |
1 | use futures01::future::IntoFuture;
  |     ^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
builder for '/nix/store/93zgwwc57p5dd9398rpz2i3nmqyb1v4a-rust_test-crate2nix-0.1.0.drv' failed with exit code 1
cannot build derivation '/nix/store/ny4ssg0dnr282rpa1yv2qmpjws9lpafb-all-workspace-members.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ny4ssg0dnr282rpa1yv2qmpjws9lpafb-all-workspace-members.drv' failed

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Sorry, you are right! I didn't push the fix. Sorry for that. It should be pushed now and work for you. Thanks for your insistance.

from crate2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.