dylibs in iOS9 Beta 2

Hi,


I’m developing an app for iOS 9. The app will be used in enterprise store.

I’m using the latest XCode 7 Beta on iPhone 5s with iOS 9 Beta 2.


The app links against 3rd party libraries.

The issue is that when using 32-bit executable on a 64-bit device, the executable fails to load 32-bit dylib.

All other permutations work (running 64-bit exec on 64-bit device that uses dlopen to load 64-bit dylib, running 32-bit exec on 32-bit device that uses dlopen to load 32-bit dylib).


Using dlopen instead of linking causes an infinite loop of error messages about dyld_image_path_containing_address failing.


Is that a bug in iOS 9?


Following is the crash report:


Incident Identifier: 95456095-55FD-491F-A03E-772EFCDBE2EC

CrashReporter Key: c88fd232ed978666a388616a2e76dc21560026c0

Hardware Model: iPhone6,1

Process: app [218]

Path: /private/var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/app

Identifier: com.myapp.app

Version: 4.5.024641 (4.5.0)

Code Type: ARM (Native)

Parent Process: launchd [1]


Date/Time: 2015-06-28 11:27:39.39 +0300

Launch Time: 2015-06-28 11:27:39.39 +0300

OS Version: iOS 9.0 (13A4280e)

Report Version: 105


Exception Type: EXC_BREAKPOINT (SIGTRAP)

Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe

Triggered by Thread: 0


Filtered syslog:

None found


Dyld Error Message:

Dyld Message: Library not loaded: @executable_path/mylib.dylib

Referenced from: /var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/app

Reason: no suitable image found. Did find:

/var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/mylib.dylib: mmap() error 22 at address=0x04F0D000, size=0x00007000 segment=__DATA in Segment::map() mapping /var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/mylib.dylib

/private/var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/mylib.dylib: mmap() error 22 at address=0x0510D000, size=0x00007000 segment=__DATA in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/mylib.dylib

Dyld Version: 366.5



Binary Images:

0x4000 - 0x38d7fff app armv7 <0f9f4db21ff53827a99a0fd1ca7cf491> /var/mobile/Containers/Bundle/Application/692E4FAD-FA81-4743-B4FA-739309B3D26B/app.app/app

0x1fe28000 - 0x1fe4ffff dyld armv7s <8fa7cad9fbe23d7082be8294cae544c4> /usr/lib/dyld

Replies

If I'm remembering correctly, Apple removed support for 32bit binaries in iOS9.

AFAIK, iOS 9 supports iPhone 4S and therefore supports 32Bit. The problematic scenario I'm having is when running a 32Bit app on 64Bit device trying to load 32Bit dylib file.

Does anyone have any ideas?

Hi there, We hit same issue. For some reason 64-bit iOS 9 requires 32-bit armv7s slice to have extra padding in Mach-O header (as well as extra Load Commands suiting as placeholders for App Store code encryption "bits" I guess). Without this padding the dylib will not pass these new sanity checks in the dynamic linker at your 32-bit app's load-time. You need to build all your frameworks with minimum iOS 8 target (in Xcode 6 or 7) to enforce this new Mach-O layout and problem is solved. I empirically found that armv7 and arm64 slices did not need this extra padding to load but it is not a bad idea to set minimum iOS 8 target for all slices.


If you don't have a control over your 3rd party libraries/frameworks you may have to contact their authors to build them for you with these new settings.


HTH.

Any solution yet?