docs.rs doesn't build when I publish a crate that includes features in ndarray-linalg

72 views Asked by At

I think How to build documentation of an FFI crate without the native library? is a related question, but I'm not sure how to apply it to my situation. I'm using the ndarray-linalg crate which extends the features of ndarray, but it requires users to specify backend features. I tried uploading my crate, which is a library, to crates.io with the openblas-static feature enabled, and while the library builds fine, docs.rs gives me a build error:

[INFO] [stderr] error: failed to run custom build command for `openblas-src v0.10.8`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/openblas-src-3b8b898cc07c115f/build-script-build` (exit status: 101)
[INFO] [stderr]   --- stderr
[INFO] [stderr]   thread 'main' panicked at /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/openblas-src-0.10.8/build.rs:176:52:
[INFO] [stderr]   called `Result::unwrap()` on an `Err` value: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21.tar.gz: Dns Failed: resolve dns name 'github.com:443': failed to lookup address information: Temporary failure in name resolution
[INFO] [stderr] 
[INFO] [stderr]   Caused by:
[INFO] [stderr]       failed to lookup address information: Temporary failure in name resolution
[INFO] [stderr]   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[INFO] [stderr] warning: build failed, waiting for other jobs to finish...

I've since updated my Cargo.toml to alias the features:

...
[dependencies]
...
ndarray = "0.15.6"
ndarray-linalg = "0.16.0"

[features]
openblas-static = ["ndarray-linalg/openblas-static"]
openblas-system = ["ndarray-linalg/openblas-system"]
netlib-static = ["ndarray-linalg/netlib-static"]
netlib-system = ["ndarray-linalg/netlib-system"]
intel-mkl-static = ["ndarray-linalg/intel-mkl-static"]
intel-mkl-system = ["ndarray-linalg/intel-mkl-system"]

This builds fine now if I run something like cargo build -F openblas-static and the docs build fine if I run cargo docs -F openblas-static, but I'm really wondering what will happen when I upload it. Side note, is it not a bit silly that crates.io and docs.rs require a version bump every time you upload, even for aesthetic changes? Anyway, is this the preferred method of doing what I want, and should I upload it with cargo upload -F openblas-static or is there a cleaner way of getting around this? Or is this error entirely unrelated to the inclusion of this feature?

0

There are 0 answers