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

Dependencies enabled by features don't appear to work #65

Closed
VShell opened this issue Jan 16, 2020 · 2 comments
Closed

Dependencies enabled by features don't appear to work #65

VShell opened this issue Jan 16, 2020 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@VShell
Copy link

VShell commented Jan 16, 2020

I'm trying to package Plume with SQLite for NixOS. I'm using the master branch of crate2nix. This involves disabling the default features and enabling a "sqlite" feature when building. Unfortunately, I get this when I override rootFeatures to be [ "sqlite" ]:

Building src/lib.rs (diesel)
Running rustc --crate-name diesel src/lib.rs --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=2 --extern byteorder=/nix/store/xqnw4v9hx0zs6l2zl8y5m2dh7zd89pk1-rust_byteorder-1.3.1-lib/lib/libbyteorder-87d2e6ee33.rlib --extern chrono=/nix/store/3n27wrv96bid2sqd2h16izjc9l407ql1-rust_chrono-0.4.7-lib/lib/libchrono-f10bc22457.rlib --extern diesel_derives=/nix/store/avdwdilbck1264zzr8n589r3azn5b74p-rust_diesel_derives-1.4.0-lib/lib/libdiesel_derives-5ff800f449.so --extern r2d2=/nix/store/yfgzfik6ap7wrja09vh6wjlj678avlq8-rust_r2d2-0.8.4-lib/lib/libr2d2-f2ff8db6b6.rlib --cfg feature="32-column-tables" --cfg feature="chrono" --cfg feature="default" --cfg feature="diesel_derives/sqlite" --cfg feature="libsqlite3-sys" --cfg feature="r2d2" --cfg feature="sqlite" --cfg feature="with-deprecated" --edition 2015 -C metadata=7365896b5e -C extra-filename=-7365896b5e --crate-type lib --color always
error[E0463]: can't find crate for `ffi`
 --> src/sqlite/connection/mod.rs:1:1
  |
1 | extern crate libsqlite3_sys as ffi;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

There is no reference to libsqlite3_sys in my Cargo.nix, however there is a reference in Cargo.lock. Any ideas?

@VShell
Copy link
Author

VShell commented Jan 16, 2020

Changing the Cargo.toml to set the default feature as "sqlite" results in libsqlite3-sys being included in the Cargo.nix, so it seems that the dependency resolution algorithm doesn't see crates that are only enabled by non-default features.

@kolloch
Copy link
Collaborator

kolloch commented Jan 16, 2020

Thank you very much for the report! that is unexpected and a bug.

Did you use the version from master? It would be helpful if you could provide an example that I could then also include in the regression tests.

@kolloch kolloch added the bug Something isn't working label Jan 26, 2020
@kolloch kolloch added this to the 0.7 milestone Jan 26, 2020
@kolloch kolloch self-assigned this Jan 26, 2020
@kolloch kolloch added this to To do in crate2nix 0.7 Jan 26, 2020
crate2nix 0.7 automation moved this from To do to Done Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
crate2nix 0.7
  
Done
Development

No branches or pull requests

2 participants