Skip to content

Issue with rust-toolchain file #14

Description

@BlinkyStitt

My project has a rust-toolchain file in its root for a nightly toolchain, but ./setup.sh simply calls "cargo" so it built with a different version than my project. This lead to the following error when running analyze.sh.

$ ~/src/siderophile/analyze.sh myapp
trawling source code of dependencies for unsafety
   Compiling libc v0.2.60

...


error[E0514]: found crate `cached` compiled by an incompatible version of rustc myapp                                   
  --> src/lib.rs:15:1
   |
15 | extern crate cached;
   | ^^^^^^^^^^^^^^^^^^^^
   |
   = help: please recompile that crate using this compiler (rustc 1.37.0-nightly (8aa42ed7c 2019-06-24))
   = note: the following crate versions were found:
           crate `cached` compiled by rustc 1.36.0 (a53f9df32 2019-07-03): ~/src/myapp/target/debug/deps/libcached-b5e2b19b56d13d52.rmeta

error: aborting due to previous error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Cargo("Could not compile `myapp`.")', src/libcore/result.rs:1051:5
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: siderophile::main
   8: std::rt::lang_start::{{closure}}
   9: std::panicking::try::do_call
  10: __rust_maybe_catch_panic
  11: std::rt::lang_start_internal
  12: main

To fix this problem, I had to build and run siderophile with the correct toolchain selected.

cd ~/src/siderophile
RUSTUP_TOOLCHAIN=$(cat ~/src/myapp/rust-toolchain) cargo build --release
$ cd ~/src/myapp
$ RUSTUP_TOOLCHAIN=$(cat rust-toolchain) ~/src/siderophile/analyze.sh myapp

trawling source code of dependencies for unsafety
   Compiling libc v0.2.60
...
generating LLVM bitcode for the callgraph
...

A note about this should probably be added to the readme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions