Lua for ARMv7 / ARMv7s

时间:2013-04-08 10:13:16

标签: c++ ios cocos2d-iphone lua cocos2d-x

我在xcode上用cocos2d-x编写游戏,我在为armv7 / 7s编译正确版本的Lua时遇到了问题。

以下是我收到的错误消息:

ld: warning: ignoring file 
/Users/seriousgames/Documents/PopulationTest/PopulationTest/libs/lua/liblua.a, file was built for archive which is not the architecture being linked (armv7): /Users/seriousgames/Documents/PopulationTest/PopulationTest/libs/lua/liblua.a
Undefined symbols for architecture armv7:
  "_luaL_newstate", referenced from:
      Behavior::onTerminate(Status) in Behavior.o
  "_luaL_openlibs", referenced from:
      Behavior::onTerminate(Status) in Behavior.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

如果我选择为macosx(而不是iOS)编译,LUA确实有用。

修改:我最终使用旧版本的Lua版本5.1.4,并按照此处的说明进行操作:http://blog.stokedsoftware.com/blog/2012/02/05/scripting-ios-games-with-lua-part-ii/ 此方法不需要lualib.a外部库,而是xcode将lua源构建到项目中。

注意:虽然他的代码在Objective C中,但我发现他的方法适用于cocos2d-x。

他明确地从构建中排除了lua.c和luac.c文件。我选择不这样做,但我注释掉了int main()函数,因为它们会与main.m中的函数冲突。我会稍微回答这个问题的答案,但我仍然有兴趣知道如何为arm7 / 7s构建一个liblua.a。

1 个答案:

答案 0 :(得分:1)

见编辑:

编辑:我最终使用旧版本的Lua,版本5.1.4,并按照此处的说明进行操作:http://blog.stokedsoftware.com/blog/2012/02/05/scripting-ios-games-with-lua-part-ii/此方法不需要lualib.a外部库,而是xcode将lua源构建到该项目。

注意:虽然他的代码是在Objective C中,但我发现他的方法适用于cocos2d-x。

他明确地从构建中排除了lua.c和luac.c文件。我选择不这样做,但我注释掉了int main()函数,因为它们会与main.m中的函数冲突。我会稍微回答这个问题的答案,但我仍然有兴趣知道如何为arm7 / 7s构建一个liblua.a。

相关问题