Skip to content

cargo miri doesn't work very well #486

@RalfJung

Description

@RalfJung

Without MIR in libstd, I cannot get it to work at all: I am in cargo-miri-test and do:

$ cargo miri
   Compiling byteorder v1.0.0                                                                                                                                                                                      
error[E0463]: can't find crate for `std`                                                                                                                                                                           
                                                                                                                                                                                                                   
error: aborting due to previous error                                                                                                                                                                              
                                                                                                                                                                                                                   
For more information about this error, try `rustc --explain E0463`.                                                                                                                                                
error: Could not compile `byteorder`.                                                                                                                                                                              

To learn more, run the command again with --verbose.

Doing cargo build first makes no difference.

With MIR in libstd, things only work a bit better: With a clean build dir, I get

$ MIRI_SYSROOT=~/.xargo/HOST cargo miri 
   Compiling byteorder v1.0.0                                                                                                                                                                                      
   Compiling cargo-miri-test v0.1.0 (/home/r/src/rust/miri.2/cargo-miri-test)                                                                                                                                      
0x01020304                                                                                                                                                                                                         
standard error                                                                                                                                                                                                     
error: the evaluated program leaked memory                                                                                                                                                                         
                                                                                                                                                                                                                   
error: aborting due to previous error                                                                                                                                                                              
                                                                                                                                                                                                                   
error: Could not compile `cargo-miri-test`.

Only with MIRI_SYSROOT=~/.xargo/HOST cargo miri -- -Zmiri-start-fn, it actually works. Not good.

Worse, if I do cargo build before, things fall apart entirely:

$ cargo build && MIRI_SYSROOT=~/.xargo/HOST cargo miri 
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s                                                                                                                                                      
   Compiling cargo-miri-test v0.1.0 (/home/r/src/rust/miri.2/cargo-miri-test)                                                                                                                                      
error[E0460]: found possibly newer version of crate `std` which `byteorder` depends on                                                                                                                             
 --> src/main.rs:1:1                                                                                                                                                                                               
  |                                                                                                                                                                                                                
1 | extern crate byteorder;                                                                                                                                                                                        
  | ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                        
  |                                                                                                                                                                                                                
  = note: perhaps that crate needs to be recompiled?                                                                                                                                                               
  = note: the following crate versions were found:                                                                                                                                                                 
          crate `std`: /home/r/.xargo/HOST/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib                                                                                                                    
          crate `std`: /home/r/.xargo/HOST/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.so                                                                                                                      
          crate `byteorder`: /home/r/src/rust/miri.2/cargo-miri-test/target/debug/deps/libbyteorder-b61b17374d39b672.rlib                                                                                          
                                                                                                                                                                                                                   
error: aborting due to previous error                                                                                                                                                                              
                                                                                                                                                                                                                   
For more information about this error, try `rustc --explain E0460`.                                                                                                                                                
error: Could not compile `cargo-miri-test`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions