I use cocos2d-x and ndk-build to build app on arm64. But when i run it on 64bit device, the app crash randomly with error signal 11 (SIGSEGV), and the backtrace shows anonymous and unknown.
I use cocos2d-x 3.17.1, ndk 16, Android Studio 3.4.1, gradle tools 3.2.0 and gradle wrapper 4.6.
I tried ndk-stack but it didn’t show me more useful information.
@R101, @mars3142@CrazyHappyGame and others here are awesome at the mysterious world of Android internals. Perhaps we can ask them to see what they think?
Any chance you could switch to cmake builds, and make your life so much easier?
Anyhow, perhaps an obvious question, but have you checked the APK contents to make sure there are 64bit binaries in there? Specifically, arm64-v8a libraries.
Have you run the 32 bit armeabi-v7a version to ensure it actually works?
Hey,
Stack traces indicate that crash happened in anonymous mem region which is most likely art generated code for some Java code that may belongs to cocos2dx or some third party Java/jar.
In this situations stack trace does not make much sense, you better put some logs and try to isolate faulting module first. Also make sure that your Android device does not become low at memory at runtime, sometime low memory can cause this kind of crash too. I hope you are not using any native crash handler if so please show me logs of your native crash handlers.
yes i use android studio to analyze the apk, and it contains both armeabi-v7a and arm64-v8a libraries.
when i build only armeabi-v7a version, it runs correctly on the same device.
I tried cmake today, and the 64 bit version still crashes.
Hi, it crashes quite randomly, and I don’t know which part has problem.
I have tried debug with android studio. But when it crashed, the log didn’t help and I could not trace the stack.
I’m also facing something similar issues, and working with Bugsnag developers to figure out why. They can’t get the ndk crash data reliabliy , even on a fresh cocos2dx project.
Is this happening on xiaomi phones only?
If not it’s not specific to device, can you share your debug build of app?
Looking again on your traces, I have come up with another potential cause, as crashed thread is glthread and thread must be created by native code as thread stack does not have art/dalvik symbols. This thread might be created by some third party rendering extensions or might be created by opengl driver on behalf of cocos2dx’s rendering thread(some driver work like that). In either case you can comment out scene/layer/node and other game rendering components one by one or do some binary search to find out offending module/function. You need to experiment with it till your app stop crashing. It’s tedious but should be effective to narrow down the issue.
@overcocos
I am sorry above message was meant to @smirkking. Although I had downloaded your app and looked into it. Bugsnag swallowed stack trace which otherwise should be visible in logcat. I can confirm Bugsnag collected crash report regarding SIGFPE may be caused by Integer/float divide by zero and sent it to Bugsang server.
Some developer in Chinese forum said, it works after roll back to 3.16. So i thought if the luajit in 3.16 works because 3.17.1 updated luajit to 2.1.0-beta3.
Please correct me if I’m wrong, but isn’t the LUA or a logical operator, and not a bitwise operator? The line local color = cc.c3b(0, 0, 0) or cc.c3b(255, 255, 255) doesn’t make sense if that is in fact the case.
If it somehow is a bitwise operator in this specific statement, then shouldn’t the result always be 255, 255, 255, since 0 OR 255 = 255?