linux install protobuf3.6.1 install c ++ compiler and errors encountered during installation

 

https://www.jianshu.com/p/83fde1089fea

1 source download

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf/
git submodule update --init --recursive
./autogen.sh

2 Preparations

Before installing ensure the following tools, without the self-install:

autoconf
automake 
libtool   
make  
g++  
unzip

On Ubuntu/Debian, you can install them with:

    $ sudo apt-get install autoconf automake libtool curl make g++ unzip

 

3 Installation protobuf

Then execute the following command to install a little longer, be patient (automated scripts can be written, there is no need to perform step by step):

./configure 
make 
make check 
sudo make install 
sudo ldconfig  # refresh shared library cache.

At this general
libprotobuf library under / usr / local / lib path
protoc generally in / usr / local / bin path

4 Environment Configuration

The following environment configuration, based on pathways where more than two files, the following command in my actual environment configuration, the specific path specific changes

$ sudo vim /etc/profile

Add to

export PATH=$PATH:/usr/local/bin/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

Save execution

source /etc/profile

5 configure dynamic library path

sudo vim /etc/ld.so.conf

add to

/usr/local/protobuf/lib

And then update the dynamic library path as root

 

ldconfig

 


./configure -prefix=/usr/local/


sudo make #要编译很久

sudo make check

sudo make install

 

 Error Case 1:

configure: error: invalid variable name: `–prefix'

The correct format: the front of the prefix "-" to "-"

例如:./configure --with-http_stub_status_module "--prefix=/usr/webservice/nginx" --with-pcre=/home/tang/ 下载/pcre-8.20 
 

 Error Case 2:

Sudo make a mistake when I was

v2x@ubuntu:~/Desktop/protoBuf/protobuf-3.6.1$ sudo make
make  all-recursive
make[1]: Entering directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1'
Making all in .
make[2]: Entering directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1'
make[2]: Leaving directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1'
Making all in src
make[2]: Entering directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1/src'
depbase=`echo google/protobuf/stubs/bytestream.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
../-libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -g -std=c++11 -DNDEBUG -MT google/protobuf/stubs/bytestream.lo -MD -MP -MF $depbase.Tpo -c -o google/protobuf/stubs/bytestream.lo google/protobuf/stubs/bytestream.cc &&\
mv -f $depbase.Tpo $depbase.Plo
/bin/bash: line 1: ../-libtool: Permission denied
Makefile:3969: recipe for target 'google/protobuf/stubs/bytestream.lo' failed
make[2]: *** [google/protobuf/stubs/bytestream.lo] Error 126
make[2]: Leaving directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1/src'
Makefile:1537: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/v2x/Desktop/protoBuf/protobuf-3.6.1'
Makefile:1444: recipe for target 'all' failed
 

problem:

python 使用protobuf出错:protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object file:No such...

Solution: linux tap command: export LD_LIBRARY_PATH = / usr / local / lib
 

 

The system linux version of the compiler arm protobuf library

https://blog.csdn.net/nicebooks/article/details/17962335

Published 101 original articles · won praise 73 · views 120 000 +

Guess you like

Origin blog.csdn.net/usstmiracle/article/details/103401948