rust-lang / docs.rs

crates.io documentation generator
https://docs.rs
MIT License
973 stars 194 forks source link

Can not fetch git submodules #978

Closed inflation closed 4 years ago

inflation commented 4 years ago

Crate name: jpegxl-sys Build failure link: https://docs.rs/crate/jpegxl-sys/0.1.2/builds/281684 Additional details: Because the underlying C library uses multiple submodules, I'm using a command in build.rs to fetch them recursively:

Command::new("git")
    .args(&["submodule", "update", "--init", "--recursive"])
    .output()
    .expect("Sync submodules failed!");

It works locally but failed on docs.rs. I'm wondering if there is any restrictions about that. Thanks.

Kixiron commented 4 years ago

Unfortunately crates building within the docs.rs environment have no network access, so fetching while in the build environment is impossible

jyn514 commented 4 years ago

The build logs don't match up with the submodule snippet you posted.

[INFO] [stderr]   CMake Error: The source directory "/opt/rustwide/workdir/jpeg-xl" does not exist.
[INFO] [stderr]   Specify --help for usage, or press the help button on the CMake GUI.
[INFO] [stderr]   thread 'main' panicked at '
[INFO] [stderr]   command did not execute successfully, got: exit code: 1
[INFO] [stderr] 
[INFO] [stderr]   build script failed, must exit now', /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
jyn514 commented 4 years ago

Note that the source directory is mounted read only, so if you need to generate source files in build.rs, then you have to write them to OUT_DIR.

the underlying C library uses multiple submodules, I'm using a command in build.rs to fetch them recursively

I'm not sure I follow - builds don't happen in a git subdirectory (unless you packaged the whole git directory in the crates.io tarball). So any operation you do with git won't work.

inflation commented 4 years ago

Well, because jpeg-xl itself uses multiple third party sources, and they are presented as submodules under that, what I'm doing now is pulling everything so my library can build and link against it. I'll try to figure out if I can ship the header files then bindgen would work without the whole git repo.

inflation commented 4 years ago

It works!