raylib: [models] Crash when loading .vox model on Android with SIGSEGV error
I encountered a crash issue when attempting to load a .vox model on Android using LoadModel()
. The application crashes with the following log:
2023-06-04 15:01:04.887 30219-30369 libc com.bigfoot.raymob A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1205b941 in tid 30369 (Thread-7), pid 30219 (.bigfoot.raymob)
2023-06-04 15:01:05.065 30858-30858 DEBUG pid-30858 A pid: 30219, tid: 30369, name: Thread-7 >>> com.bigfoot.raymob <<<
2023-06-04 15:01:05.080 30858-30858 DEBUG pid-30858 A #00 pc 000852b4 /data/app/com.bigfoot.raymob-u7jUzwaU1Sz71d6mrGOUhQ==/base.apk!libraymob.so (offset 0x723000) (Vox_LoadFromMemory+144) (BuildId: 05f2523c1f15f8756fe8c105210d0418ed38d02a)
The crash occurs in the function Vox_LoadFromMemory
within vox_loader.h
. It seems to be a segmentation fault (SIGSEGV) with code 1 (SEGV_MAPERR).
Steps to Reproduce:
- Build and run the raylib application on an Android device.
- Attempt to load a .vox model using the
LoadModel
/Vox_LoadFromMemory
function.
Expected Behavior: The .vox model should be loaded successfully without any crashes.
Actual Behavior: The application crashes with a SIGSEGV error when attempting to load the .vox model.
Reproducible Demo: Source / APK / EXE - (Dropbox)
Additional Information:
- Android device: Xiaomi Redmi A9 [M2006C3LG]
- Android version: Android 10
- raylib version: 4.5 / 4.6 dev
I would greatly appreciate any assistance in resolving this issue. Let me know if any further information is required.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 39 (38 by maintainers)
If the advantage that you’re talking about is being a voxel format, then you might want to give a try to Model3D. It is supported by raylib, and the repo contains a command line tool which can convert .vox files into .m3d files. Unlike GLB and OBJ, it’s capable of storing voxel data, so you would still have that advantage (voxel info is automatically triangulated into a mesh on load). Further advantage that a .m3d file is much smaller than .vox for the same model.
Not a real solution, but hope this helps, bzt
Well, I’ve tried many things again but without success. I had my friends try the same app that crashes on my device, and strangely, it doesn’t crash for them. It must be related to my device, I don’t know…
So we can be sure that this is “out-of-scope of raylib”, as mentioned by @raysan5. Therefore, I will close this issue, as it doesn’t really belong here.
As a conclusion, I will still avoid using this file format for Android with raylib, despite its advantages, because if it happens to me, it may potentially happen to other users as well.
Nevertheless, I want to thank you for your patience and all your help!
Yes, raylib has been recompiled dozens of times as well as the project and the minimal test, with the same version of clang each time (whether on Linux or Windows which do not have the same setup), the result is always the same. And raylib is statically linked.
Regarding the fact of finding the exact point where it crashes in the library, it would be necessary to try by compiling raylib directly with the project to be able to have access to more information, I have already tried, it was not easy and the information obtained was not very revealing. I’ll try tonight to rewrite the Android project’s CMakeList file to do this, hope it makes it easier and can give more information when debugging.
No, the example I provided will not work with Android Studio. You need to use the Makefile with the following command: Linux:
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=<your arch>
Windows:mingw32-make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=<your arch>
However, you may need to modify the Makefiles a bit to make it work on your end.
But I have quickly created an Android Studio project for you if you prefer. I have included a Readme file with all the information, it should automatically open in Android Studio.
VoxTest for Android Studio
If you need any further information, please don’t hesitate to ask!
Hi, I’ll test on Android this week. You load what Vox model ? It 's not an out of memory problem ?