Bo Yu
Bo Yu

Reputation: 11

compile grpc erro zlib_compress and zlib_decompress

when I compile grpc according to https://grpc.io/docs/languages/cpp/quickstart/, after I run the command "make", I encounter such error messages:

Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      zlib_compress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_compress_gzip(grpc_stream_compression_context*, grpc_slice_buffer*, grpc_slice_buffer*, unsigned long*, unsigned long, grpc_stream_compression_flush) in libgrpc.a(stream_compression_gzip.cc.o)
      grpc_stream_compression_context_create_gzip(grpc_stream_compression_method) in libgrpc.a(stream_compression_gzip.cc.o)
  "_deflateEnd", referenced from:
      zlib_compress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_compression_context_destroy_gzip(grpc_stream_compression_context*) in libgrpc.a(stream_compression_gzip.cc.o)
  "_deflateInit2_", referenced from:
      zlib_compress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_compression_context_create_gzip(grpc_stream_compression_method) in libgrpc.a(stream_compression_gzip.cc.o)
  "_inflate", referenced from:
      zlib_decompress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_decompress_gzip(grpc_stream_compression_context*, grpc_slice_buffer*, grpc_slice_buffer*, unsigned long*, unsigned long, bool*) in libgrpc.a(stream_compression_gzip.cc.o)
      grpc_stream_compression_context_create_gzip(grpc_stream_compression_method) in libgrpc.a(stream_compression_gzip.cc.o)
      grpc_stream_compression_context_destroy_gzip(grpc_stream_compression_context*) in libgrpc.a(stream_compression_gzip.cc.o)
      gzip_flate(grpc_stream_compression_context_gzip*, grpc_slice_buffer*, grpc_slice_buffer*, unsigned long*, unsigned long, int, bool*) in libgrpc.a(stream_compression_gzip.cc.o)
  "_inflateEnd", referenced from:
      zlib_decompress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_compression_context_destroy_gzip(grpc_stream_compression_context*) in libgrpc.a(stream_compression_gzip.cc.o)
  "_inflateInit2_", referenced from:
      zlib_decompress(grpc_slice_buffer*, grpc_slice_buffer*, int) in libgrpc.a(message_compress.cc.o)
      grpc_stream_compression_context_create_gzip(grpc_stream_compression_method) in libgrpc.a(stream_compression_gzip.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libgrpc_csharp_ext.15.0.0.dylib] Error 1
make[1]: *** [CMakeFiles/grpc_csharp_ext.dir/all] Error 2
make: *** [all] Error 2

Upvotes: 0

Views: 532

Answers (1)

Bo Yu
Bo Yu

Reputation: 11

I miss the task of git clone thirty-party/zlib is failed, I'm so sorry about it. when build grpc, I encounter a error message:

  1. gRPC_ABSL_PROVIDER is "module" but ABSL_ROOT_DIR is wrong Solution: reference to https://github.com/spack/spack/issues/15619 and https://github.com/spack/spack/pull/16052 under grpc folder, run the following command
        git submodule update --init

and then

cd ./cmake/build

and run the following command

    cmake -DgRPC_INSTALL=ON \
          -DgRPC_BUILD_TESTS=OFF \
          -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \
          ../..
  1. thirty-party of zlib git clone fail lead to cmake fail, just need to go to thirty-party folder
cd thirty-party/

and

git clone https://github.com/madler/zlib
  1. third_party/abseil-cpp compile fail because its CMakeList.txt need add one line, which is
set(CMAKE_CXX_FLAGS "-std=c++11")

at the begining but after the cmake_minimum_required(***). reference to https://www.jianshu.com/p/08fdf54fbf43

  1. when install abseil-cpp, I encounter a issue: CMake Error at cmake_install.cmake:53 (file): file cannot create directory: /lib/cmake/absl. Maybe need administrative privileges. this is because I undef MY_INSTALL_DIR. Maybe u change the window, and at that window, u don't export MY_INSTALL_DIR

Upvotes: 1

Related Questions