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.youkuaiyun.com/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.youkuaiyun.com/witton/article/details/78647504
9,另外,还有采用rebar 的方案,有待研究。
本文详细介绍了如何在Windows环境下,通过安装Git和Cygwin64来编译gpb源码。步骤包括下载安装Git和Cygwin64,克隆gpb仓库,处理因换行符导致的错误,以及执行编译脚本。此外,还提供了处理脚本错误的方法和单个文件编译的命令。如果遇到问题,文中给出了相关链接供参考,同时提到了使用rebar作为替代方案的可能性。
864

被折叠的 条评论
为什么被折叠?



