In my program I link against a LAPACK implementation via the lapack and lapack-src
crates. I want to use a different LAPACK implementation depending on the OS (Accelerate on macOS, OpenBLAS on Windows and Linux). This is what my attempt looks like in my Cargo.toml:
[dependencies]
lapack = "0.19.0"
[target.'cfg(target_os = "macos")'.dependencies]
lapack-src = { version = "0.8.0", features = ["accelerate"]}
[target.'cfg(any(target_os="linux", target_os="windows"))'.dependencies]
lapack-src = {version = "0.8.0", features = ["openblas"]}
When I try to compile my code in a Linux-based Docker container I get the following error message:
#13 57.09 error: native frameworks are only available on macOS targets
#13 57.09
#13 57.11 error: could not compile `accelerate-src` due to previous error
#13 57.11 warning: build failed, waiting for other jobs to finish...
#13 61.36 error: build failed
So it looks like my attempt to use a different feature based on the target_os
isn't doing what I expect. What is the correct way to do this?