google/comprehensive-rust

`cargo check` fails in cxx demo if `CARGO_TARGET_DIR` is set

fw-immunant opened this issue · 0 comments

I get an error that looks like this:

  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/include" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/crate" "-I" "." "-I" "../../../target/cxxbridge/demo/src" "-Wall" "-Wextra" "-std=c++14" "-o" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/a9655d8c113f2a3f-main.rs.o" "-c" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/sources/demo/src/main.rs.cc"
  exit status: 0
  running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/include" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/crate" "-I" "." "-I" "../../../target/cxxbridge/demo/src" "-Wall" "-Wextra" "-std=c++14" "-o" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/src/blobstore.o" "-c" "src/blobstore.cc"
  cargo:warning=src/blobstore.cc:2:10: fatal error: main.rs.h: No such file or directory

  cargo:warning=    2 | #include "main.rs.h"

  cargo:warning=      |          ^~~~~~~~~~~

  cargo:warning=compilation terminated.

  exit status: 1

  --- stderr

  CXX include path:
    /var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/include
    /var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/crate


  error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/include" "-I" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/cxxbridge/crate" "-I" "." "-I" "../../../target/cxxbridge/demo/src" "-Wall" "-Wextra" "-std=c++14" "-o" "/var/cache/cargo/target/release/build/demo-4ab9609d61ec3bdd/out/src/blobstore.o" "-c" "src/blobstore.cc" with args "c++" did not execute successfully (status code exit status: 1).