Nixpkgs: rustracer: fails on nixos-unstable

Created on 4 Jun 2020  Â·  11Comments  Â·  Source: NixOS/nixpkgs

Describe the bug

rustracer fails to build on nixos-unstable (467ce5a9f45aaf96110b41eb863a56866e1c2c3c atm).

$ nix-build -A rustracer
...
   Compiling rustc-ap-rustc_data_structures v651.0.0
error[E0599]: no method named `get` found for type `u64` in the current scope
   --> /build/racer-2.1.32-vendor.tar.gz/rustc-ap-rustc_data_structures/profiling.rs:348:66
    |
348 |             let thread_id = std::thread::current().id().as_u64().get() as u32;
    |                                                                  ^^^ method not found in `u64`

error[E0599]: no method named `get` found for type `u64` in the current scope
   --> /build/racer-2.1.32-vendor.tar.gz/rustc-ap-rustc_data_structures/profiling.rs:525:62
    |
525 |         let thread_id = std::thread::current().id().as_u64().get() as u32;
    |                                                              ^^^ method not found in `u64`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rustc-ap-rustc_data_structures`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
builder for '/nix/store/8lg8ms4k7jjyh807yyfyyv4vvr9yas1p-racer-2.1.32.drv' failed with exit code 101
error: build of '/nix/store/8lg8ms4k7jjyh807yyfyyv4vvr9yas1p-racer-2.1.32.drv' failed

Additional context

This seems to be https://github.com/racer-rust/racer/issues/1093, however I don't understand why it used to work in the first place. Upstream suggests to use rustc from nightly >= 2020-02-10, we use 1.43.0. This used to not be a problem, as we are using RUSTC_BOOTSTRAP=1, a mechanism I don't understand.

Notify maintainers

@jagajaga @Ma27

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: rustracer
# a list of nixos modules affected by the problem
module:
bug rust

Most helpful comment

With rustc-1.44 (#89576) we can upgrade to 2.1.33 (just built and tested this combination locally):

diff --git a/pkgs/development/tools/rust/racer/default.nix b/pkgs/development/tools/rust/racer/default.nix
index 0a29577e0cd..f74e757184e 100644
--- a/pkgs/development/tools/rust/racer/default.nix
+++ b/pkgs/development/tools/rust/racer/default.nix
@@ -2,22 +2,22 @@

 rustPlatform.buildRustPackage rec {
   pname = "racer";
-  version = "2.1.30";
+  version = "2.1.33";

   src = fetchFromGitHub {
     owner = "racer-rust";
     repo = "racer";
-    rev = "c2b0080243fefdad7f7b223e8a7fdef3e1f0fa77";
-    sha256 = "0svvdkfqpk2rw0wxyrhkxy553k55lg7jxc0ly4w1195iwv14ad3y";
+    rev = "v${version}";
+    sha256 = "0fxcif42k8x70zwpi76h2jxyr048mjzakh52yzqavyr8irl55ll2";
   };

-  cargoSha256 = "0zaqa89z3nf23s2q1jpmfz4lygh4zq9ymql71d748fgjy9psr449";
+  cargoSha256 = "115ydgv4wd4bf3xhm96zlc9z1lhmrcnm1v5pgzl9846l27ka1z13";

-  buildInputs = [ makeWrapper ]
-                ++ stdenv.lib.optional stdenv.isDarwin Security;
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;

   # a nightly compiler is required unless we use this cheat code.
-  RUSTC_BOOTSTRAP=1;
+  RUSTC_BOOTSTRAP = 1;

   RUST_SRC_PATH = rustPlatform.rustcSrc;
   postInstall = ''

Upgrading to 2.1.34 doesn't work for us, see also https://github.com/racer-rust/racer/issues/1113.

I'm wondering though if we want to put rustracer into an external overlay using nixpkgs-mozilla in the mid-term since maintaining this with nightly rust is way easier AFAICS.

All 11 comments

The problem is that some dependencies seem to require certain nightly versions we don't have in our package set. I'll hopefully have time to investigate soon.

rustracer and rustracerd don't build on master either.

I ping some more people, they fixed rustracerd when it didn't build.
@alyssais @bhipple @jonringer @LnL7

@luc65r AFAICS the only issue is master (and the corresponding nixos-unstable-channel), right?

On release-20.03 (fdfd5ab0544) rustracer is building perfectly fine for me:

→ nix-build -A rustracer
/nix/store/zrwsqmn95x15d5jvz091mxa2kyx9msdc-racer-2.1.30

With rustc-1.44 (#89576) we can upgrade to 2.1.33 (just built and tested this combination locally):

diff --git a/pkgs/development/tools/rust/racer/default.nix b/pkgs/development/tools/rust/racer/default.nix
index 0a29577e0cd..f74e757184e 100644
--- a/pkgs/development/tools/rust/racer/default.nix
+++ b/pkgs/development/tools/rust/racer/default.nix
@@ -2,22 +2,22 @@

 rustPlatform.buildRustPackage rec {
   pname = "racer";
-  version = "2.1.30";
+  version = "2.1.33";

   src = fetchFromGitHub {
     owner = "racer-rust";
     repo = "racer";
-    rev = "c2b0080243fefdad7f7b223e8a7fdef3e1f0fa77";
-    sha256 = "0svvdkfqpk2rw0wxyrhkxy553k55lg7jxc0ly4w1195iwv14ad3y";
+    rev = "v${version}";
+    sha256 = "0fxcif42k8x70zwpi76h2jxyr048mjzakh52yzqavyr8irl55ll2";
   };

-  cargoSha256 = "0zaqa89z3nf23s2q1jpmfz4lygh4zq9ymql71d748fgjy9psr449";
+  cargoSha256 = "115ydgv4wd4bf3xhm96zlc9z1lhmrcnm1v5pgzl9846l27ka1z13";

-  buildInputs = [ makeWrapper ]
-                ++ stdenv.lib.optional stdenv.isDarwin Security;
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;

   # a nightly compiler is required unless we use this cheat code.
-  RUSTC_BOOTSTRAP=1;
+  RUSTC_BOOTSTRAP = 1;

   RUST_SRC_PATH = rustPlatform.rustcSrc;
   postInstall = ''

Upgrading to 2.1.34 doesn't work for us, see also https://github.com/racer-rust/racer/issues/1113.

I'm wondering though if we want to put rustracer into an external overlay using nixpkgs-mozilla in the mid-term since maintaining this with nightly rust is way easier AFAICS.

@Ma27 I'm not well-versed enough in how to deal with this. I'm trying to build YouCompleteMe and am not sure what to do with your comment.
Will this fix find its way into nixpkgs?

Yes, as soon as the rustc update is out.

Until then, what's wrong with using the package from the stable channel?

@Ma27 Thanks for the quick response! Nothing, I'm just using nixpkgs-unstable on some of my machines. I guess that's the real problem with my workflow.

To make sure you don't get me wrong: you don't have to change your default channel, you can do something like this: (import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-20.03-small.tar.gz) {}).rustracer as temporary solution.

Thanks! That helps, but I think I'll see if I can change my default channel instead.

It should be possible to add another channel for stbale (e.g. nixpkgs-stable) and then do import <nixpkgs-stable>. But I may be wrong, I don't use nix-channel on my systems.

@NorfairKing I have all the channels I need specified in my config in case I need to do something like this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grahamc picture grahamc  Â·  3Comments

langston-barrett picture langston-barrett  Â·  3Comments

ob7 picture ob7  Â·  3Comments

rzetterberg picture rzetterberg  Â·  3Comments

teto picture teto  Â·  3Comments