cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

CUDA compiler family detection failed

Open mrjbom opened this issue 1 year ago • 2 comments

cc 1.0.104 My build.rs the script successfully compiles the CUDA file, but it has problems running its detect_compiler_family.c This is due to the fact that nvcc does not see cl.exe . But I can't help him by setting -ccbin how I do it to compile my CUDA file. How can I get rid of the warnings related to this?

fn main() {
    println!("cargo::rerun-if-changed=cuda/mandelbrot.cu");

    let mut build = cc::Build::new();
    let compiler = build.get_compiler();
    let ccbin = compiler.path();

    build
        .cuda(true)
        .cudart("static")
        .ccbin(false)
        .flag("-ccbin").flag(ccbin)
        .file("cuda/mandelbrot.cu");
    build.compile("mandelbrotcuda");
}

Warning is: Compiler family detection failed due to error: ToolExecError: Command "nvcc" "-E" "C:\Rust\mandelbrot_test_render\target\debug\build\mandelbrot_test_render-02f861198c0a4c7d\out\4903743526134228929detect_compiler_family.c" with args nvcc did not execute successfully (status code exit code: 1). If i run this directly in cmd nvcc fatal : Cannot find compiler 'cl.exe' in PATH

mrjbom avatar Jul 03 '24 12:07 mrjbom

nvcc fatal : Cannot find compiler 'cl.exe' in PATH

That's probably a limitation of our detection logic:

https://github.com/rust-lang/cc-rs/blob/eddc1fd3f944c2e00e9f067a6373b28868b54bcd/src/tool.rs#L143

I think maybe we should special case cuda here?

NobodyXu avatar Jul 03 '24 12:07 NobodyXu

I think maybe we should special case cuda here?

Of course. Although this is not critical, a lot of warnings get in the way.

mrjbom avatar Jul 06 '24 19:07 mrjbom