1,安装git;
Git - Downloading Package (git-scm.com)
2,安装cygwin64;
Cygwin Installation
3,启动cygwin64;
4,checkout github源码;
git clone https://github.com/tomas-abrahamsson/gpb
cd gpb
git checkout -b 3.20.2 3.20.2
make
5,如果出现如下错误
$'\r':command not found
对出错脚本(mk_version_hrl)执行命令
sed -i 's/\r//' mk_version_hrl
还有一种方法,可参考 https://blog.csdn.net/jacke121/article/details/109063048
6,cd bin
比如bin 下有protobuffs/proto 目录,内有proto 文件,可执行
./protoc-erl -I. -o-erl src -o-hrl include protobuffs/proto/*.proto
7,单个文件执行,或编写bat 批处理
escript protoc-erl -I. -o ./pb XX.proto
8,如果还有问题,参考 https://blog.csdn.net/witton/article/details/78647504
9,另外,还有采用rebar 的方案,有待研究。