Skip to content

Error in build script when no backends are found #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 18, 2022

Conversation

phil-opp
Copy link
Contributor

Fixes #308

Also:

  • warn if backend files exist, but are not accessible (e.g. because access is denied).
  • improves the formatting of errors and warnings
  • print warnings to stderr instead of stdout

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

@phil-opp phil-opp force-pushed the error-if-no-backends branch 4 times, most recently from a19fe88 to 8fb4b4f Compare January 14, 2022 11:02
Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the delay. Couple of minor comments. Can you also please look into the Clippy annotations from the build.rs file. Would be great if you address the other two files also. Thank you!

@9prady9 9prady9 added this to the 3.8.1 milestone Feb 12, 2022
@9prady9
Copy link
Member

9prady9 commented Feb 17, 2022

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

This would result in a linker error anyway. By th
rowing the error earlier, we make it easier for the user to debug their arrayfire installation.
The clippy job now needs arrayfire to because the build script checks for a valid arrayfire installation.
@phil-opp phil-opp force-pushed the error-if-no-backends branch from 8fb4b4f to 15f63ca Compare February 17, 2022 17:15
@phil-opp
Copy link
Contributor Author

I have fixed the clippy warnings in separate commit.

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

Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thank you once again @phil-opp

@9prady9 9prady9 merged commit d4b789b into arrayfire:master Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Build] Build scripts silently ignores non-accessible DLLs
2 participants