windows下使用thrift编译+示例+详解解决坑
来源:互联网 发布:linux ntpdate 脚本 编辑:程序博客网 时间:2024/06/03 13:29
Thrift 在windows下使用略坑!
win7sp1 环境
Thrift依赖环境很多,具体如下:
1. libevent-2.0.21-stable.tar.gz
2. openssl-OpenSSL_1_1_0d
3. git-thirft-0.9.3
4. boost_1_59_0.zip
5. vs2010
6. vs2010SP1
7. windows SDK 7.1 GRMSDKX_EN_DVD.iso
首先 坚决!!!不要使用 github上面 https://github.com/apache/thrift 直接下载的 thrift-0.9.3.tar.gz
推荐 使用git上,切换到指定tags下,指定版本,通过 git clone https://github.com/apache/thrift.git
下载源码方式编译,下载的源码跟下载的thrift-0.9.3.tar.gz内部不太一致,不过下载的源码也需要稍作修改,直接编译是无法编译通过
编译测试程序:
VS2010-SP1 测试程序 使用 /Mtd 编译
需要注意:指定头文件目录+lib目录
#include <transport/TSocket.h>
#include <transport/TBufferTransports.h>
#include <protocol/TBinaryProtocol.h>
#include "./gen-cpp/APService.h"
#include "./gen-cpp/ap_types.h"
#include "./gen-cpp/aphead_types.h"
#include <boost/system/error_code.hpp>
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "libssl.lib")
#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libthrift.lib")
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace com::vrv::im;
using namespace std;
编译boost:
编译thrift:
VS2010-SP1 Thrift 使用 /Mtd 编译
编译openssl:
openssl 使用纯静态编译lib,保证openssl\bin目录下没有ssl.dll crypto.dll
perl ./Configure VC-WIN32 no-shared no-asm --prefix=c:\openssl
nmake
nmake install
参考资料:
1、下载 openssl-1.1.0.tar.gz
2、安装 ActivePerl, 可以到http://www.activestate.com/activeperl/downloads下载最新版本, 需要用到 perl 解释器。
注:Perl 最低版本要求5.10以上,Windows XP用户最后支持版本ActivePerl 5.20.2.2002 版本
3、使用 VS2010 下的 Visual Studio 2010 Command Prompt 进入控制台模式 (这个模式会自动设置各种环境变量,根据编译32位、64位、Itanium自己选择)。
4、安装dmake,ppm install dmake
5、解压缩 openssl 源代码包,进入 openssl 的根目录, 如 E:\openssl-1.1.0。
6、perl configure VC-WIN32
必须在 c:\openssl-1.1.0 目录下执行该命令, 否则找不到 Configure 文件, 这时就必须指定完整的 Configure 文件路径。
64编译的话 Win64/x64 执行 perl Configure VC-WIN64A;Win64/IA64 执行 perl Configure VC-WIN64I。
7、在正式编译之前
(1). 找到 c:\openssl-1.1.0\configdata.pm和c:\openssl-1.1.0\makefile两个文件, 用记事本打开, 搜索 “/MD” 字符串, 替换成 “/MT”, 这将导致静态链接 C 运行, 避免了在目标机器上安装 VC 再发行包等等操作。
8、编译, nmake
9、编译, nmake test
10、编译, nmake install
注:openssl 1.1.0开始由原先的libeay32.dll、ssleay32.dll变成了libcrypto-1_1.dll、libssl-1_1.dll,一些加密方式也发生了变化。
参考资料:
写的很好
Apache Thrift 在Windows下的安装与开发
http://blog.csdn.net/colouroo/article/details/38588297
- windows下使用thrift编译+示例+详解解决坑
- Thrift windows下cpp编译与使用
- windows下编译thrift
- windows下使用thrift
- 在windows下使用vs2013编译thrift 0.10.0
- thrift-0.9.0windows下编译
- (转)Thrift在Windows及Linux平台下的安装和使用示例
- thrift windows vs2015编译
- thrift使用示例二
- thrift使用入门示例
- Thrift使用示例
- windows下如何使用thrift,及编译执行的全过程。boost库的使用,libevent 库的使用
- linux下thrift 编译
- Thrift 学习笔记2——Windows环境下Thrift的安装、编译以及测试
- Thrift 学习笔记2——Windows环境下Thrift的安装、编译以及测试
- thrift windows vs2013编译lib
- thrift 串行化使用示例
- VS2008 thrift简单使用示例
- 两个fragment之间跳转listview数据丢失
- 【JavaSE练习】面向对象_模拟银行账户
- 程序员也喜欢高达模型
- 大图轮播效果
- FreeRtos在RH850 D1L芯片上移植
- windows下使用thrift编译+示例+详解解决坑
- 合法IP&窗口最大值数组&打印素数&递归逆序一个栈&栈排序另一个栈&MyString&寻找数组中出现的重复字符&数组中的重复数字&逆序打印链表&空格替换成%20
- Error creating bean with name 'sqlSessionFactory' defined in class path resource
- Java代码块
- 全系列Unity4.x.x到5.6.2破解Win&Mac!
- 使用Python进行代码测试
- HDU
- JVM介绍
- Problem 24 Lexicographic permutations (全排列)