Compiling thrift files with FBThrift

779 views
Skip to first unread message

va...@pinterest.com

unread,
Nov 10, 2014, 2:09:48 PM11/10/14
to faceboo...@googlegroups.com
Hi Folks,

This is an FBThrift question - however, I could not find a google group for the same - so posting it here. I compiled and installed Facebook folly and then compiled the thrift compiler in fbthrift. This created binary file named "bin/thrift1" which I assume to be the fbthrift compiler. I then compiled a thrift file using the following command:

bin/thrift1 --gen cpp -o <Dir> Ping.thrift

However, when I look at the generated files, I did not get any generated files using folly's IO buf or folly's wangle. This is unlike whats mentioned in the is CPP server link:


Can someone help with how to create a thrift server with all the goodness of IOBuf/wangle etc. ? It seems I have everything compiled but am missing some option to get the right set of generated thrift interfaces.

Thanks
Varun

agal...@rbonut.com

unread,
Jan 22, 2015, 2:47:08 PM1/22/15
to faceboo...@googlegroups.com
If you go into 

``` 
fbthrift-0.22.0/thrift/compiler/py
```

# as root
python setup.py install 

you'll get something inside /usr/local/lib/python2.7/dist-packages/....thrift_compiler...

Basically you can either do that or set your python path see the generated Makefile for that ($PY_LOCAL)

When you get all that working you just do a python -mthrift_compiler cpp2:option1,option2 thing.thrift. 

That's it.

Vadim Markovtsev

unread,
Mar 30, 2016, 9:49:00 AM3/30/16
to Folly: the Facebook Open-source LibrarY
I wish it was that simple: https://github.com/facebook/homebrew-fb/blob/master/fbthrift-compiler.rb

Looks like the pythonic compiler does not work.

четверг, 22 января 2015 г., 22:47:08 UTC+3 пользователь agal...@rbonut.com написал:

suresh sankaran

unread,
Jul 26, 2016, 4:26:30 PM7/26/16
to Folly: the Facebook Open-source LibrarY
Steps given by "agal...@rbonut.com " worked for me. Thanks a lot.  Is there any way to do similar cpp2 generation using thrift1 compiler binary instead of via python package?

Tam Vu

unread,
Jan 17, 2019, 2:49:52 AM1/17/19
to Folly: the Facebook Open-source LibrarY
As of now, I think you can gen cpp2 with thrift1 compiler, according to this issue:


./build/bin/thrift1 --gen mstch_cpp2 --templates ./thrift/compiler/generate/templates --out /tmp/ ./thrift/example/if/chatroom.thrift
Reply all
Reply to author
Forward
0 new messages