标签:cpp undefined logs 动态库 成功 拷贝 文件 openresty conf
最新想用Golang与Openresty相互通讯调用,使用RPC协议来实现,后来研究最终选择了Thrift;主要还是FB实现了支持Lua和Go模块,直接编译就可以成功嵌套使用,非常方便;研究了两天最后编译成功,于是便把使用步骤做下记录。
brew install thrift
git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift cd thrift
从Thrift源码(thrift/lib/go/thrift)中拷贝到go/src目录下,golang的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
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
编译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
标签:cpp undefined logs 动态库 成功 拷贝 文件 openresty conf
原文地址:http://www.cnblogs.com/leehongee/p/7291618.html