protobuf库冲突如何解决

一个可执行程序中,定位模块底层依赖protobuf3.3.0 中间件Fdbus依赖protobuf3.9.0 这样编译成的程序,运行会报错 说冲突,然后我将protobuf3.9.0编译成静态库,然后运行还是报错:

[libprotobuf FATAL google/protobuf/stubs/common.cc:86] This program was compiled against version 3.3.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.9.0).  Contact the program author for an update.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  This program was compiled against version 3.3.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.9.0).  Contact the program author for an update.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "google/protobuf/any.pb.cc".)
Aborted

尝试解决:利用soname将protobuf链接库名字改变,实际安装protobu库的时候,库安装成功了,但是 通过

radelf -d xxx.so


```  查询  并没有 发现soname变化  
---------------------------------------------------------------------
##readelf -d libprotobuf.so
-----------------------------------------------------------------------
Dynamic section at offset 0x6e48c0 contains 30 entries:
  标记        类型                         名称/值
 0x0000000000000001 (NEEDED)             共享库:[libpthread.so.0]
 0x0000000000000001 (NEEDED)             共享库:[libstdc++.so.6]
 0x0000000000000001 (NEEDED)             共享库:[libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             共享库:[libc.so.6]
 0x0000000000000001 (NEEDED)             共享库:[ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libprotobuf.so.3.9.0.0]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
---------------------------------------------------------------------------------------------------------------------
然后附上  我加的soname的方式  :
直接在protobuf/cmake/CmakeList.txt中加入下面的add_compile_options
add_compile_options("-Wl,-soname=libmyprotobuf.so.1")

生成的falg.make如下:
------------------------------------------------------------------------------------------

```bash
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.10

# compile CXX with /usr/bin/c++
CXX_FLAGS = -fPIC   -Wl,-soname=libmyprotobuf.so.1 -std=c++11

CXX_DEFINES = -DGOOGLE_PROTOBUF_CMAKE_BUILD -DHAVE_PTHREAD -Dlibprotobuf_EXPORTS

CXX_INCLUDES = -I/home/wanji/wcw_docker/Target1_fdbus/protobuf_cross_v3.9.0/build_soname -I/home/wanji/wcw_docker/Target1_fdbus/protobuf_cross_v3.9.0/src 


那么我应该是soname使用的没问题吧
关键为啥 也改变不了 soname的连接属性呢 奇怪

折腾了一天没解决冲突的问题 ,求亲们支招啊
感谢

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。