Closed mrackwitz closed 9 years ago
Daniel was able to resolve the issue by setting the Team identifier to our company account. We both got the following error when trying to sign with our private accounts:
dyld: Library not loaded: @rpath/RealmSwift.framework/Frameworks/Realm.framework/Realm
Referenced from: /private/var/mobile/Containers/Bundle/Application/CD54FCBE-D46C-4878-B47B-91E4B58549A2/Simple.app/Frameworks/RealmSwift.framework/RealmSwift
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/CD54FCBE-D46C-4878-B47B-91E4B58549A2/Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/CD54FCBE-D46C-4878-B47B-91E4B58549A2/Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
/private/var/mobile/Containers/Bundle/Application/CD54FCBE-D46C-4878-B47B-91E4B58549A2/Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/CD54FCBE-D46C-4878-B47B-91E4B58549A2/Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm’
Adding --deep
to OTHER_CODE_SIGN_FLAGS
, in the hope that this would trigger a full re-sign of the nested framework, didn't worked out. The error persisted.
Is this with 0.92.0 or 0.92.1? Is there a script build phase for stripping the frameworks running?
Okay, so a little context: I am working on another issue and wanted to upgrade the Realm framework to check if the issue would still be present. I simply downloaded the latest Swift (0.92.1) zip and for good measure I wanted to check if I could repro. the problem with just our Simple sample, but before I set the Team to our company, I got the first dyld error when starting the app. It built fine without warnings.
Seeing a similar issue here. Working on a small app, integrated realm yesterday. Everything works fine in the simulator - but I cannot run the app on the device (iPhone 6), as launching it fails with:
dyld: Library not loaded: @rpath/RealmSwift.framework/Frameworks/Realm.framework/Realm
Referenced from: /private/var/mobile/Containers/Bundle/Application/1B3B732F-0289-41BF-869A-64E8F99B2C53/XXXXX.app/XXXXX
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/1B3B732F-0289-41BF-869A-64E8F99B2C53/XXXXX.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/1B3B732F-0289-41BF-869A-64E8F99B2C53/XXXXX.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
Tried & didn't work:
Realm.framework
directlyI'm using the latest Swift framework 0.92.1, through Carthage (but problem already was present yesterday with the previous version 0.92.0).
Also when setting the Team to our company, I am able to run through Xcode, but when starting it directly on the device it crashes (with SIGKILL - CODESIGNING
):
Incident Identifier: A94253F8-E1AF-4ACA-B65C-012C59194E40
CrashReporter Key: 924ead0230582be656c55a72b504d69429614d3b
Hardware Model: iPad4,2
Process: Simple [550]
Path: /private/var/mobile/Containers/Bundle/Application/38D6BED5-A367-4D74-9EE8-9AAEF331017A/Simple.app/Simple
Identifier: io.realm.Simple
Version: 1 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-05-07 17:02:31.846 +0200
Launch Time: 2015-05-07 17:02:31.769 +0200
OS Version: iOS 8.3 (12F69)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGKILL - CODESIGNING)
Exception Subtype: unknown at 0x00000001005d0004
Triggered by Thread: 0
Thread 0 Crashed:
0 dyld 0x000000012005268c ImageLoaderMachOCompressed::registerEncryption(encryption_info_command const*, ImageLoader::LinkContext const&) + 128
1 dyld 0x0000000120052680 ImageLoaderMachOCompressed::registerEncryption(encryption_info_command const*, ImageLoader::LinkContext const&) + 116
2 dyld 0x0000000120052468 ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, unsigned int, unsigned int, linkedit_data_command const*, encryption_info_command const*, ImageLoader::LinkContext const&) + 272
3 dyld 0x000000012004ea38 ImageLoaderMachO::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, ImageLoader::LinkContext const&) + 244
4 dyld 0x0000000120043900 dyld::loadPhase6(int, stat const&, char const*, dyld::LoadContext const&) + 408
5 dyld 0x0000000120048144 dyld::loadPhase5stat(char const*, dyld::LoadContext const&, stat*, int*, bool*, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 168
6 dyld 0x0000000120048004 dyld::loadPhase5(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 640
7 dyld 0x0000000120047d4c dyld::loadPhase4(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 188
8 dyld 0x00000001200479bc dyld::loadPhase3(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 648
9 dyld 0x00000001200474e4 dyld::loadPhase1(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 156
10 dyld 0x0000000120043444 dyld::loadPhase0(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 232
11 dyld 0x00000001200430f8 dyld::load(char const*, dyld::LoadContext const&) + 156
12 dyld 0x0000000120046f20 dyld::libraryLocator(char const*, bool, char const*, ImageLoader::RPathChain const*) + 48
13 dyld 0x000000012004c6e8 ImageLoader::recursiveLoadLibraries(ImageLoader::LinkContext const&, bool, ImageLoader::RPathChain const&) + 336
14 dyld 0x000000012004c9b8 ImageLoader::recursiveLoadLibraries(ImageLoader::LinkContext const&, bool, ImageLoader::RPathChain const&) + 1056
15 dyld 0x000000012004c3d0 ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, bool, ImageLoader::RPathChain const&) + 104
16 dyld 0x00000001200448e0 dyld::link(ImageLoader*, bool, bool, ImageLoader::RPathChain const&) + 180
17 dyld 0x0000000120045758 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 2308
18 dyld 0x0000000120041040 _dyld_start + 64
The Objective-C download does not seem to have these issues. As @mrackwitz suggested, could it be a signing issue with the nested Framework?
Unfortunately I cannot reproduce the original issue with the Simple example from the latest Objective-C release, so I will keep digging.
I investigated the code signing a bit further by checking the build products, manually - once built and signed with team identifier None
and once with our company account. The application and ReamSwift.framework
are always re-signed with the appropriate signature as far as I can tell. The nested framework is shown surprisingly as not signed at all according to codesign -d
, even though there is a _CodeSignature
in the bundle of Realm.framework
. That applies in both cases, so it was independent from whether this build was working on the device or not.
$ codesign -d --verbose=4 Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework
Simple.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework: code object is not signed at all
Same happening here, using Xcode 6.3.1 and RealmSwift 0.92.1, can't run it on my device using Debug configuration.
dyld: Library not loaded: @rpath/RealmSwift.framework/Frameworks/Realm.framework/Realm
Referenced from: /private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/RealmSwift
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/3D3E2F57-375B-4671-A3B1-675AA888CB23/Decathlon.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
And I'm using the Run Script Phase:
./RealmSwift.framework/strip-frameworks.sh
Never mind, I found where I was doing it wrong. The Run Script Phase should be
bash ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework/strip-frameworks.sh
So it's fine now, upgraded to 0.92.2 also.
Glad to hear it's working now!
This issue is persisting for me. On the ios examples in the zip:
dyld: Library not loaded: @rpath/RealmSwift.framework/Frameworks/Realm.framework/Realm
Referenced from: /private/var/mobile/Containers/Bundle/Application/32C3E59D-0E1D-4FB9-8617-5EA545D2A12F/GroupedTableView.app/GroupedTableView
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/32C3E59D-0E1D-4FB9-8617-5EA545D2A12F/GroupedTableView.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/32C3E59D-0E1D-4FB9-8617-5EA545D2A12F/GroupedTableView.app/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
Realm 0.92.2 Xcode 6.3.1
@dbworku please share your Run Script Phase, I got the same problem
I'm running the same script as above:
bash ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework/strip-frameworks.sh
Also, I've done the standard setup steps -- added the framework as embedded and added the framework to the search paths.
Where do you edit the Run Script?
Explicitly setting a team seems to be necessary when attempt to run on device with embedded dynamic binaries.
(edit) Never mind. I see now that the fix is not yet released. :+1: for fixing the examples.
@geoffreywoo
FYI I solved my issue. It looks like it was a Carthage issue rather than one with Realm.
The Carthage copy-frameworks Run Script should have input files:
$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework
$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework/Frameworks/Realm.framework
This will copy the Realm.framework and RealmSwift.framework into the apps bundle at ./Frameworks/
@dbworku how is that solution hacky? It's working well, thanks! :smile:
I had this issue and adding
$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework/Frameworks/Realm.framework
as a copy-frameworks input file fixed it for me as well. This ought to be added to the Carthage installation instructions on http://realm.io/docs/swift/latest/#installation.
I think the fix provided by @dbworku and @jjoelson should be added to the Realm carthage documentation too. http://realm.io/docs/swift/latest
@pietbrauer that's a separate issue that we're trying to address by changing our Carthage packaging entirely.
I'm still experiencing the same problem.
My script is: /usr/local/bin/carthage copy-frameworks
my input files are: $(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework $(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework/Frameworks/Realm.framework
Error is:
/private/var/mobile/Containers/Bundle/Application/Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm: code signature invalid for '/private/var/mobile/Containers/Bundle/Application//Frameworks/RealmSwift.framework/Frameworks/Realm.framework/Realm'
What am I doing wrong? Also used Carthage
I'm also seeing this issue in our project using Carthage. The inner Realm.framework is supposedly unsigned. A temporary workaround for us for the moment is to use prebuilt binaries and include them without building via carthage, and then sign those on copy in the traditional manner (and then strip using the Realm strip script), rather than copy using Carthage's copy-frameworks
.
We'll be releasing a new version of Realm shortly which should address the code signing issues you've been seeing when using Realm's prebuilt binaries through our release zips or through Carthage binaries.
I'm pretty sure this all has been resolved as of v0.93.2?
Did you guys know the fact that the strip-frameworks.sh is actually on Realm.framework and not on RealmSwift.framework .-. How can it work for you?
@vyscond the comments in this thread are outdated. We used to include strip-frameworks.sh
in both frameworks, but since Realm Swift requires Realm Objective-C as a dependency, and the script only needs to be run once, we now only include it in Realm Objective-C. The Realm Swift installation instructions reflect this updated location.
@danielpovlsen reported that building the Swift example app 'Simple' succeeded with Xcode 6.3.1, but running the app on his iPad Air with iOS 8.3 produced the following issue on launch:
I double-checked the architecture slices in the executables (outer & inner framework) of the Swift release package, which cover all needed architectures. I wasn't able to reproduce this issue on a iPhone 6, which should have the same architecture.
The Team identifier selected in Xcode for the target was the preset:
None
.