Protobuf 无法找到共享库

我使用以下命令安装了 Protobuf:

./configure
make
make check
make install

然而,当我运行 protoc时,我得到以下错误:

protoc: error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory
76272 次浏览
sudo ldconfig

or

export LD_LIBRARY_PATH=/usr/local/lib

should solve the problem.

This issue can be resolved by following these steps:

sudo make uninstall
sudo make distclean
sudo make clean
./configure --prefix=/usr

This cleans the current installation and installs protobuf at /usr Run ldconfig to update ld.so.cache after making sure that /usr/local/lib is listed in /etc/ld.so.conf. i.e. Edit /etc/ld.so.conf and append /usr/local/lib to it and run ldconfig

This issue can be resolved by following these steps:

  1. vim /etc/ld.so.conf
  2. /usr/local/lib(add it in .conf)

You can also use

$ sudo ldconfig # refresh shared library cache.

as stated at the installation page