Thrift第一课 源码编译

1)字符编码

Thrift采用多字节的编码方式,在使用log4cplus进行日志管理的时候,同样需要编译一个多字节的字符编码的版本,否则就会出现log4cplus中无法解析的函数符号

 

2)Boost链接动态库

libthrift

要求boost库的智能指针,线程库以及librt

注意:bool interruptible_wait(detail::win32::handle handle_to_wait_for,detail::timeout target_time)怀疑是boost版本之间的问题,主要是原本采用了1.58.0版本,后来使用了1.64.0版本的代码,初步认为是两者之间的线程代码出现了分歧,导致无法找到函数的定义,实际上并没有出现这种情况目前采用的boost库是动态编译出来的,因此必须指定正确的运行时库,否则就会编译出错,调用boost的动态库,需要注释掉上面的两行代码,但是在目前来看依旧出现依赖libboost_thread-vc140-mt-sgd-1_64.lib不过从这里其实已经可以看出,调用的确实是静态库,其中有s,gd代表的意思是调试,mt代表多线程,

因此链接到boost静态库,说明运行时库指定的不正确,应该指定MDT

详细的资料参考如下;

http://www.cnblogs.com/bluedoctor/p/6236905.html

http://blog.csdn.net/xucuiping_/article/details/5979532

In the project properties you must also set HAVE_CONFIG_H 

as force include the config header: "windows/confg.h"



By default lib/cpp/windows/force_inc.h defines:

#define BOOST_ALL_NO_LIB 1

#define BOOST_THREAD_NO_LIB 1



This has for effect to have the host application linking against Thrift to have to link with boost thread as a static library. If you wanted instead to link with boost thread 

as a shared library,you'll need to uncomment those two lines, and recompile.


3)libthriftnb

依赖libevent,因此需要链接libevent

 

 

从目前的情况下看,只能够编译出静态库版本的thrift,预示着整一个工程只能够链接静态库

Depending upon whether you are linkingdynamically or statically and how

your build environment it set up,

you may need to include additional

libraries when linking against thrift,

such as librt and/or libpthread. If

you are using libthriftnb you will alsoneed libevent.

 

http://blog.csdn.net/zengraoli/article/details/51320593

 

究竟在什么地方会使用到openssl

在编译对应的lib文件时,并不需要引入openssl,仅当调用使用thrift的时候,加入了头文件TServerTransport.h才需要到openssl

 

 

参考

http://blog.csdn.net/kuenking111/article/details/47701847






     本文转自fengyuzaitu 51CTO博客,原文链接:http://blog.51cto.com/fengyuzaitu/2071766,如需转载请自行联系原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值