dtolnay / cargo-llvm-lines

Count lines of LLVM IR per generic function
Apache License 2.0
414 stars 24 forks source link

Unsuccessful `cargo rustc` invocation: The system cannot find the file specified. (os error 2) #26

Closed smmalis37 closed 4 years ago

smmalis37 commented 4 years ago

Tried to run cargo llvm-lines on a project of mine, got the above error message. Unfortunately it doesn't tell me which file, this is all I've got. After the error it does output some statistics, but it seems like they're only for functions from core and alloc, not any of my code or the other crates it depends on. Running on Win 10 x64. Version is 0.4.3.

Full output: ``` > cargo llvm-lines Compiling wasm-playground v0.1.0 (C:\Users\smmal\Desktop\code\wasm-playground) Finished dev [unoptimized + debuginfo] target(s) in 0.56s Unsuccessful `cargo rustc` invocation: The system cannot find the file specified. (os error 2) Lines Copies Function name ----- ------ ------------- 189 (100%) 11 (100%) (TOTAL) 51 (27.0%) 1 (9.1%) core::alloc::global::GlobalAlloc::realloc 32 (16.9%) 1 (9.1%) core::alloc::global::GlobalAlloc::alloc_zeroed 20 (10.6%) 1 (9.1%) core::alloc::layout::Layout::from_size_align_unchecked 19 (10.1%) 1 (9.1%) __rg_realloc 16 (8.5%) 1 (9.1%) __rg_dealloc 13 (6.9%) 1 (9.1%) __rg_alloc 13 (6.9%) 1 (9.1%) __rg_alloc_zeroed 8 (4.2%) 1 (9.1%) core::alloc::layout::Layout::align 7 (3.7%) 1 (9.1%) core::num::NonZeroUsize::new_unchecked 6 (3.2%) 1 (9.1%) core::alloc::layout::Layout::size 4 (2.1%) 1 (9.1%) core::num::NonZeroUsize::get ```
smmalis37 commented 4 years ago

Some quick tracing shows it's apparently looking for cat.exe, which of course doesn't exist on Windows. Is the dependency on cat for unix-like oses truly necessary?

Here you can see it searching through my entire PATH:

image

dtolnay commented 4 years ago

I tried a fix in 0.4.4 but I don't have access to Windows to test. Could you confirm whether this is fixed after updating?

smmalis37 commented 4 years ago

On 0.4.5 the error message has disappeared, but the other output is unchanged. Is that output correct, or is it missing things? Does this have something to do with the wasm-related macros in my project? Or is there a way to specify a compile target to see if some sort of conditional compilation is removing things?

smmalis37 commented 4 years ago

I got access to a linux box and get the same output there, so I guess we're good.