Reputation: 11
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
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:
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 \
../..
cd thirty-party/
and
git clone https://github.com/madler/zlib
set(CMAKE_CXX_FLAGS "-std=c++11")
at the begining but after the cmake_minimum_required(***). reference to https://www.jianshu.com/p/08fdf54fbf43
Upvotes: 1