2017-04-17 195 views
0

操作系統:Ubuntu 16.04衝突的Protobuf版本

我安裝protobuf的,與接下來的步驟:

sudo apt-get install autoconf automake libtool curl make g++ unzip 
wget https://github.com/google/protobuf/releases/download/v3.2.0/protobuf-cpp-3.2.0.tar.gz 
tar -xvf protobuf-cpp-3.2.0.tar.gz 
cd protobuf-3.2.0 
./autogen.sh 
./configure 
make 
make check 
sudo make install 
sudo ldconfig 

但是當我嘗試編譯我的程序。我收到以下錯誤

/home/arslan/www/src/main/build-controlpanel-Desktop_Qt_5_8_0_GCC_64bit-Debug/controlpanel 
[libprotobuf FATAL google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.2.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 "/build/mir-pkdHET/mir-0.21.0+16.04.20160330/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".) 
terminate called after throwing an instance of 'google::protobuf::FatalException' 
    what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.2.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 "/build/mir-pkdHET/mir-0.21.0+16.04.20160330/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".) 
The program has unexpectedly finished. 

我也有/usr/lib/x86_64-linux-gnu文件夾,以下文件:

./libprotobuf-lite.so.9.0.1 
./libprotobuf.so.9.0.1 
./libprotobuf.so.9 
./libprotobuf-lite.so.9 

如果刪除它們,程序將正常執行,但是Ubuntu會停留在開機

/dev/sda4: clean, xxxxxxx/xxxxxxx files, xxxxxx/xxxxxx blocks 

如何解決這個問題?

回答

0

它看起來像你混合你編譯的protobuf,與操作系統的protobuf。嘗試強制所有protoclibprotobuf的路徑。或者,如果可以的話,從Ubuntu卸載protobuf。

+0

它不起作用 –

2

qt5.9與protobuf 2.6.1有關;

我只是解決了這個通過用聯protobuf的靜態庫而非LIB

在project.pro

共享取代

LIB + = -lprotobuf

LIBS + = /usr/local/lib/libprotobuf.a