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

*: use libz-sys instead of bundled one #419

Merged
merged 3 commits into from
Jan 23, 2020
Merged

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented Dec 20, 2019

When using the built-in cmake to build zlib, it changes the source tree
as madler/zlib#162 describes. This leads to the failure during
generating the docs. So let's switch to libz-sys instead, which
uses its own custom script to build zlib, and leave source tree as it
is. Switching to libz-sys can also reduce the package size as we can
ignore more sub modules. It should improve compile time if libz-sys is
also a dependency of other crates.

The only shortcoming is that libz-sys may not be compatible with
grpcio, but I believe the chance is quite small given it's such a small
library. And giving it's such a small library, the benifits like compile
time or package size described above may be too small to be observed.

When using the built-in cmake to build zlib, it changes the source tree
as madler/zlib#162 describes. This leads to the failure during
[generating the docs][1]. So let's switch to libz-sys instead, which
uses its own custom script to build zlib, and leave source tree as it
is. Switching to libz-sys can also reduce the package size as we can
ignore more sub modules. It should improve compile time if libz-sys is
also a dependency of other crates.

The only shortcoming is that libz-sys may not be compatible with
grpcio, but I believe the chance is quite small given it's such a small
library. And giving it's such a small library, the benifits like compile
time or package size described above may be too small to be observed.

[1]: https://docs.rs/crate/grpcio/0.5.0-alpha.5/builds/196235.

Signed-off-by: Jay Lee <[email protected]>
@BusyJay BusyJay added Build Compilation, environment BugFix PR fixes bugs labels Dec 20, 2019
@BusyJay BusyJay requested review from overvenus and hicqu December 20, 2019 12:49
BusyJay added a commit to BusyJay/libz-sys that referenced this pull request Dec 20, 2019
Common cmake script uses builtin `FindZLIB` module to find where zlib is
installed. The cmake crate allows `register_dep` to hint cmake to search
the right place. libz-sys puts the library under build directory, which
is however not the place where cmake is going to search. So this PR
corrects the behaivior by moving the built library to lib directory.

Another option is to set the root directory to build instead, but the
layout may not look good.

It has been an issue for downstream projects like tikv/rust-rocksdb#303.
and tikv/grpc-rs#419.
BusyJay added a commit to BusyJay/libz-sys that referenced this pull request Dec 20, 2019
Common cmake script uses builtin `FindZLIB` module to find where zlib is
installed. The cmake crate allows `register_dep` to hint cmake to search
the right place. libz-sys puts the library under build directory, which
is however not the place where cmake is going to search. So this PR
corrects the behavior by moving the built library to lib directory.

Another option is to set the root directory to build instead, but the
layout may not look good.

It has been an issue for downstream projects like tikv/rust-rocksdb#303.
and tikv/grpc-rs#419.
grpc-sys/build.rs Outdated Show resolved Hide resolved
Signed-off-by: Jay Lee <[email protected]>
Signed-off-by: Jay Lee <[email protected]>
@BusyJay
Copy link
Member Author

BusyJay commented Jan 15, 2020

@hicqu @nrc PTAL

Copy link
Contributor

@nrc nrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@BusyJay BusyJay merged commit 6ed6767 into tikv:v0.4.x Jan 23, 2020
@BusyJay BusyJay deleted the use-libz-sys branch January 23, 2020 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugFix PR fixes bugs Build Compilation, environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants