Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the rust_icu crates available on docs.rs #41

Closed
filmil opened this issue Jan 8, 2020 · 6 comments
Closed

Make the rust_icu crates available on docs.rs #41

filmil opened this issue Jan 8, 2020 · 6 comments
Assignees

Comments

@filmil
Copy link
Member

filmil commented Jan 8, 2020

The rust_icu build process is very specific, requiring a preinstalled ICU library or a docker container. docs.rs does not know about this and tries to build with vanilla cargo. This fails, and as result no documentation appears on docs.rs.

Example here:
https://docs.rs/crate/rust_icu_uenum/0.0.4/builds/211223

An example 'sys' crate that works is sodium-sys. It has a custom build.rs script.
https://github.com/rustyhorde/sodium-sys/blob/master/build.rs

@filmil filmil self-assigned this Mar 26, 2020
@filmil
Copy link
Member Author

filmil commented Mar 26, 2020

Some advice given on rust-lang/docs.rs#655

filmil added a commit to filmil/rust_icu that referenced this issue Mar 26, 2020
Looking into a resolution of issue google#41, seems like we'd need
to modify the build environment of `docs.rs` to include the
development ICU library.  Looking at the packages available,
it seems that this is going to have to be ICU version 63.

Hence, adding the build and test envs with ICU 63.  They will be
linked into the build process as a followup.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 26, 2020
Looking into a resolution of issue google#41, seems like we'd need
to modify the build environment of `docs.rs` to include the
development ICU library.  Looking at the packages available,
it seems that this is going to have to be ICU version 63.

Hence, adding the build and test envs with ICU 63.  They will be
linked into the build process as a followup.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 26, 2020
Uses the `bindgen` library, instead of a `bindgen` executable
to generate the library bindings.

This helps in issue google#41, working towards a set of crates with
documentation that compiles on `docs.rs`.  Also, it places the
responsiblity for bindgen versioning in the hands of cargo, which
is better than needing to have the correct version installed.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 26, 2020
Uses the `bindgen` library, instead of a `bindgen` executable
to generate the library bindings.

This helps in issue google#41, working towards a set of crates with
documentation that compiles on `docs.rs`.  Also, it places the
responsiblity for bindgen versioning in the hands of cargo, which
is better than needing to have the correct version installed.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 26, 2020
icu-config is a deprecated utility and is not available
in linux distributions out of the box.  This prevents
the library from compiling under "default" development
environments.

For details, see issue google#41.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 27, 2020
icu-config is a deprecated utility and is not available
in linux distributions out of the box.  This prevents
the library from compiling under "default" development
environments.

For details, see issue google#41.
@filmil
Copy link
Member Author

filmil commented Mar 27, 2020

Looks like I managed to make changes that will allow rust_icu to compile on docs.rs.
Instructions here: https://forge.rust-lang.org/docs-rs/add-dependencies.html

One potential issue, the compilation model requires a README.md file must be available, and not be a symlink.

Another, I'm seeing some flakiness in bindgen invocation, exemplified in errors like this, which sometimes happen:

2020/03/27 00:18:07 [INFO] rustwide::cmd: [stderr] /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found

But, the upside, once the two changes land, we may be well positioned to have the docs compilation succeed.

@jyn514
Copy link

jyn514 commented Mar 27, 2020

2020/03/27 00:18:07 [INFO] rustwide::cmd: [stderr] /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found

This looks like you're trying to cross-compile for x86-unknown-linux-gnu (docs.rs builds all tier 1 targets by default). You can either request crates-build-env to install gcc-multilib (or the clang equivalent) in the build environment, or you can request docs.rs to only build for one target by putting targets = ["x86_64-unknown-linux-gnu"] in your Cargo.toml. See https://blog.rust-lang.org/2020/03/15/docs-rs-opt-into-fewer-targets.html for more details on the second option.

@filmil
Copy link
Member Author

filmil commented Mar 27, 2020 via email

@jyn514
Copy link

jyn514 commented Mar 27, 2020

Several crates have different documentation for different platforms, for example https://docs.rs/winapi/. In the past we've had multiple targets on by default, but we're considering making that opt-in in the future for exactly the reasons you've seen here: it sometimes doesn't work and in most cases the documentation is the same. However, we're keeping the targets on by default for now to avoid unnecessarily breaking builds.

filmil added a commit that referenced this issue Mar 27, 2020
Uses the `bindgen` library, instead of a `bindgen` executable
to generate the library bindings.

This helps in issue #41, working towards a set of crates with
documentation that compiles on `docs.rs`.  Also, it places the
responsiblity for bindgen versioning in the hands of cargo, which
is better than needing to have the correct version installed.
filmil added a commit to filmil/rust_icu that referenced this issue Mar 27, 2020
icu-config is a deprecated utility and is not available
in linux distributions out of the box.  This prevents
the library from compiling under "default" development
environments.

For details, see issue google#41.
filmil added a commit that referenced this issue Mar 27, 2020
icu-config is a deprecated utility and is not available
in linux distributions out of the box.  This prevents
the library from compiling under "default" development
environments.

For details, see issue #41.
@filmil
Copy link
Member Author

filmil commented Mar 27, 2020

Success! See here: https://docs.rs/rust_icu_sys/0.1.2/rust_icu_sys/

I have reasons to think that other crates will become viewable on docs.rs too.

@filmil filmil closed this as completed Mar 27, 2020
filmil added a commit to filmil/rust_icu that referenced this issue Mar 28, 2020
Looking into a resolution of issue google#41, seems like we'd need
to modify the build environment of `docs.rs` to include the
development ICU library.  Looking at the packages available,
it seems that this is going to have to be ICU version 63.

Hence, adding the build and test envs with ICU 63.  They will be
linked into the build process as a followup.
filmil added a commit that referenced this issue Mar 28, 2020
Looking into a resolution of issue #41, seems like we'd need
to modify the build environment of `docs.rs` to include the
development ICU library.  Looking at the packages available,
it seems that this is going to have to be ICU version 63.

Hence, adding the build and test envs with ICU 63.  They will be
linked into the build process as a followup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants