Closed jmin911 closed 6 years ago
Sorry, Windows is not our most loved target platform. There's an open ticket to add prometheus-cpp to vcpkg: #130. If you need the missing functionality (or convenience) maybe you can take a look?
Google Benchmark is an optional dependency used only for benchmarks that are used by prometheus-cpp developers. It is not part of any library and usually end users should not need those. So just ignore the message.
The curl
dependency is solely used for the Push Gateway support. If you don't run short-lived micro services the prometheus pull exposer might better serve your needs. Just disable the push library by setting the ENABLE_PUSH=OFF
CMake option. If the option is not enabled, the curl lookup will be omitted.
Even short lived microservices are well supported to be dynamically added/removed from your config if you are using one of the service discovery mechanisms (Azure/AWS/GCE/Kubernetes/Consul/Mesos/...) described in https://prometheus.io/docs/prometheus/latest/configuration/configuration/. You really shouldn't use the push gateway except in some edge cases (mainly a NAT being between your services and prometheus, but why would you ... ). See https://prometheus.io/docs/practices/pushing/ for details.
If push is not recommended, should it be disabled by default? option(ENABLE_PUSH "Build prometheus-cpp push library" OFF)
There is a bug in cmake/cpr-config.cmake
on line 50:
target_include_directories(cpr PUBLIC ${CPR_INCLUDE_DIR})
This should also include the curl header file libraries:
target_include_directories(cpr PUBLIC ${CPR_INCLUDE_DIR} ${CURL_INCLUDE_DIR})
Without this, the build will only succeed if the curl header files are in the system include directory (/usr/local/include
on Linux IIRC) instead of using the include directory found by CMake's find_package
.
With this change I was able to install and run the prometheus-cpp demo on my Windows machine (curl was installed through vcpkg). Google Benchmark is not required, ignore the error if you are not interested in building the benchmarks.
Now it demands ZLIB:
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.13/Modules/FindZLIB.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) pull/CMakeLists.txt:10 (find_package)
I tried setting ENABLE_PUSH=OFF but it did not help.
When I set ENABLE_COMPRESSION=OFF
Could NOT find CURL (missing: CURL_LIBRARY) (found version "7.60.0") Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.13/Modules/FindCURL.cmake:74 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) push/CMakeLists.txt:2 (find_package)
When I set ENABLE_COMPRESSION=OFF and ENABLE_PUSH=OFF generating was successful.
Once #130 is resolved it will provide a convenient way to install prometheus-cpp on Windows.
Windows build has errors indicating that Google Benchmark library is needed. Also is CURL needed?
-- Could NOT find GoogleBenchmark (missing: GoogleBenchmark_LIBRARY GoogleBenchmark_INCLUDE_DIR) CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)