rust-ncnn icon indicating copy to clipboard operation
rust-ncnn copied to clipboard

build.rs is trying to searching for header files in /usr/include instead of /ncnn/src

Open shisoft opened this issue 5 months ago • 0 comments

Hi, I tried to build with cargo run --example get_version, both from source and prebuilt ncnn. Both of them failed with

   Compiling ncnn-bind v0.1.2 (/home/shisoft/rust-ncnn/ncnn-bind)
error: failed to run custom build command for `ncnn-bind v0.1.2 (/home/shisoft/rust-ncnn/ncnn-bind)`

Caused by:
  process didn't exit successfully: `/home/shisoft/rust-ncnn/target/debug/build/ncnn-bind-2a6ffcd248250f4e/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=NCNN_DIR
  cargo:rerun-if-env-changed=NCNN_TAG
  cargo:rustc-link-search=native=/home/shisoft/rust-ncnn/target/debug/build/ncnn-bind-97e51e1966ab29d8/out/lib
  cargo:rustc-link-search=native=/home/shisoft/rust-ncnn/target/debug/build/ncnn-bind-97e51e1966ab29d8/out/lib64
  cargo:rustc-link-lib=dylib=ncnn
  cargo:rustc-link-lib=dylib=pthread

  --- stderr
  error: header '/usr/include/c_api.h' does not exist.
  thread 'main' panicked at ncnn-bind/build.rs:305:10:
  Unable to generate bindings: ()
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It seems like the build system is searching for headers at the wrong place. Is there anyway to fix it?

Thanks

shisoft avatar Sep 13 '24 03:09 shisoft