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 sure the zlib cmake do not pollute the working directly. #162

Open
lygstate opened this issue Sep 14, 2016 · 7 comments
Open

Make sure the zlib cmake do not pollute the working directly. #162

lygstate opened this issue Sep 14, 2016 · 7 comments

Comments

@lygstate
Copy link

No description provided.

@praiskup
Copy link

s/directly/directory/? Yes:

chmod -R -w .
cd ..
mkdir builddir && cd builddir
cmake ../zlib
...
CMake Error at CMakeLists.txt:77 (file):
  file RENAME failed to rename

    /tmp/zlib/zconf.h

  to

    /tmp/zlib/zconf.h.included

  because: Permission denied

@praiskup
Copy link

However reading FAQ:

 7. Why don't you use GNU autoconf or libtool or ...?

    Because we would like to keep zlib as a very small and simple package.
    zlib is rather portable and doesn't need much configuration.

I doubt cmake is needed at all.

@lygstate
Copy link
Author

@praiskup Under win32, cmake is far more better usable than autoonf or libtool

@praiskup
Copy link

@lygstate that's possible, I'm not able to confirm though. What I tried to say is, when autotools are not needed, most probably neither cmake is.

@BusyJay
Copy link

BusyJay commented Jul 4, 2017

+1 for this. I have a project include zlib as submodule. Every time I build my project, it will show that the zlib submodule is in dirty state, which is very annoying.

jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

This fixes madler#162
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

This fixes madler#162
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

This fixes madler#162
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
jeking3 pushed a commit to jeking3/zlib that referenced this issue Nov 23, 2017
pull requests through Travis CI and Appveyor.

Fix cygwin build issues.

Recommend everyone use cmake to generate build
environments, and consider checked-in projects
or makefiles to be deprecated.  The generated
build will always be correct, and proven by CI.

This fixes madler#162
This fixes madler#238
This fixes madler#307
@jeking3
Copy link

jeking3 commented Nov 23, 2017

Yikes, sorry for the spam... I didn't realize it would post something with every force push.

BusyJay added a commit to BusyJay/grpc-rs that referenced this issue 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][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 shortcomming is that libz-sys may not be compitable with
grpcio, but I believe the chance is quite small given it's such a small
library.

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

Signed-off-by: Jay Lee <busyjaylee@gmail.com>
BusyJay added a commit to BusyJay/grpc-rs that referenced this issue 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][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 shortcomming is that libz-sys may not be compitable with
grpcio, but I believe the chance is quite small given it's such a small
library.

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

Signed-off-by: Jay Lee <busyjaylee@gmail.com>
BusyJay added a commit to BusyJay/grpc-rs that referenced this issue 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][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 to too small to be observed.

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

Signed-off-by: Jay Lee <busyjaylee@gmail.com>
BusyJay added a commit to BusyJay/grpc-rs that referenced this issue 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][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 <busyjaylee@gmail.com>
BusyJay added a commit to BusyJay/grpc-rs that referenced this issue 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][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 <busyjaylee@gmail.com>
BusyJay added a commit to tikv/grpc-rs that referenced this issue Dec 25, 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][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 benefits 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 <busyjaylee@gmail.com>
BusyJay added a commit to tikv/grpc-rs that referenced this issue Jan 23, 2020
* *: use libz-sys instead of bundled one

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 <busyjaylee@gmail.com>
@inkychris
Copy link

The way CMake is currently set up, the name conflict in the source directory doesn't actually matter, the header path for zconf.h is already defined as ${CMAKE_CURRENT_BINARY_DIR}/zconf.h so we can just remove the renaming here

zlib/CMakeLists.txt

Lines 69 to 79 in 21767c6

if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# If we're doing an out of source build and the user has a zconf.h
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
endif()
endif()

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

6 participants
@lygstate @BusyJay @praiskup @jeking3 @inkychris and others