同一个项目Xcode用32位能编过增加arm64后就编不过了

基于cocos2dx 3.2版本+lua 的项目,在运行时报以下错误:

— Begin quote from ____

cocos2d: load “src/debug/debugscene.lua”, error: syntax error during pre-compilation.
cocos2d: ----------------------------------------
cocos2d: LUA ERROR: :48: module ‘src/debug/debugscene’ not found:
no field package.preload’src/debug/debugscene’]:1: unexpected symbol near ‘\357’
no file ‘./src/debug/debugscene.lua’
no file ‘/usr/local/share/lua/5.1/src/debug/debugscene.lua’
no file ‘/usr/local/share/lua/5.1/src/debug/debugscene/init.lua’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene.lua’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene/init.lua’
no file ‘./src/debug/debugscene.so’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’

cocos2d: stack traceback:
:14: in function <:11>
: in function ‘require’
:48: in function <:19>
: in function ‘xpcall’
:87: in main chunk
: in function ‘require’
:1: in main chunk
cocos2d: ----------------------------------------
cocos2d: :89: :48: module ‘src/debug/debugscene’ not found:
no field package.preload’src/debug/debugscene’]:1: unexpected symbol near ‘\357’
no file ‘./src/debug/debugscene.lua’
no file ‘/usr/local/share/lua/5.1/src/debug/debugscene.lua’
no file ‘/usr/local/share/lua/5.1/src/debug/debugscene/init.lua’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene.lua’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene/init.lua’
no file ‘./src/debug/debugscene.so’
no file ‘/usr/local/lib/lua/5.1/src/debug/debugscene.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’/quote]

好像是找不到 lua文件了,请问是什么原因呢?

— End quote

因为lua的原因。楼主编译成了bytecode.可是默认的是luajit的64位。然后导致不一致。取消编译吧。或者换成新的luajit。或者不用64位的。

可是我没有编译成字节码啊,lua文件都是没有加密的。

那断点调试试下。看了下能够加载到开始的文件 。

最开始的main.lua可以加载,但是里面require的文件加载不了。

用模拟器还是真机?看看文件在不在里面。在里面的话导出来看看是不是正常。

这个是lua编码问题,楼主从新把这个报错的lua文件转存成UTF-8的就可以了。我也是这个问题。

是的,我也找到了这个问题,要存为不带BOM的UTF-8。