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

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) #409

Closed
sandersaares opened this issue Nov 11, 2020 · 5 comments
Closed

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) #409

sandersaares opened this issue Nov 11, 2020 · 5 comments

Comments

@sandersaares
Copy link

Trying to build the library with CMake, following "via CMake" instructions in readme, I get error during cmake step:

c:\Source\prometheus-cpp\_build>cmake .. -DBUILD_SHARED_LIBS=ON
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.27.29112.0
-- The CXX compiler identification is MSVC 19.27.29112.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find benchmark (missing: benchmark_DIR)
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.17/Modules/FindZLIB.cmake:115 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  pull/CMakeLists.txt:20 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Source/prometheus-cpp/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Source/prometheus-cpp/_build/CMakeFiles/CMakeError.log".

Are the instructions incomplete or am I doing something wrong?

@sandersaares
Copy link
Author

-DENABLE_COMPRESSION=OFF is a workaround but building with compression would be nice to have.

@gjasny
Copy link
Collaborator

gjasny commented Nov 11, 2020

Hello,

we do not ship a copy of zlib because on unices many libraries depend on the system version of zlib and mixing two different versions in one process might cause trouble.

The easiest would be to consume prometheus-cpp via the vcpkg package manager where all the dependencies are properly integrated.

The other option would be that you compile zlib on your own and give CMake a hint where to find it.

If that does not work for you we could take a look at adding zlib to the 3rdparty folder and use it only on Windows.

Hope this helps,
Gregor

@sandersaares
Copy link
Author

vcpkg is, unfortunately, not possible to use in our case due to organization policy constraints.

I suppose building it ourselves is probably doable. Now that I think about it, I suspect we will need to do that anyway to get a build that references static runtime libraries! Hmm, this does not even seem to be supported by zlib cmake configuration by the look of it: madler/zlib#282

Anyway, we will be happy to make use of any enhancements you can do to make it as easy as possible for us to consome prometheus-cpp with zlib support on Windows (e.g. including it in 3rdparty). For now, I think we will try to survive without it just to avoid the hassle.

A note in the readme build guide saying that -DENABLE_COMPRESSION=OFF is expected (or defaulting it to off?) might be helpful to ensure others who try to build do not have a bad first time experience, though.

@gjasny
Copy link
Collaborator

gjasny commented Sep 9, 2021

Hello,

I updated the Readme example to contain -DENABLE_COMPRESSION=OFF.

Thanks,
Gregor

@gjasny
Copy link
Collaborator

gjasny commented Nov 16, 2021

I tried to add zlib in an elegant way. Neither adding it as a submodule nor ExternalProject felt elegant. Combined with choices for DLL/non-DLL and runtime I believe zlib is best configured externally (or via a package manager).

Sorry, right now I cannot support a convenient drop-in solution.

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