微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Thrift 动态库编译

进入lib/cpp执行make 编译libthrift

1)./src/thrift/Thrift.h:48:39: Fatal error: boost/utility/enable_if.hpp: No such file or directory
 #include <boost/utility/enable_if.hpp>

解决    yum install boost-devel

2)/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_accept'

/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_shutdown'
/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_get_shutdown'
/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_CTX_ctrl'
/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `X509_NAME_ENTRY_get_data'
/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_get_error'
/opt/thrift-0.9.0/lib/cpp/.libs/libthrift.so: undefined reference to `SSL_CTX_free'
collect2: error: ld returned 1 exit status
make[1]: *** [Benchmark] 错误 1
make[1]: 离开目录“/opt/thrift-0.9.0/lib/cpp/test”

解决    修改编辑/opt/thrift-0.9.0/lib/cpp/test/Makefile文件链接库-lrt -lpthread 添加 -lssl -lcrtypto

编译错误:语法支持问题

src/generate/t_rb_generator.cc: In member function ‘virtual void t_rb_generator::generate_enum(t_enum*)’:
src/generate/t_rb_generator.cc:359:11: error: operands to ?: have different types ‘bool’ and ‘std::basic_ostream<char>’
     first ? first = false : f_types_ << ", ";
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/generate/t_rb_generator.cc:369:11: error: operands to ?: have different types ‘bool’ and ‘std::basic_ostream<char>’
     first ? first = false : f_types_ << ", ";
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:749: thrift-t_rb_generator.o] Error 1
make[3]: Leaving directory '/home/dong/thrift-0.9.0/compiler/cpp'

解决

将    first ? first = false : f_types_ << ", ";

修改

    if(first)
    {
            first = false :
    }
    else
    {
            f_types_ << ", ";
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