eclipse-zenoh / zenoh-c

C API for Zenoh
http://zenoh.io
Other
74 stars 56 forks source link

error in build-resources/opaque-types should be visible #766

Open milyin opened 1 week ago

milyin commented 1 week ago

When subproject build-resources/opaque-types fails to build, it's not reported by build.rs To reproduce go to build-resources/opaque-types/src/lib.rs, add any syntax error, and run "cargo check" in the main project.

The output is:

error: failed to run custom build command for `zenoh-c v1.0.0-dev (/Users/milyin/ZS1/zenoh-c)`

Caused by:
  process didn't exit successfully: `/Users/milyin/ZS1/zenoh-c/target/debug/build/zenoh-c-b8630e9718da3ac4/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at build.rs:1433:28:
  no sigatures found for building generic z_loan_mut
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This doesn't point to real cause of error. If error was introduced not directly into "build-resources/opaque-types/src/lib.rs" but somehow indirectly, it's hard to find the problem for one who is not aware of this "build-resources/opaque-types" component

DenisBiryukov91 commented 1 day ago

Actually in this case it does point to the error in build.rs - so it is sort of ok. The issue is if you have some syntax errors - given that cbingen is launched before actual build - you will get very difficult to read error information from cbindgen side instead of rustc - this can be achieved by first make a dry-run ignoring build.rs; the resulting binaries would still be cached by cargo of future reuse - so it should not affect the build time.