cocos2d-x-lua使用自编译的so出错

我在项目中使用自编译struct.so的时候报错:
error loading module ‘struct’ from file ‘APP目录/Documents/debugruntime/src/struct.so’:
dlopen(APP目录/Documents/debugruntime/src/struct.so, 6): no suitable image found. Did find:
APP目录/Documents/debugruntime/src/struct.so: mach-o, but wrong architecture

其中struct.so在mac终端能用lua指令正常使用,但是在模拟器上运行时报了上面的错误。
或者有没有人分享下成功使用自编译的so的经验

还有一个:
MactekiMac-mini:struct-0.2 ping$ lipo -info struct.so
Non-fat file: struct.so is architecture: x86_64
就是struct.so是x86_64的,但是模拟器是i386的。

注:
1、struct.so是自己编译的,struct.c源码来源是:http://www.inf.puc-rio.br/~roberto/struct/
2、编译struct.so是用源码带的makefile,即如下gcc指令(源码makefile会报错,增加-L /usr/local/lib/ -llua 就可以了)

gcc -D_POSIX_SOURCE -Wall -W -pedantic -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wwrite-strings -DSTRUCT_INT=“long long” -O2 -I /usr/local/include/ -L /usr/local/lib/ -shared -llua -fPIC -o struct.so struct.c

开发环境:OS X10.9; Lua 5.1; cocos2d-x3.1.1; iOS模拟器7.0

没人使用过so吗

已经解决了。不过不是使用so了,是直接将c文件加入到项目。
主要是模仿luasocket模块的添加。