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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章