79

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

4 Answers 4

263
sudo ldconfig

or

export LD_LIBRARY_PATH=/usr/local/lib

should solve the problem.

6
  • 3
    @Bagzerg protoc needs to know where to look for shared libraries. (It cannot search your whole system). This is similar to how PATH helps in locating executables. See this post here that explains LD_LIBRARY_PATH. Feb 18, 2015 at 13:29
  • as of Feb 2016, installed protocol-buffers 2.6.1 on debian 8, and this solved the problem for missing libraries. Thanks @KshitizSharma Feb 18, 2016 at 16:57
  • i used the second method "export..." , but i dont know why the first method doesn't work.
    – lirui
    Mar 9, 2016 at 7:16
  • 3
    Thanks. It did the job. However, I think, it is more appropriate to use this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    – ponir
    Jun 9, 2016 at 18:07
  • 1
    Lol for me restarting the machine fixed the problem Mar 25, 2018 at 20:55
10

You can also use

$ sudo ldconfig # refresh shared library cache.

as stated at the installation page

6

This issue can be resolved by following these steps:

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

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

1
  • 2
    You've got two separate solutions mixed together here (using ldconfig and simply installing to /usr). Very confusing answer. Oct 6, 2015 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.