linux下安装protobuf

1.去官网下载安装包https://github.com/google/protobuf/releases

2.解压安装包,并进入安装包

3.执行以下命令

./configure --prefix=/opt/local/protobuf
make
make check && make install

4.修改/ect/profile

####### add protobuf lib path ########
#(动态库搜索路径) 程序加载运行期间查找动态链接库时指定除了系统默认路径之外的其他路径
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/protobuf/lib/
#(静态库搜索路径) 程序编译期间查找动态链接库时指定查找共享库的路径
export LIBRARY_PATH=$LIBRARY_PATH:/opt/local/protobuf/lib/
#执行程序搜索路径
export PATH=$PATH:/opt/local/protobuf/bin/
#c程序头文件搜索路径
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/local/protobuf/include/
#c++程序头文件搜索路径
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/local/protobuf/include/
#pkg-config 路径
export PKG_CONFIG_PATH=/opt/local/protobuf/lib/pkgconfig/
######################################

 

你可能感兴趣的:(linux,java)