Protobuf cannot find shared libraries

Protocol Buffers

Protocol Buffers Problem Overview


I have installed protobuf by using following commands:

./configure
make
make check
make install

However when I run protoc I get following error:

protoc: error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory

Protocol Buffers Solutions


Solution 1 - Protocol Buffers

sudo ldconfig

or

export LD_LIBRARY_PATH=/usr/local/lib

should solve the problem.

Solution 2 - Protocol Buffers

You can also use

$ sudo ldconfig # refresh shared library cache.

as stated at the installation page

Solution 3 - Protocol Buffers

This issue can be resolved by following these steps:

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

Solution 4 - Protocol Buffers

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKshitiz SharmaView Question on Stackoverflow
Solution 1 - Protocol BuffersKshitiz SharmaView Answer on Stackoverflow
Solution 2 - Protocol BuffersAbdelrahman YosryView Answer on Stackoverflow
Solution 3 - Protocol BuffersstevenlooView Answer on Stackoverflow
Solution 4 - Protocol BuffersSushantkumar MView Answer on Stackoverflow