0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
27 stars 23 forks source link

`miden-client` docs fail to build on docs.rs #429

Closed bobbinth closed 2 days ago

bobbinth commented 5 days ago

Docs for miden-client library fail to build on docs.rs site with the following log output:

# rustc version
rustc 1.81.0-nightly (cc8da78a0 2024-07-04)# docs.rs version
docsrs 0.6.0 (bb8cd489 2024-06-24)# build log
[INFO] running `Command { std: "docker" "create" "-v" "/home/cratesfyi/workspace/builds/miden-client-0.4.0/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace/builds/miden-client-0.4.0/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "6442450944" "--cpus" "6" "--user" "1001:1001" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:dff56e7819e73ed36160586b3445e93eb0be776c16704aeeded9c3fb668b2384" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "--config" "build.rustdocflags=[\"--cfg\", \"docsrs\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--resource-suffix\", \"-20240704-1.81.0-nightly-cc8da78a0\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" "--offline" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\"" "-Zrustdoc-scrape-examples" "-j6" "--target" "x86_64-unknown-linux-gnu", kill_on_drop: false }`
[INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
[INFO] [stdout] 7b7146b9dfef64d8b72229dec889de334047bcd5dd37821907668a7c5d0eb13e
[INFO] running `Command { std: "docker" "start" "-a" "7b7146b9dfef64d8b72229dec889de334047bcd5dd37821907668a7c5d0eb13e", kill_on_drop: false }`
[INFO] [stderr] warning: target filter specified, but no targets matched; this is a no-op
[INFO] [stderr]    Compiling miden-client v0.4.0 (/opt/rustwide/workdir)
[INFO] [stderr] error: failed to run custom build command for `miden-client v0.4.0 (/opt/rustwide/workdir)`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/miden-client-b3276f505c213522/build-script-build` (exit status: 1)
[INFO] [stderr]   --- stdout
[INFO] [stderr]   cargo:rerun-if-changed=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/build/miden-client-b76624a976e7172f/out/rpc.proto
[INFO] [stderr]   cargo:rerun-if-changed=/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/build/miden-client-b76624a976e7172f/out
[INFO] [stderr] 
[INFO] [stderr]   --- stderr
[INFO] [stderr]   Error:   × Read-only file system (os error 30)
[INFO] [stderr] 
[INFO] running `Command { std: "docker" "inspect" "7b7146b9dfef64d8b72229dec889de334047bcd5dd37821907668a7c5d0eb13e", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "rm" "-f" "7b7146b9dfef64d8b72229dec889de334047bcd5dd37821907668a7c5d0eb13e", kill_on_drop: false }`
[INFO] [stdout] 7b7146b9dfef64d8b72229dec889de334047bcd5dd37821907668a7c5d0eb13e

Would be great to fix this re-publish the crate (e.g., under 0.4.1 version).

tomyrd commented 2 days ago

From what we've gathered, we think this is a similar issue to this. The solution in that case was to skip the documentation build if the DOCS_RS env var was set, meaning it was being built in docs.rs. Another possible solution mentioned in that issue was to change the docs out dir to use the OUT_DIR env var provided by docs.rs.

bobbinth commented 2 days ago

Yes - though the docs being built there are not the same docs as being built here - so, I'm not sure the second approach works.

But generally, making parts of the build script which cause issues conditional on whether DOCS_RS is set is the right approach, I think.