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


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