fftw
fftw copied to clipboard
The source and intel-mkl feature flags are mutually exclusive
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.