Problem
Follow the steps below to compile and install Google Protocol on Ubuntu buffers
Run
There are no errors found for the dynamic library
Reason
The default installation location for protobuf is /usr/local,/usr/local/lib is not the default Ld_library_path of the Ubuntu system in. The question protobuf README.txt to write clearly and blame himself for not being careful.
* * Hint on install location * *
By default, the package would be installed to/usr/local. However,
On many platforms,/usr/local/lib are not part of Ld_library_path.
You can add it, but it is easier to just install TO/USR
instead. To does this, invoke configure as follows:
./configure--PREFIX=/USR
If you already built the package with a different prefix, make sure
To run before building again.
Solve
There are several methods available in the reference article, only one of which is used here.
Method 1:
1. Create a file /etc/ld.so.conf.d/libprotobuf.conf contains content
/usr/local/lib
2. Run the command
Then run protoc--version to get the version number.
Method 2:
- Vim/etc/profile
- Export ld_library_path=~/protobuf-2.5.0
- Source/etc/profile
- $ sudo ldconfig
(Ld_library_path Here, fill in the location of the Protobuf file )
About loading paths for Linux dynamic libraries