Skip to content
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

The source and intel-mkl feature flags are mutually exclusive #114

Open
bowlofeggs opened this issue Jun 9, 2021 · 0 comments
Open

The source and intel-mkl feature flags are mutually exclusive #114

bowlofeggs opened this issue Jun 9, 2021 · 0 comments

Comments

@bowlofeggs
Copy link

I've noticed that if the source and intel-mkl feature flags are both set, it leads to a build failure:

   Compiling fftw-sys v0.6.0
error[E0259]: the name `ffi` is defined multiple times
 --> /home/bowlofeggs/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-sys-0.6.0/src/lib.rs:7:1
  |
4 | extern crate fftw_src as ffi;
  | ----------------------------- previous import of the extern crate `ffi` here
...
7 | extern crate intel_mkl_src as ffi;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ffi` reimported here
  |
  = note: `ffi` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
  |
7 | extern crate intel_mkl_src as other_ffi;
  |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0259`.
error: could not compile `fftw-sys`

The Cargo Book suggests avoiding this scenario if possible:

There are rare cases where features may be mutually incompatible with one another. This should be avoided if at all possible, because it requires coordinating all uses of the package in the dependency graph to cooperate to avoid enabling them together.

Since source is the default feature, would it make sense to use intel-mkl if that feature is set, and fall back to source if it is not set?

Context

My particular problem is that my application also has an intel-mkl feature flag. If that flag is set, I have my application configured to set the same flag on fftw. However, if that flag is not set I would like to use the source feature. I am unfamiliar with a way to express that I want the source flag set if my feature is not set, but set if it is. If fftw made these flags additive rather than mutually exclusive, I could simply use the default feature set in fftw (giving me source), and then I can add the intel-mkl flag to fftw if my corresponding feature is enabled without hitting this compilation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant