arrayfire / arrayfire-rust

Rust wrapper for ArrayFire
BSD 3-Clause "New" or "Revised" License
810 stars 58 forks source link

Error in build script when no backends are found #310

Closed phil-opp closed 2 years ago

phil-opp commented 2 years ago

Fixes #308

Also:

Cargo only shows the stderr/stdout of build scripts if they fail. So the new warnings do not clutter the output of successful builds.

Example output when a folder is inaccessible:

   Compiling arrayfire v3.8.0 (/workspaces/arrayfire-rust)
error: failed to run custom build command for `arrayfire v3.8.0 (/workspaces/arrayfire-rust)`

Caused by:
  process didn't exit successfully: `/workspaces/arrayfire-rust/target/debug/build/arrayfire-09f04fa2319aeba4/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=AF_PATH

  --- stderr
  WARNING: USE_LIB is defined, but AF_PATH is not found. Trying to find libraries from known default locations.
  WARNING: failed to access `/opt/arrayfire/lib/libafcuda.dll`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libafcuda.dylib`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libafcuda.so`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libafopencl.dll`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libafopencl.dylib`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libafopencl.so`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libaf.dll`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libaf.dylib`: Permission denied (os error 13)
  WARNING: failed to access `/opt/arrayfire/lib/libaf.so`: Permission denied (os error 13)
  ERROR: no arrayfire backends found
9prady9 commented 2 years ago

I have fixed the clippy warnings in separate commit. If you can look into ci job change and let me know if that is even possible re-use. If it isn't, we can go ahead with this merge. Thank you

phil-opp commented 2 years ago

I have fixed the clippy warnings in separate commit.

Thanks! I rebased this PR on top of the latest changes from master.