kivy / kivy-ios

Toolchain for compiling Python / Kivy / other libraries for iOS
https://kivy.org/docs/guide/packaging-ios.html
MIT License
781 stars 240 forks source link

EXC_BAD_ACCESS error thrown when running application #908

Open OptimusePrime opened 6 months ago

OptimusePrime commented 6 months ago

Versions

Describe the bug

A Kivy application successfully compiles using both standard Kivy iOS Toolchain and Buildozer (although it uses Toolchain under the hood). Once compiled, it is ran on an iOS 17.4 simulator. The Kivy logo is displayed and I see in the debug log that the application starts running. However, once most loading is finished and at the point when the application should fully load and display its UI, Xcode pauses the application and throws EXC_BAD_ACCESS error, a segmentation violation, along with the offending thread (which is nondeterministic) and the memory address to which access was attempted. If Xcode is forced to resume the app, it crashes.

To Reproduce

To compile the app, I followed standard Kivy iOS docs, so I ran the following commands.

python toolchain.py build kivy python3 pillow plyer python toolchain.py pip install oscpy kivymd==1.2.0 python toolchain create <PROJECT_NAME> <PROJECT_PATH>

Afterwards I simply ran the app in Xcode on an iOS 17.4 simulator.

All of this was done using the latest, cloned version of kivy-ios and a virtual environment.

