[erlang-questions] How to use gpb?

Bin Wang wbin00@REDACTED
Mon Jul 1 05:58:42 CEST 2013


Hi, Tomas

Thanks for answering. But if I put all .proto files in directory
proto, how do I write the hooks to compile them all? I tried to use
*.proto instead of x.proto in pre_hooks, but it came with error: init
terminating in do_boot


2013/6/29 Tomas Abrahamsson <tomas.abrahamsson@REDACTED>:
> Hi, Rebar by default uses another protobuf compiler for any *.proto files it
> finds in the src subdirectory.
>
> One way to use gpb with rebar is to put your *.proto in another
> subdirectory, and use hooks to compile it. I got it working with the
> following stuff in rebar.config:
>
>     %% -*- erlang -*-
>     {pre_hooks,
>      [{compile, "mkdir -p include"}, %% ensure the include dir exists
>       {compile,
>        "erl +B -noinput -pa /path/to/gpb/ebin "
>        "-I`pwd`/proto -o-erl src -o-hrl include "
>        "-s gpb_compile c `pwd`/proto/x.proto"
>       }]}.
>
>     {post_hooks,
>      [{clean, "rm -f src/x.erl include/x.hrl"}]}.
>
>     {erl_opts, [{i, "/path/to/gpb/include"}]}.
>
> and the following initial file/directory layout:
>
>     prompt# find .
>     .
>     ./proto
>     ./proto/x.proto
>     ./src
>     ./src/g_sup.erl
>     ./src/g.app.src
>     ./src/g_app.erl
>     ./rebar.config
>
> BRs
> Tomas
>
>
> On Fri, Jun 28, 2013 at 11:08 AM, Bin Wang <wbin00@REDACTED> wrote:
>>
>> Hi,
>>
>> I'm using google protocol buffers. I found an erlang plugin named
>> gpb(https://github.com/tomas-abrahamsson/gpb). But I don't know how
>> to use it. When I add it as a dependency of my app using rebar, while
>> compile, it always comes out this error:
>>
>> ERROR: Protobuffs library not present in code path!
>>
>> Which I searched in google and only found it in erlang_protobuffs
>> code. I do use it as a dependency before, but dose it matters?
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list