该错误"file is not of required architecture"
暗示您正在尝试混合架构这一事实。
检查架构/usr/local/lib/liblua.a
并确保它与您尝试构建的架构或对象相匹配。
例如
我们有一个 i386 对象:
==== cat fun.c ====
#include <stdio.h>
void fun()
{
printf("%s", "foobar\n");
}
gcc -arch i386 -c fun.c -o fun.o
如果我们在编译 x86_64 对象(Mac OS X 中的默认架构)时尝试使用它:
===== cat test.c ==
extern void fun();
int main()
{
fun();
}
我们得到:
$ gcc test.c fun.o
ld: warning: ignoring file fun.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_fun", referenced from:
_main in ccXVCQhG.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status