Monday, 29 June 2015

Thrift compilation error


I was trying to compile and install thrift from https://github.com/apache/thrift.
While compiling the thrift for 6 and 8 version i faced few errors and had to spend lot of time fixing it   (Including searching various solutions on Net).

Let me  detail out few error and solution for it.

  • Missing thrifty.h 

src/thriftl.ll:50:21: fatal error: thrifty.h: No such file or directory
compilation terminated.
make[3]: *** [libparse_a-thriftl.o] Error 1
make[3]: Leaving directory `/home/abc/thrift/compiler/cpp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/abc/thrift/compiler/cpp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/abc/thrift'
make: *** [all] Error 2

Solution ->
You will have thrifty.hh file instead of thrifty.h.
Location of file would be 
./compiler/cpp/thrifty.hh

 cp ./compiler/cpp/thrifty.hh ./compiler/cpp/thrifty.h
and start your compilation again, It should work.
  • Non static declaration error
struct.c:28:1: error: static declaration of âstrlcpyâ follows non-static declaration
/usr/include/ruby-1.9.1/ruby/missing.h:198:20: note: previous declaration of âstrlcpyâ was here
make[4]: *** [struct.o] Error 1
make[4]: Leaving directory `/home/abc/thrift/lib/rb/ext'
setup.rb:655:in `command': system("make") failed (RuntimeError)
        from setup.rb:664:in `make'
        from setup.rb:1258:in `setup_dir_ext'
        from setup.rb:1532:in `block in traverse'
        from setup.rb:1549:in `dive_into'
        from setup.rb:1530:in `traverse'
        from setup.rb:1524:in `block in exec_task_traverse'
        from setup.rb:1519:in `each'
        from setup.rb:1519:in `exec_task_traverse'
        from setup.rb:1246:in `exec_setup'
        from setup.rb:996:in `exec_setup'
        from setup.rb:826:in `invoke'
        from setup.rb:773:in `invoke'
        from setup.rb:1578:in `<main>'

Solution ->
 You will have file name struct.c in  ./lib/rb/ext/struct.c
Comment the line 26(approx) and text static, comment the line with /*static*/
and start your compilation again, It should work.