Kshitiz Sharma
Kshitiz Sharma

Reputation: 18627

Protobuf cannot find shared libraries

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

Upvotes: 78

Views: 86827

Answers (5)

Hannah Zhang
Hannah Zhang

Reputation: 499

I had install and uninstall different versions of protoc. Whenever I tried the command line:

`protoc --version`

I had this error:

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

When I did:

apt-file search libprotoc.so.10

the result is:

libprotoc10: /usr/lib/x86_64-linux-gnu/libprotoc.so.10
libprotoc10: /usr/lib/x86_64-linux-gnu/libprotoc.so.10.0.0

However, I don't have libprotoc.so.10 under /usr/lib/x86_64-linux-gnu/ my libprotoc.so files are under /usr/local/lib The fix for me is:

`sudo apt-get autoclean`

or

'sudo apt-get clean'

Upvotes: 0

Abdelrahman Yosry
Abdelrahman Yosry

Reputation: 101

You can also use

$ sudo ldconfig # refresh shared library cache.

as stated at the installation page

Upvotes: 9

stevenloo
stevenloo

Reputation: 61

This issue can be resolved by following these steps:

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

Upvotes: 6

Sushantkumar M
Sushantkumar M

Reputation: 337

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

Upvotes: 3

Kshitiz Sharma
Kshitiz Sharma

Reputation: 18627

sudo ldconfig

or

export LD_LIBRARY_PATH=/usr/local/lib

should solve the problem.

Upvotes: 264

Related Questions