iOS crash on launch only on arm64+distribution build


I’m facing a crash on launch on iOS, it’s weird since the same code, same everything works on:

  • ios+arm64+development config
  • ios+armv7+shipping config
  • windows+x64+shipping
  • mac+x64+shipping
    But it fails in:
  • ios+arm64+shipping

What I want to do is to pinpoint what changes do I need to do to the engine code so that the arm64+shipping behaves like the other builds thus avoiding the crash.

Now some background on what I’m doing:

I have UE4.11.2 from GitHub + vanilla Unreal Match 3 project + third party library that uses c++ STD library from libc++.
I’ve reduced the code to a bare minimum, and it’s crashing as soon as I load the library, I’m pretty sure there is no (apprent) bug on the way I’m calling this bare code.

This is the callstack (I don’t have symbols loaded since it’s on shipping build):

Xcode log:

2016-05-02 22:38:11.243 CTAndroid[806:167919] No ue4commandline.txt [/var/containers/Bundle/Application/****/] found
2016-05-02 22:38:11.243 CTAndroid[806:167919] Combined iOS Commandline: 
2016-05-02 22:38:11.262 CTAndroid[806:167919] You've implemented -<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
========= This app is in LANDSCAPE mode
2016-05-02 22:38:11.340 CTAndroid[806:167977] NSBundleResourceRequest helper daemon reports an error in parsing the on demand resources information: Error Domain=_NSBundleResourceRequestErrorDomain Code=100 "(null)"
2016-05-02 22:38:11.342 CTAndroid[806:167977] Error: Error Domain=NSCocoaErrorDomain Code=4994 "The requested application data doesn’t exist." UserInfo={NSLocalizedFailureReason=Request could not be completed.  Invalid tag in set '{(
2016-05-02 22:38:11.541 CTAndroid[806:167919] Metal GPU Frame Capture Enabled
2016-05-02 22:38:11.541 CTAndroid[806:167919] Metal API Validation Enabled
2016-05-02 22:38:11.583 CTAndroid[806:167919] ::: Created a UIView that will support Metal :::
2016-05-02 22:38:12.123 CTAndroid[806:167965] Initializing ULD Communications in game mode
2016-05-02 22:38:13.514 CTAndroid[806:167965] [2016.05.02-20.38.13:514]  0]sg.AntiAliasingQuality = "0"
2016-05-02 22:38:13.613 CTAndroid[806:167965] [2016.05.02-20.38.13:613]  0]r.RefractionQuality = "0"
2016-05-02 22:38:13.614 CTAndroid[806:167965] [2016.05.02-20.38.13:614]  0]Command not recognized: r.ForceLod 1
CTAndroid(806,0x16e353000) malloc: *** error for object 0x1529a3520: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
2016-05-02 22:43:53.142 CTAndroid[806:168004] CFNetwork SSLHandshake failed (-9810)

IOS Log:

Thread 6 Crashed:
0   libsystem_kernel.dylib            0x00000001806c411c __pthread_kill + 8
1   libsystem_pthread.dylib           0x0000000180790ef8 pthread_kill + 112
2   libsystem_c.dylib                 0x0000000180635dac abort + 140
3   libsystem_malloc.dylib            0x00000001806f0374 szone_size + 0
4   libc++.1.dylib                    0x00000001801551e0 std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::~basic_string() + 32
5   CTAndroid                         0x0000000100a95fcc 0x10005c000 + 10723276
6   CTAndroid                         0x00000001000e9d0c 0x10005c000 + 580876
7   CTAndroid                         0x00000001001a4968 0x10005c000 + 1345896
8   CTAndroid                         0x00000001001b8938 0x10005c000 + 1427768

Now, the problem is that I’m not able to understand how come this happens only on ios+shipping+arm64, I can’t figure out what the engine is changing in that particular config that leads to this crash.

Since the codebase of UE4 is huge, I’m trying to pinpoint the UE_BUILD_SHIPPING, UE_BUILD_DEVELOPMENT, etc. But after days of searching, I would really need some help, since we are close to launch and this is a show-stopper currently.

Thank you,

OK, I’ve solved this issue (after 4,5days of debugging). If anyone ever encounters a problem with the C++ standard library and arm64, the fix for me was to enable symbols in UnrealBuildTool IosToolChain.cs. Commenting out the lines involving bStripSymbolsOnIOS.

I am having the Android enabled armv64 fail every time i try and do a shipping production build. Just armv7 works fine, but 64 gives me errors during build.