Skip to content

Challenges in Building Documentation for ez-ffmpeg on docs.rs Due to FFmpeg 7.1 Dependency #2769

Closed
@YeautyYE

Description

@YeautyYE

Crate name

ez-ffmpeg​

Build failure link

https://docs.rs/crate/ez-ffmpeg/0.1.0/builds/1833652

Additional details

Issue:

In the previous issue (#2765), I highlighted the challenges faced while generating documentation for ez-ffmpeg on docs.rs. Specifically, the build process fails due to the absence of FFmpeg 7.1 in the current build environment. In version 0.1.1 of ez-ffmpeg, we enabled the build feature of ffmpeg-sys-next to compile FFmpeg 7.1 during the build process. However, this approach requires network access to clone the FFmpeg source code, which is restricted in the docs.rs environment.

Previous Attempts:

In version 0.1.0, we attempted to build the documentation without initiating network requests, but this resulted in build failures due to missing components in the default environment. The build log detailing these errors can be found here: https://docs.rs/crate/ez-ffmpeg/0.1.0/builds/1833652

Reason for Submitting a New Issue:

The previous issue was closed without a resolution that allows ez-ffmpeg to build its documentation successfully on docs.rs. Given the importance of having accessible documentation for users of the crate, I am submitting this new issue to seek further guidance and potential solutions.

Potential Solutions:

  1. Add FFmpeg 7.1 to crates-build-env: Integrating FFmpeg 7.1 into the crates-build-env Docker image would allow projects like ez-ffmpeg to build successfully without requiring network access during the docs.rs documentation generation process. We are willing to contribute by submitting a pull request to include FFmpeg 7.1 in the build environment.

  2. Detect docs.rs Environment in Build Script: By checking for the DOCS_RS environment variable within the build.rs script, we can conditionally adjust the build process to accommodate the docs.rs environment. This approach would involve skipping network-dependent steps when the DOCS_RS variable is detected:

    fn main() {
        if std::env::var("DOCS_RS").is_ok() {
            // Adjust build process for docs.rs environment
        } else {
            // Regular build process
        }
    }
  3. Utilize [package.metadata.docs.rs] Configuration: Leveraging the [package.metadata.docs.rs] section in Cargo.toml allows for customization of the documentation build process on docs.rs. This configuration can specify features to be enabled or dependencies to be adjusted specifically for the docs.rs environment.

Request for Guidance:

We seek advice on the feasibility of the proposed solutions or any alternative recommendations to successfully generate documentation for ez-ffmpeg on docs.rs. Specifically:

  • Is adding FFmpeg 7.1 to the crates-build-env a viable solution, and would such a contribution be accepted?

  • Are there best practices for configuring the build script or Cargo.toml to handle the absence of network access during the docs.rs build process?

Environment Details:

  • rustc version: 1.87.0-nightly (b74da9613 2025-03-06)

  • docs.rs version: 0.6.0 (004a02c 2025-03-05)

We appreciate your time and assistance in resolving this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions