ivanmejiarocha / micro-service

sample micro-service in C++
MIT License
263 stars 129 forks source link

micro-service ( trying to build in Ubuntu 18.04 machine), but zlip path is empty in CMakeLists.txt #28

Open DLinIoTedge opened 3 years ago

DLinIoTedge commented 3 years ago

Hello Ivan, good morning.

I am working with steps and code given in https://github.com/ivanmejiarocha/micro-service , during mentioned workflow there is challenge coming up from non availability of functions from zlip

Machine: Ubuntu 18.04 X86 AMD libcpprest.a is created by using ./build_dependencies.sh cmake is done in micro-service/build$
make -j 8 the following error message coming ( done in micro-service/build )

 **undefined reference to `deflate'**

_http_compression.cpp:(.text._ZN3web4http11compression7builtin20zlib_compressor_base8compressEPKhmPhmNS1_14operation_hintERmRb[_ZN3web4http11compression7builtin20zlib_compressor_base8compressEPKhmPhmNS1_14operationhintERmRb]+0x17f): undefined reference to `deflate' collect2: error: ld returned 1 exit status

HINT ZIP_LIBRARY appears to be empty in after
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. @ivanmejiarocha Could you kindly advice Thanks a lot in advance jk

yfyang86 commented 1 year ago

TL;DR:

Long ANS

In the CMakefile. Only ${CPPRESTSDK_LIBRARY} ${OPENSSL_LIBS} ${Boost_LIBRARIES} are added, but not the ZLIB_LIBRARY one.

# library search paths ...
if(APPLE)
    set(OPENSSL_LIBS "/usr/local/Cellar/openssl/${OPENSSL_VERSION}/lib/libssl.1.0.0.dylib;/usr/local/Cellar/openssl/${OPENSSL_VERSION}/lib/libcrypto.1.0.0.dylib")
    set(CPPRESTSDK_LIBRARY "${PROJECT_SOURCE_DIR}/libs/cpprestsdk/build.release/Binaries/libcpprest.a")
    set(ZIP_LIBRARY "/usr/local/Cellar/zlib/1.2.11/lib/libz.dylib")

    set(LIBRARIES_SEARCH_PATHS ${OPENSSL_LIBS} ${Boost_LIBRARIES} ${CPPRESTSDK_LIBRARY} ${ZIP_LIBRARY})
else()
    set(OPENSSL_LIBS "${OPENSSL_LIBRARIES}")
    set(CPPRESTSDK_LIBRARY "${PROJECT_SOURCE_DIR}/libs/cpprestsdk/build.release/Binaries/libcpprest.a")

    set(LIBRARIES_SEARCH_PATHS ${CPPRESTSDK_LIBRARY} ${OPENSSL_LIBS} ${Boost_LIBRARIES})
endif()
ivanmejiarocha commented 1 year ago

Please verify why is falling into the APPLE case, due to you are on Linux it should no be looking for the zip library.