Protobuf version conflicts with Qt

今天在使用tensorflow的C庫的時候遇到一個問題.

 This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.6.1).  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-O8_xaj/mir-0.26.3+16.04.20170605/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.6.1).  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-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)

參考了下面的博客,

https://stackoverflow.com/questions/45703619/protobuf-version-conflicts-with-qt
但是我修改了libqgvtk.so名,還是不能用,後來想通過cmake來建立工程,使用cmake建立的工程就可以使用.Qt和protobuf的這個問題暫繞開.

cmake_minimum_required(VERSION 2.8)

project(tensorflow_c)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_MODULE_PATH "/usr/lib/cmake/eigen3/")

find_package(cmake_modules)
## System dependencies are found with CMake's conventions
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)

#set ( EIGEN3_INCLUDE_DIR  "/usr/include/eigen3" )
#set ( EIGEN3_INCLUDE_DIRS "/usr/include/eigen3" )

#add_executable(${PROJECT_NAME} "main.cpp")
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  includes
  ${EIGEN3_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)
message("123")

message("${EIGEN3_INCLUDE_DIRS}")

link_directories(/home/sl/Qt5.12.0/Project/tensorflow_c/libs)

## Declare a C++ library
add_library(tensorflow_object_detector_lib
  tensorflow_object_detector.cpp
  tensorflow_util.cpp
  tensorflow_object_detector_nodecore.cpp
)

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(tensorflow_object_detector ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
add_executable(tensorflow_object_detector main.cpp)

## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(tensorflow_object_detector tensorflow_object_detector_lib)

## Specify libraries to link a library or executable target against
target_link_libraries(tensorflow_object_detector
  ${OpenCV_LIBS}
  tensorflow_object_detector_lib
  tensorflow
)

message(${OpenCV_LIBS})

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章