首页 > 编程语言 >编译gRPC相关示例程序,undefined reference to `deflateInit2_'等相关错误解决

编译gRPC相关示例程序,undefined reference to `deflateInit2_'等相关错误解决

时间:2022-11-01 02:11:38浏览次数:76  
标签:undefined reference 示例 cc zlib compress message

编译gRPC相关示例程序时,出现如下链接错误:
/home/suph/.local/lib/libgrpc.a(message_compress.cc.o): In function `zlib_compress(grpc_slice_buffer*, grpc_slice_buffer*, int)':
message_compress.cc:(.text+0x5c8): undefined reference to `deflateInit2_'
message_compress.cc:(.text+0x62b): undefined reference to `deflate'
message_compress.cc:(.text+0x6ed): undefined reference to `deflateEnd'
/home/suph/.local/lib/libgrpc.a(message_compress.cc.o): In function `zlib_decompress(grpc_slice_buffer*, grpc_slice_buffer*, int)':
message_compress.cc:(.text+0x7b4): undefined reference to `inflateInit2_'
message_compress.cc:(.text+0x813): undefined reference to `inflate'
message_compress.cc:(.text+0x8a7): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status

经查询上述报错中,相关符号在zlib库中定义。

进入grpc/thirdparty/zlib目录,ls查看当前目录为空。

git pull单独下载zlib库源码程序

重新编译安装gRPC

 

问题:zlib源码下载成功后,是否可以单独编译安装zlib,而不是要重新编译整个gRPC

 

标签:undefined,reference,示例,cc,zlib,compress,message
From: https://www.cnblogs.com/suphgcm/p/16846469.html

相关文章