zoukankan      html  css  js  c++  java
  • Openresty使用Thrift安装步骤

    最新想用Golang与Openresty相互通讯调用,使用RPC协议来实现,后来研究最终选择了Thrift;主要还是FB实现了支持Lua和Go模块,直接编译就可以成功嵌套使用,非常方便;研究了两天最后编译成功,于是便把使用步骤做下记录。

    1、Mac安装Thrift

    brew install thrift
    

    2、Apache官网地址Thrift0.10下载地址

    或者

    git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift
    cd thrift

    3、解压Thrift0.10

    从Thrift源码(thrift/lib/go/thrift)中拷贝到go/src目录下,golang的thrift环境即配置好了。

    4、编译Thrift环境

    ./configure --libdir=/usr/lib --without-java --without-python --without-as3 --without-javame --without-cocoa --without-cpp --without-csharp --without-d --without-dart --without-py --without-rb --without-ts --without-xml --without-json --without-jaxe --without-nodejs  --without-php --without-perl --with-lua

    编译前配置,使用--without-禁用java和python, 安装目录设为/usr/lib,而不是默认的/usr/local/lib

    5、修改thrift-0.10.0/lib/lua目录下Makefile
    LUA = /usr/local/openresty/luajit/bin/luajit
    LUA_EXEC_PREFIX = 
    LUA_INCLUDE = /usr/local/openresty/luajit/include/luajit-2.1
    LUA_LIB = /usr/local/openresty/luajit/lib
    
    6、编译.so文件
    编译lua用的.so动态库的命令行:
    gcc -O2 -bundle -undefined dynamic_lookup -o lualib.so libluabpack_la-luabpack.o  
    
    gcc -O2 -bundle -undefined dynamic_lookup -o libluabpack.so libluabpack_la-luabpack.o liblualongnumber_la-longnumberutils.o
    
    gcc -O2 -bundle -undefined dynamic_lookup -o libluabitwise.so libluabitwise_la-luabitwise.o
    
    gcc -O2 -bundle -undefined dynamic_lookup -o libluasocket.so libluasocket_la-luasocket.o libluasocket_la-usocket.o
    
    gcc -O2 -bundle -undefined dynamic_lookup -o liblualongnumber.so liblualongnumber_la-lualongnumber.o liblualongnumber_la-longnumberutils.o
     
  • 相关阅读:
    IE 8兼容:<meta http-equiv="X-UA-Compatible" content="IE=edge" /> X-UA-Compatible的解释
    点击下载,下载图片
    修改输入框placeholder文字默认颜色-webkit-input-placeholder
    rest_framework目录
    Django目录
    python基础内容目录
    hadoop伪分布式搭建
    通过ldap验证svn服务
    LDAP目录服务
    Python基础之字符串拼接简单介绍
  • 原文地址:https://www.cnblogs.com/leehongee/p/7291618.html
Copyright © 2011-2022 走看看