Larry Leow
Larry Leow

Reputation: 61

Lua for ARMv7/ARMv7s

I'm writing a game with cocos2d-x on xcode, and I'm having problems with compiling a correct version of Lua for armv7/7s.

Here is the error message I'm getting:

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)

LUA does work if I choose to compile for macosx (not iOS).

Edit: I ended up using an older build of Lua, version 5.1.4, and followed the instructions here: http://blog.stokedsoftware.com/blog/2012/02/05/scripting-ios-games-with-lua-part-ii/ This method does not require the lualib.a external library, instead xcode builds the lua source into the project.

Note: While his code is in Objective C, I've found his method does work for cocos2d-x.

He specifically excludes the lua.c and luac.c files from the build. I chose not to, but I commented out the int main() functions because they will clash with the ones in main.m. I'll mark this question answered in a bit, but I'm still interested to know how to build a liblua.a for arm7/7s.

Upvotes: 2

Views: 1250

Answers (1)

Larry Leow
Larry Leow

Reputation: 61

See edit:

Edit: I ended up using an older build of Lua, version 5.1.4, and followed the instructions here: http://blog.stokedsoftware.com/blog/2012/02/05/scripting-ios-games-with-lua-part-ii/ This method does not require the lualib.a external library, instead xcode builds the lua source into the project.

Note: While his code is in Objective C, I've found his method does work for cocos2d-x.

He specifically excludes the lua.c and luac.c files from the build. I chose not to, but I commented out the int main() functions because they will clash with the ones in main.m. I'll mark this question answered in a bit, but I'm still interested to know how to build a liblua.a for arm7/7s.

Upvotes: 1

Related Questions