<div dir="ltr">Hi, Rebar by default uses another protobuf compiler for any *.proto files it finds in the src subdirectory.<div><br></div><div style>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:</div>
<div style><br></div><div style><div><div> %% -*- erlang -*-</div><div> {pre_hooks,</div><div> [{compile, "mkdir -p include"}, %% ensure the include dir exists</div><div> {compile,</div><div> "erl +B -noinput -pa /path/to/gpb/ebin "</div>
<div> "-I`pwd`/proto -o-erl src -o-hrl include "</div><div> "-s gpb_compile c `pwd`/proto/x.proto"</div><div> }]}.</div><div><br></div><div> {post_hooks,</div><div> [{clean, "rm -f src/x.erl include/x.hrl"}]}.</div>
<div><br></div><div> {erl_opts, [{i, "/path/to/gpb/include"}]}.</div></div><div><br></div><div style>and the following initial file/directory layout:</div><div style><div><br></div><div><div> prompt# find .</div>
<div> .</div><div> ./proto</div><div> ./proto/x.proto</div><div> ./src</div><div> ./src/g_sup.erl</div><div> ./src/g.app.src</div><div> ./src/g_app.erl</div><div> ./rebar.config</div></div><div><br>
</div><div style>BRs</div><div style>Tomas</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 28, 2013 at 11:08 AM, Bin Wang <span dir="ltr"><<a href="mailto:wbin00@gmail.com" target="_blank">wbin00@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm using google protocol buffers. I found an erlang plugin named<br>
gpb(<a href="https://github.com/tomas-abrahamsson/gpb" target="_blank">https://github.com/tomas-abrahamsson/gpb</a>). But I don't know how<br>
to use it. When I add it as a dependency of my app using rebar, while<br>
compile, it always comes out this error:<br>
<br>
ERROR: Protobuffs library not present in code path!<br>
<br>
Which I searched in google and only found it in erlang_protobuffs<br>
code. I do use it as a dependency before, but dose it matters?<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>