Protobuf compiler version 3.19.1 doesn‘t match library version 3.0.0

Error message

CMake Warning at /usr/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
  Protobuf compiler version 3.19.1 doesn't match library version 3.0.0
Call Stack (most recent call first):
  tools/onnx/CMakeLists.txt:2 (find_package)

An error is reported in cmake, showing that the protobuf compiler version 3.19.1 does not match the library file version 3.0.0.

  1. Terminal input whereis protocto check which paths protobuf is installed on
  2. which protocView the current default protobuf
  3. protoc --versionView the current default protobuf version
  4. sudo protoc --versionView the current default system-level protobuf version

Insert image description hereYou can see that the default system-level version is 3.0.0, and the default version is 3.19.1, so if there is a conflict, the default Path should be set to the system-level version.

Solution

Check the PATH variable and find that anaconda3 is closer than the system variable. We import the system variable and check the current default version again and find that it has been updated to 3.0.0.

(base) dzh@dzh-Lenovo-Legion-Y7000:~$ echo $PATH
/home/dzh/anaconda3/bin:/home/dzh/anaconda3/condabin:/opt/ros/melodic/bin:/opt/Qt5.9.0/5.9/gcc_64/bin:/home/dzh/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

(base) dzh@dzh-Lenovo-Legion-Y7000:~$ export PATH=/usr/bin:$PATH

(base) dzh@dzh-Lenovo-Legion-Y7000:~$ echo $PATH
/usr/bin:/home/dzh/anaconda3/bin:/home/dzh/anaconda3/condabin:/opt/ros/melodic/bin:/opt/Qt5.9.0/5.9/gcc_64/bin:/home/dzh/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

(base) dzh@dzh-Lenovo-Legion-Y7000:~$ protoc --version
libprotoc 3.0.0

Guess you like

Origin blog.csdn.net/qq_42257666/article/details/130240441