I have successfully reproduced the issue on two different MacBooks, the first had M2 chip and the second M1. I also did so using both a fairly complex app and a hello world app which simply displayed a text (in that case, I didn't build plyer and pillow nor installed oscpy and kivymd), so it seems any app will throw this error, even a simple one.

Both threw the same error.

In the case of the hello world app, once I cleaned the build folder, the app did actually show the text, but the error was thrown immediately afterwards nevertheless.

Expected behavior I expected the app to run without errors.

Logs There are no useful logs in this case as the application runs successfully. LLDB doesn't itself throw any error logs that are relevant, only Xcode shows this error with little useful information other than the memory address.

Screenshots

image
rdpblikon commented 5 months ago

I'm facing exactly the same problem. Did you get to solve it?

OptimusePrime commented 5 months ago

I'm facing exactly the same problem. Did you get to solve it?

Unfortunately, no. I gave up. I was trying to solve it for two weeks or so and tried everything I could think of short of rewriting Kivy iOS code. We decided to rewrite the app in Capacitor.js, which I find to be far less buggy and prefer it over Kivy. The app is in alpha stages so it's not that much of a hassle.

My best guess is that this is some sort of weird edge case either in Kivy iOS/Kivy itself or one of the associated tools/libraries or one particular version of it. What exactly is the culprit, I have no idea.

I did try using two older versions of Kivy iOS, but those two threw a bunch of other errors at compile time and I wasn't willing to deal with them after already battling with Kivy for weeks.

Please let me know if you manage to solve it and if you know of a way I can perhaps assist you in solving this.

misl6 commented 5 months ago

Can you please post the full log before the failure happens, and add a minimum reproducible example?

cederom commented 5 months ago

Okay I have the same problem with recent macOS 14.5 ARM and XCode 15.4 targeting iOS 17.4 on a Simulator.

It seems to be simulator only problem (???) as I did build and work on a real iPhone SE with iOS 15.7.9. Not sure how it behaves on physical device with iOS 17.4 as I do not have any.

@OptimusePrime have you tried running your code on a physical device? Can you try on physical device with iOS 17.4? Use USB cable, Trust mac and iPhone, then you will be able to build and run from XCode selecting your phone from a target drop down list. As easy as running on simulator but we would then have a comparison point.

I have made an example project with kivy-ios toolchain using kivy.git/examples/animation as reference. But this happens also with my own project.

Will try to get familiar with XCode debug features in order to traceback / pinpoint the cause.

Console output below.

Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
Initializing python
<string>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
Running main.py: /Users/cederom/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Bundle/Application/C4DC167A-EB31-4732-ADAB-7580034320A4/animation.app/YourApp/main.pyc
[WARNING] [Config      ] Older configuration version detected (0 instead of 27)
[WARNING] [Config      ] Upgrading configuration in progress.
[DEBUG  ] [Config      ] Upgrading from 0 to 1
[INFO   ] [Logger      ] Record log in /Users/cederom/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Data/Application/C223439F-8CAF-4462-853B-A1577AE71B5A/Documents/.kivy/logs/kivy_24-05-23_0.txt
[INFO   ] [Kivy        ] v2.3.0
[INFO   ] [Kivy        ] Installed at "/Users/cederom/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Bundle/Application/C4DC167A-EB31-4732-ADAB-7580034320A4/animation.app/lib/python3.11/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.11.6 (main, May 23 2024, 02:37:17) [Clang 15.0.0 (clang-1500.3.9.4)]
[INFO   ] [Python      ] Interpreter at "/Users/cederom/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Bundle/Application/C4DC167A-EB31-4732-ADAB-7580034320A4/animation.app/animation"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 195 symbols loaded
[INFO   ] [Image       ] Providers: img_imageio, img_tex, img_sdl2 (img_dds, img_ffpyplayer, img_pil ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
You need UIApplicationSupportsIndirectInputEvents in your Info.plist for mouse support
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'OpenGL ES 2.0 APPLE-21.0.19'>
[INFO   ] [GL          ] OpenGL vendor <b'Apple Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'Apple Software Renderer'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <b'OpenGL ES GLSL ES 1.00'>
[INFO   ] [GL          ] Texture max size <4096>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: '/Users/cederom/Library/Developer/Xcode/DerivedData/animation-gbxhazbeifdxbzggccvejwpgavvo/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file, not in dyld cache), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/Users/cederom/Library/Developer/Xcode/DerivedData/animation-gbxhazbeifdxbzggccvejwpgavvo/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/C/Foundation' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' (no such file), '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' (no such file, not in dyld cache), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' (no such file)
Got fallback dlopen error on Foundation: dlopen(/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: '/Users/cederom/Library/Developer/Xcode/DerivedData/animation-gbxhazbeifdxbzggccvejwpgavvo/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file)
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available

Simulator throws this on crash:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 189CF1D0-2919-478E-A0ED-7E35CEB23C08
CrashReporter Key:   4ADDDBFB-6A9D-EA27-1AEF-F09B38AEA207
Hardware Model:      Mac14,13
Process:             animation [70077]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Bundle/Application/C4DC167A-EB31-4732-ADAB-7580034320A4/animation.app/animation
Identifier:          org.kivy.animation
Version:             1.1 (1.1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [28719]
Coalition:           com.apple.CoreSimulator.SimDevice.172D6A32-3555-4512-9F0E-B63B54F50ACC [9041]
Responsible Process: SimulatorTrampoline [1003]

Date/Time:           2024-05-23 05:45:32.8782 +0200
Launch Time:         2024-05-23 05:45:32.2333 +0200
OS Version:          macOS 14.5 (23F79)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000105ff0000
Exception Codes: 0x0000000000000002, 0x0000000105ff0000
VM Region Info: 0x105ff0000 is in 0x105ff0000-0x106000000;  bytes after start: 0  bytes before end: 65535
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      Accelerate framework        105fd0000-105ff0000    [  128K] rw-/rwx SM=PRV  
--->  VM_ALLOCATE                 105ff0000-106000000    [   64K] rwx/rwx SM=PRV  
      MALLOC_TINY                 106000000-106100000    [ 1024K] rw-/rwx SM=PRV  
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [70077]

Triggered by Thread:  7

Thread 0::  Dispatch queue: com.apple.main-thread
0   libGLProgrammability.dylib             0x1a5e0373c glvmSamplerLoadTexels + 9440
1   libGLProgrammability.dylib             0x1a5e0d314 glvmSamplerSample + 26920
2   libGLProgrammability.dylib             0x1a5e54e08 glvmInterpretFPTransformFourInner + 3132
3   libGLProgrammability.dylib             0x1a5e57198 glvmInterpretFPTransformFour + 2536
4   GLRendererFloat                        0x1c9eb1430 gldLLVMFPTransform + 484
5   GLRendererFloat                        0x1c9ec07ec gldLLVMVecPolyRender + 19348
6   GLRendererFloat                        0x1c9eadf64 gldRenderFillTriangles + 104
7   GLEngine                               0x1a5dd7918 gleLLVMVecPrimMultiRender + 8048
8   GLEngine                               0x1a5d76f64 gleDrawArraysOrElements_ExecCore + 1012
9   GLEngine                               0x1a5d79070 glDrawElements_IMM_ES2Exec + 576
10  animation                              0x104ab9914 __pyx_f_4kivy_8graphics_3vbo_11VertexBatch_draw + 512 (vbo.c:6924)
11  animation                              0x10496b108 __pyx_f_4kivy_8graphics_12instructions_17VertexInstruction_apply + 96 (instructions.c:10895)
12  animation                              0x104886968 __pyx_f_4kivy_8graphics_8compiler_16GraphicsCompiler_compile + 1876 (compiler.c:4876)
13  animation                              0x104968f1c __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_build + 36 (instructions.c:7260)
14  animation                              0x1049686d0 __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_apply + 104 (instructions.c:7018)
15  animation                              0x10496b8ec __pyx_f_4kivy_8graphics_12instructions_6Canvas_apply + 156 (instructions.c:13163)
16  animation                              0x104886968 __pyx_f_4kivy_8graphics_8compiler_16GraphicsCompiler_compile + 1876 (compiler.c:4876)
17  animation                              0x104968f1c __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_build + 36 (instructions.c:7260)
18  animation                              0x1049686d0 __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_apply + 104 (instructions.c:7018)
19  animation                              0x10496b8ec __pyx_f_4kivy_8graphics_12instructions_6Canvas_apply + 156 (instructions.c:13163)
20  animation                              0x104886968 __pyx_f_4kivy_8graphics_8compiler_16GraphicsCompiler_compile + 1876 (compiler.c:4876)
21  animation                              0x104968f1c __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_build + 36 (instructions.c:7260)
22  animation                              0x1049686d0 __pyx_f_4kivy_8graphics_12instructions_16InstructionGroup_apply + 104 (instructions.c:7018)
23  animation                              0x10496b8ec __pyx_f_4kivy_8graphics_12instructions_6Canvas_apply + 156 (instructions.c:13163)
24  animation                              0x10496ce44 __pyx_f_4kivy_8graphics_12instructions_13RenderContext_apply + 1016 (instructions.c:16376)
25  animation                              0x1049772e8 __pyx_f_4kivy_8graphics_12instructions_6Canvas_draw + 12 (instructions.c:12992) [inlined]
26  animation                              0x1049772e8 __pyx_pf_4kivy_8graphics_12instructions_6Canvas_4draw + 12 (instructions.c:13041) [inlined]
27  animation                              0x1049772e8 __pyx_pw_4kivy_8graphics_12instructions_6Canvas_5draw + 24 (instructions.c:13025)
28  animation                              0x104d9426c method_vectorcall_NOARGS + 132 (descrobject.c:453)
29  animation                              0x104d88ab8 _PyObject_VectorcallTstate + 40 (pycore_call.h:92) [inlined]
30  animation                              0x104d88ab8 PyObject_Vectorcall + 80 (call.c:299)
31  animation                              0x104e64ef8 _PyEval_EvalFrameDefault + 19004
32  animation                              0x104e6041c _PyEval_EvalFrame + 16 (pycore_ceval.h:73) [inlined]
33  animation                              0x104e6041c _PyEval_Vector + 200 (ceval.c:6425)
34  animation                              0x104d8b124 _PyObject_VectorcallTstate + 44 (pycore_call.h:92) [inlined]
35  animation                              0x104d8b124 method_vectorcall + 316 (classobject.c:67)
36  animation                              0x10478f508 __Pyx_PyObject_Call + 44 (_event.c:18275) [inlined]
37  animation                              0x10478f508 __pyx_pf_4kivy_6_event_15EventDispatcher_26dispatch + 216 (_event.c:8990) [inlined]
38  animation                              0x10478f508 __pyx_pw_4kivy_6_event_15EventDispatcher_27dispatch + 912 (_event.c:8896)
39  animation                              0x104d93f50 method_vectorcall_VARARGS_KEYWORDS + 408 (descrobject.c:364)
40  animation                              0x104d88ab8 _PyObject_VectorcallTstate + 40 (pycore_call.h:92) [inlined]
41  animation                              0x104d88ab8 PyObject_Vectorcall + 80 (call.c:299)
42  animation                              0x104e64ef8 _PyEval_EvalFrameDefault + 19004
43  animation                              0x104e602ec _PyEval_EvalFrame + 16 (pycore_ceval.h:73) [inlined]
44  animation                              0x104e602ec _PyEval_Vector + 16 (ceval.c:6425) [inlined]
45  animation                              0x104e602ec PyEval_EvalCode + 272 (ceval.c:1140)
46  animation                              0x104eaf6cc run_eval_code_obj + 52 (pythonrun.c:1710) [inlined]
47  animation                              0x104eaf6cc run_pyc_file + 60 (pythonrun.c:1769) [inlined]
48  animation                              0x104eaf6cc _PyRun_SimpleFileObject + 1192 (pythonrun.c:431)
49  animation                              0x104eaffb4 PyRun_SimpleFileExFlags + 64 (pythonrun.c:473)
50  animation                              0x1045282e4 SDL_main + 740 (main.m:87)
51  animation                              0x1047035d8 0x104524000 + 1963480
52  Foundation                             0x180deb128 __NSFireDelayedPerform + 332
53  CoreFoundation                         0x18040f588 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
54  CoreFoundation                         0x18040f244 __CFRunLoopDoTimer + 948
55  CoreFoundation                         0x18040e8e0 __CFRunLoopDoTimers + 284
56  CoreFoundation                         0x18040902c __CFRunLoopRun + 1796
57  CoreFoundation                         0x180408514 CFRunLoopRunSpecific + 572
58  GraphicsServices                       0x18ef06ae4 GSEventRunModal + 160
59  UIKitCore                              0x1853e8040 -[UIApplication _run] + 868
60  UIKitCore                              0x1853ebcc8 UIApplicationMain + 124
61  animation                              0x1047026c8 SDL_UIKitRunApp + 196
62  dyld_sim                               0x105cb1544 start_sim + 20
63  dyld                                   0x105dee0e0 start + 2360

Thread 1:
0   libsystem_pthread.dylib                0x105c625cc start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib                0x105c625cc start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib                0x105c625cc start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib                0x105c625cc start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib                0x105c625cc start_wqthread + 0

Thread 6:: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib                 0x105bd5570 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x105be6b80 mach_msg2_internal + 76
2   libsystem_kernel.dylib                 0x105bdd798 mach_msg_overwrite + 532
3   libsystem_kernel.dylib                 0x105bd58e8 mach_msg + 20
4   CoreFoundation                         0x18040e6c4 __CFRunLoopServiceMachPort + 156
5   CoreFoundation                         0x180408da4 __CFRunLoopRun + 1148
6   CoreFoundation                         0x180408514 CFRunLoopRunSpecific + 572
7   Foundation                             0x180dea38c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
8   Foundation                             0x180dea5b0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60
9   UIKitCore                              0x18548df20 -[UIEventFetcher threadMain] + 404
10  Foundation                             0x180e10be4 __NSThread__start__ + 720
11  libsystem_pthread.dylib                0x105c67414 _pthread_start + 104
12  libsystem_pthread.dylib                0x105c625e0 thread_start + 8

Thread 7 Crashed::  Dispatch queue: com.apple.opengl.cvmDoWork
0   libsystem_platform.dylib               0x105c43410 _platform_memmove + 208
1   libCoreVMClient.dylib                  0x1b8650ff8 cvmsServerElementBuild + 1560
2   libCoreVMClient.dylib                  0x1b864ce34 cvms_element_build_from_source + 132
3   libCVMSPluginSupport.dylib             0x1b8643854 cvm_deferred_build_modular(void*) + 388
4   libdispatch.dylib                      0x180171978 _dispatch_client_callout + 16
5   libdispatch.dylib                      0x180179b10 _dispatch_lane_serial_drain + 960
6   libdispatch.dylib                      0x18017a688 _dispatch_lane_invoke + 388
7   libdispatch.dylib                      0x180185a84 _dispatch_root_queue_drain_deferred_wlh + 276
8   libdispatch.dylib                      0x1801850d0 _dispatch_workloop_worker_thread + 448
9   libsystem_pthread.dylib                0x105c63814 _pthread_wqthread + 284
10  libsystem_pthread.dylib                0x105c625d4 start_wqthread + 8

Thread 7 crashed with ARM Thread State (64-bit):
    x0: 0x0000000105ff0000   x1: 0x000000010f624040   x2: 0x0000000000001fe0   x3: 0x0000000105ff0020
    x4: 0x0000000009634000   x5: 0x0000000000000020   x6: 0x000060000173cf00   x7: 0x0000000000000000
    x8: 0x0000000000000000   x9: 0x0000000000000000  x10: 0x0000000000000000  x11: 0x0000000000000000
   x12: 0x0000000000001000  x13: 0x0000000000000000  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x0000000105c43340  x17: 0x00000000b6a6e038  x18: 0x0000000000000000  x19: 0x0000000106c05df0
   x20: 0x00006000021091d0  x21: 0x00006000035080b0  x22: 0x00006000039088f0  x23: 0x00000001ed8bc4c0
   x24: 0x0000000000000001  x25: 0x000000016bcaa828  x26: 0x000000016bcaa840  x27: 0x0000600003908928
   x28: 0x0000000000000000   fp: 0x000000016bcaa7b0   lr: 0x00000001b8650ff8
    sp: 0x000000016bcaa6e0   pc: 0x0000000105c43410 cpsr: 0x80001000
   far: 0x0000000105ff0000  esr: 0x9200004f (Data Abort) byte write Permission fault

Binary Images:
       0x105de8000 -        0x105e73fff dyld (*) <37bbc384-0755-31c7-a808-0ed49e44dd8e> /usr/lib/dyld
       0x105f3c000 -        0x105f47fff libobjc-trampolines.dylib (*) <cd1bd3cb-1477-3dca-8afc-cff937b3025d> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc-trampolines.dylib
       0x105c40000 -        0x105c47fff libsystem_platform.dylib (*) <b7159952-fab4-38ce-a131-446d54c54afc> /usr/lib/system/libsystem_platform.dylib
       0x105bd4000 -        0x105c0ffff libsystem_kernel.dylib (*) <0c657561-0a7d-344e-838f-109a718679cf> /usr/lib/system/libsystem_kernel.dylib
       0x105c60000 -        0x105c6ffff libsystem_pthread.dylib (*) <f0346f94-d1b1-311f-9ac1-aa8107c597ad> /usr/lib/system/libsystem_pthread.dylib
       0x104524000 -        0x1053affff org.kivy.animation (1.1) <8c9fbe80-3579-3211-9aef-a202a51ebf92> /Users/USER/Library/Developer/CoreSimulator/Devices/172D6A32-3555-4512-9F0E-B63B54F50ACC/data/Containers/Bundle/Application/C4DC167A-EB31-4732-ADAB-7580034320A4/animation.app/animation
       0x105cb0000 -        0x105cfbfff dyld_sim (*) <496faa0c-90ce-3140-9e23-1f02a673b817> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim
       0x1a5df2000 -        0x1a5f36ffb libGLProgrammability.dylib (*) <765738f2-ee8f-3e80-93a5-8191a73ba906> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
       0x1c9ea1000 -        0x1c9ec1ffb GLRendererFloat (*) <ce502d4b-ce50-3565-901c-a71de1355944> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/GLRendererFloat.bundle/GLRendererFloat
       0x1a5d21000 -        0x1a5de2ff7 GLEngine (*) <2c7757a3-b1e9-3f26-9376-0469e36e757e> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/GLEngine.bundle/GLEngine
       0x1807b4000 -        0x18127bfff com.apple.Foundation (6.9) <0480a70b-2076-3964-b6e5-3c8d92b1d9dc> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation
       0x180381000 -        0x180734fff com.apple.CoreFoundation (6.9) <7d1f50b3-ed7d-3987-bced-ad6779b49c86> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
       0x18ef03000 -        0x18ef0bfff com.apple.GraphicsServices (1.0) <4a4b088d-4b30-3333-87b4-a40533ac5580> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
       0x1847f9000 -        0x186198fff com.apple.UIKitCore (1.0) <5354928b-4688-337f-b9fc-835aa5aa3543> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x1b864b000 -        0x1b8653ffb libCoreVMClient.dylib (*) <a753d2cb-95da-369e-a5c3-ea6e0f38775b> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
       0x1b8641000 -        0x1b8643ff3 libCVMSPluginSupport.dylib (*) <5e0932b3-4c57-3592-9d4a-881bde7b4085> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib
       0x18016e000 -        0x1801b3fff libdispatch.dylib (*) <1f0bccce-27f9-3089-827b-15c16df735c0> /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib

EOF
tito commented 5 months ago

I hit the same issue, looking into it.

EDIT: Got a little exchange with @misl6 and he worked on a branch for moving to Angle instead of direct GLES (https://github.com/kivy/kivy-ios/pull/928)

However, it seems the issue is just for simulator, as it runs fine on device.

tcaduser commented 1 month ago

I've run into issues in the past with matplotlib initialization and a bad access. It was only on the simulator. To build only the device or the simulator, please see the method described in Issue #865 I found rebuilding for simulator multiple times will sometimes fix the issue, and I can then generate the images needed for the Apple store. My suspicion is that it may be bitcode related, as that is one of the flags the was being used for simulator, but not the device.

Dekto commented 1 month ago

Python : 3.12.6 macOS 14.7 Xcode 15.4 Cython 0.29.36 MacBook Air M2

Hello everyone,

I have exactly the same problem.

The simulator crashes, but my app runs on the iPhone.

@tcaduser Which command do you use to build the simulator?

Best regards

tcaduser commented 1 month ago

I @Dekto, it's been almost a year since I've looked at this issue. If I remember correctly I just keep doing:

toolchain clean matplotlib
toolchain build   --platform iphonesimulator-arm64 matplotlib

over and over until it doesn't crash. But this is only if the issue is with matplotlib.

If I remember correctly, you also have to do a:

toolchain update myapp-ios

where myapp-ios is your app directory.

You may want to look at your stack trace to see where your application is crashing. My method was to keep commenting out python statements in my application until it stopped crashing.

Dekto commented 1 month ago

Hello again,

I was able to solve the problem by installing the older iOS Simulator Runtime 17.2.

Best regards