# Nix-build errors

**URL:** <https://discourse.pijul.org/t/nix-build-errors/703>\
**Category:** Question\
**Created:** [December 23, 2020, 8:03am UTC](https://discourse.pijul.org/t/nix-build-errors/703 "2020-12-23T08:03:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjr](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pjr](https://discourse.pijul.org/u/pjr)\
**Post date:** [December 23, 2020, 8:03am UTC](https://discourse.pijul.org/t/nix-build-errors/703/1 "2020-12-23T08:03:41Z")

</div>

I cloned from Nest and ran `nix-build` but got some errors:

```auto
Some errors have detailed explanations: E0405, E0412, E0422, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0405`.
builder for '/nix/store/hmj2lw0jjrpfk4ay2plzda8j9i9dnq5z-rust_libpijul-1.0.0-alpha.19.drv' failed with exit code 1
cannot build derivation '/nix/store/yyp8iqy4fqmsgz7v87ziisj0g7jnssvx-rust_pijul-1.0.0-alpha.23.drv': 1 dependencies couldn't be built
error: build of '/nix/store/yyp8iqy4fqmsgz7v87ziisj0g7jnssvx-rust_pijul-1.0.0-alpha.23.drv' failed

```

NixOS unstable 21.03pre257780.e9158eca70a (Okapi)  
Pijul 5YDI33C4QRHATA6H3HHMBYFOBLAMXLLHWSDGJAH57DR6AMWO7AAQC

---

<div class="post-metadata">

**Author:** ![bdarcus](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/bdarcus/32/350_2.png) [@bdarcus](https://discourse.pijul.org/u/bdarcus)\
**Post date:** [January 3, 2021, 7:38pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/2 "2021-01-03T19:38:12Z")

</div>

I found the E0422 bug trying to compile using cargo, on Fedora linux. Using 1.48 rustc.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [January 3, 2021, 9:00pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/3 "2021-01-03T21:00:24Z")

</div>

Hi @bdarcus,

First, I’m sorry that [nest.pijul.com](http://nest.pijul.com) is down, I’ve been working hard to bring it back to life with all the upgrades (massive changes in Libpijul, Tokio 1.0) happening at the same time.

Which error is E0422? Where does the message come from in the code?  
Also, are you using the latest version, i.e. 1.0.0-alpha.27 (`cargo install pijul --version 1.0.0-alpha.27`)?

If in doubt, you can check [crates.io/crates/pijul](http://crates.io/crates/pijul) to find out what the latest version is.

---

<div class="post-metadata">

**Author:** ![bdarcus](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/bdarcus/32/350_2.png) [@bdarcus](https://discourse.pijul.org/u/bdarcus)\
**Post date:** [January 3, 2021, 10:10pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/4 "2021-01-03T22:10:12Z")

</div>

I was trying to build the latest alpha listed in the documentation. I wasn’t aware there was a newer one.

```auto
cargo install pijul --version 1.0.0-alpha.24 --features git

```

But 27 doesn’t compile either.

Here’s the output:

The associated type used was not defined in the trait.

Erroneous code example:

```auto
trait T1 {
    type Bar;
}

type Foo = T1<F=i32>; // error: associated type `F` not found for `T1`

// or:

trait T2 {
    type Bar;

    // error: Baz is used but not declared
    fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
}

```

Make sure that you have defined the associated type in the trait body.  
Also, verify that you used the right trait or you didn’t misspell the  
associated type name. Example:

```auto
trait T1 {
    type Bar;
}

type Foo = T1<Bar=i32>; // ok!

// or:

trait T2 {
    type Bar;
    type Baz; // we declare `Baz` in our trait.

    // and now we can use it here:
    fn return_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
}

```

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [January 4, 2021, 6:50am UTC](https://discourse.pijul.org/t/nix-build-errors/703/5 "2021-01-04T06:50:04Z")

</div>

Well, unfortunately, I can’t do much with error “templates”, would you mind giving an example of an actual error?

---

<div class="post-metadata">

**Author:** ![bdarcus](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/bdarcus/32/350_2.png) [@bdarcus](https://discourse.pijul.org/u/bdarcus)\
**Post date:** [January 6, 2021, 1:16pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/6 "2021-01-06T13:16:37Z")

</div>

How am I supposed to do that? I just copy-and-pasted the output from the terminal.

Edit: actually, I can tell you the problems are specific to the git feature. When I remove that, it compiles.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [January 6, 2021, 1:37pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/7 "2021-01-06T13:37:29Z")

</div>

Alright, sorry for the misunderstanding. I don’t think any trait is name `T1` or `T2` in the entire codebase, which is why I was a bit surprised.  
I believe I fixed the Git feature in 1.0.0-alpha.31, does that work for you?

---

<div class="post-metadata">

**Author:** ![bdarcus](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/bdarcus/32/350_2.png) [@bdarcus](https://discourse.pijul.org/u/bdarcus)\
**Post date:** [January 6, 2021, 1:49pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/8 "2021-01-06T13:49:05Z")

</div>

Yes; it compiles now. Thanks.

---

<div class="post-metadata">

**Author:** ![pjr](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pjr](https://discourse.pijul.org/u/pjr)\
**Post date:** [January 6, 2021, 8:34pm UTC](https://discourse.pijul.org/t/nix-build-errors/703/9 "2021-01-06T20:34:44Z")

</div>

The build still fails for me on PESRJZBOH6PQSDPJ7SDJX52O65FMPEV4373YYEWZSF7ATXDQL2VAC running `nix-build`.

```auto

Building src/lib.rs (tokio-compat-02)
Running rustc --crate-name tokio_compat_02 src/lib.rs --out-dir target/lib -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=24 --remap-path-prefix=/build=/ --extern bytes=/nix/store/cakracfw3yy37ni9jnbf25rzzxh5b0d0-rust_bytes-0.5.6-lib/lib/libbytes-1ecf79f91a.rlib --extern once_cell=/nix/store/2i54cwqa10vdl3g5khap1wviqh4mm93l-rust_once_cell-1.5.2-lib/lib/libonce_cell-916fc7e4e4.rlib --extern pin_project_lite=/nix/store/5a1xfmhfak16mipy4pkf1rsnz5iqiv97-rust_pin-project-lite-0.1.11-lib/lib/libpin_project_lite-b0239377b7.rlib --extern tokio_02=/nix/store/b37fj9fsa3sgjins4j223m4rk0h43l45-rust_tokio-0.2.24-lib/lib/libtokio-00b2277e3e.rlib --extern tokio_02=/nix/store/b37fj9fsa3sgjins4j223m4rk0h43l45-rust_tokio-0.2.24-lib/lib/libtokio-00b2277e3e.rlib --extern tokio_02=/nix/store/hwlq1avnzvkk1n0h0bkabmlhhadbf89r-rust_tokio-0.3.6-lib/lib/libtokio-ffd448e601.rlib --extern tokio_02=/nix/store/hwlq1avnzvkk1n0h0bkabmlhhadbf89r-rust_tokio-0.3.6-lib/lib/libtokio-ffd448e601.rlib --cfg feature="default" --edition 2018 -C metadata=601e7958df -C extra-filename=-601e7958df --crate-type lib --color always
error[E0465]: multiple rlib candidates for `tokio_02` found
  --> src/lib.rs:88:5
   |
88 | use tokio_02::runtime::{Handle, Runtime};
   | ^^^^^^^^
   |
note: candidate #1: /nix/store/b37fj9fsa3sgjins4j223m4rk0h43l45-rust_tokio-0.2.24-lib/lib/libtokio-00b2277e3e.rlib
  --> src/lib.rs:88:5
   |
88 | use tokio_02::runtime::{Handle, Runtime};
   | ^^^^^^^^
note: candidate #2: /nix/store/hwlq1avnzvkk1n0h0bkabmlhhadbf89r-rust_tokio-0.3.6-lib/lib/libtokio-ffd448e601.rlib
  --> src/lib.rs:88:5
   |
88 | use tokio_02::runtime::{Handle, Runtime};
   | ^^^^^^^^

error: aborting due to previous error

builder for '/nix/store/14hfyidlxffwsw6y8ji3l528zby44p1n-rust_tokio-compat-02-0.1.2.drv' failed with exit code 1
cannot build derivation '/nix/store/rdwp6aax1qmq3jy01dkwj0hcns6wxga0-rust_pijul-1.0.0-alpha.29.drv': 1 dependencies couldn't be built
error: build of '/nix/store/rdwp6aax1qmq3jy01dkwj0hcns6wxga0-rust_pijul-1.0.0-alpha.29.drv' failed

```
