Crash on iOS4 because of fast texture loading?
Hi,
do you have access to an iOS 4 device? I seem to see crashes if I deploy a .ipa file because CVOpenGLESTextureCacheCreate isn't available on iOS4, and there's a dynamic linking error when I try to launch my app. This doesn't seem to appear when deploying directly from Xcode, though.
The problem appeared in 3512cd35c8d88ed93be9f050ab7cac75d9a47ad3 - can you reproduce this on your end or did I manage to screw up my setup? I'll have another look at this tomorrow but it would be great if you could try to reproduce this.
I can't reproduce this on my iOS 4.3 device here. It works cleanly with all sample applications I've tried. Others are using this on iOS 4.x without issue, as well.
Are you using the latest code from the repository? For a little while there, I had the wrong deployment target set on the framework itself, which caused these errors.
Check to make sure that the GPUImage framework project has a deployment target of iOS 4.0 or 4.1, do a clean of your application project (or the GPUImage project separately, if you don't embed the project file for it in your application Xcode project), and try it again.
I test on iOS 4.x every time I touch the fast texture stuff to make sure that it builds cleanly here, so I'd be surprised if there was something wrong with the framework setup. More people would be complaining if that was the case.
So I've cloned the repo again (master) and built the CubeExample. I went to Project->Archive, then distribute, ad-hoc and double-clicked the IPA to install it on my 4.3.3 test device. The resulting app can't be started, the error log contains this entry afterwards:
Hardware Model: iPod4,1 Process: CubeExample [7502] Path: /var/mobile/Applications/AB79EFC1-E68B-4C74-9A43-02AA054F4FF0/CubeExample.app/CubeExample Identifier: CubeExample Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1]
Date/Time: 2012-04-16 22:56:52.085 +0100 OS Version: iPhone OS 4.3.3 (8J2) Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x00000001, 0xe7ffdefe Crashed Thread: 0
Dyld Error Message: Symbol not found: _CVOpenGLESTextureCacheCreate Referenced from: /var/mobile/Applications/AB79EFC1-E68B-4C74-9A43-02AA054F4FF0/CubeExample.app/CubeExample Expected in: /System/Library/Frameworks/CoreVideo.framework/CoreVideo Dyld Version: 191.3
[long list of binary images here]
Would you mind trying these steps on your setup? Mind you, the build and even deployment from Xcode works fine unless I archive! I'm running Xcode 4.3.2, the device in question is an iPod 4G if I'm not mistaken.
I spoke too soon about deploying CubeExample straight from Xcode... I see an EXC_BAD_ACCESS when running off Xcode. However, the above post holds true for FilterShowcase: Crash when archived, runs fine when deployed from Xcode.
OK, there was a problem with the CubeExample project in that it was targeting iPhone OS 3.0 instead of the supported minimum of 4.0, and it was missing the -fobjc-arc Other Linker Flag. These were preventing it from running right on iOS 4.x devices. I tried it on a new iOS 4.1 iPhone 3G S I just got, and the project now installs and runs cleanly using both the Debug and Release build schemes (which should be the only difference between archived applications and directly Xcode-installed ones).
Try it now and see if this project still causes you trouble on your device.
I'm afraid I'm still seeing the same problem. Keep in mind that this was not just CubeExample, but also FiterShowcase, probably others as well. Let's focus on CubeExample, though:
I changed the GPUImage and CubeExample schemes to run = Build Configuration: Release. Deploying CubeExample from Xcode works, just like it did with Build Configuration: Debug. However, archiving and installing the IPA through Xcode doesn't work, after running the Device Log in Xcode's Organizer looks like this:
Hardware Model: iPod4,1 Process: CubeExample [8382] Path: /var/mobile/Applications/1122598A-8F6A-4308-8067-C80E08CCC576/CubeExample.app/CubeExample Identifier: CubeExample Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1]
Date/Time: 2012-04-21 09:26:05.511 +0100 OS Version: iPhone OS 4.3.3 (8J2) Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x00000001, 0xe7ffdefe Crashed Thread: 0
Dyld Error Message: Symbol not found: _CVOpenGLESTextureCacheCreate Referenced from: /var/mobile/Applications/1122598A-8F6A-4308-8067-C80E08CCC576/CubeExample.app/CubeExample Expected in: /System/Library/Frameworks/CoreVideo.framework/CoreVideo in /var/mobile/Applications/1122598A-8F6A-4308-8067-C80E08CCC576/CubeExample.app/CubeExample Dyld Version: 191.3
Can you try deploying an IPA please? If that should not work for you either, then there might be some hidden setting when archiving or just a different way of loading linked libraries. I've been asking around to get someone else to deploy on a different machine and iOS device, but no-one else seems to have a 4.3 device anymore so I don't have access to a completely separate build environment. That being said, I did clone the repository again for this test...
OK, I believe I've finally figured this out.
It looks like the current version of Xcode does not do per-function weak linking if you archive an application, but it does if you deploy directly to the device. To fix this, you need to explicitly weak link the Core Video framework in your application if you want to target iOS 4.x.
I have instructions on how to do this in the new Readme, but you need to go to your project's Build Phases, expand the Link Binary With Libraries group, find CoreVideo.framework, and change its property from Required to Optional. I've updated all sample applications to do this, and I've tested them by archiving and installing to my iOS 4.x devices via iTunes. The applications now work without crashing, where before they were throwing the same kind of missing symbol errors you saw.
I'll see if there's something I can do on the library level to make this easier, but this works right now.
Thanks a lot, works like a charm now!
Thank you very much Guys, I had the same issue, and was stuck on it until I found this post...
Hi, I did make the core video framework optional both in the GPU proj and my proj, but why it still occurred the error: dyld: lazy symbol binding failed: Symbol not found: _CVOpenGLESTextureCacheCreate Referenced from: /var/mobile/Applications/D1210DCD-E47A-4C5E-A1F3-CF391E9C78B4/Test.app/Test Expected in: /System/Library/Frameworks/CoreVideo.framework/CoreVideo