Open Bilonik opened 10 months ago
realm_dart
is a dart-only package. You should instead add the realm
package.
Hi @nirinchev , Yes we use the realm package (Not realm_dart). When we Archive and Upload with local Xcode its works, but when we use the Xcode Cloud CI its crash with this error:
Only on MacOS build we have errors.
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/librealm_dart.dylib
Referenced from:
What are the contents of realm.framework
in the XCode Cloud archived version?
Hi @nirinchev
This is whats inside realm.framework:
Hm... we haven't been able to repro this, so do you think it'd be possible to create a small repro project (if it reproduces for you outside of your main project). One thing one of our Swift engineers pointed as interesting is that on the first screenshot, you have the swift libraries, whereas those are missing on the second - this likely means that the target OS between the Xcode Cloud and local builds is different. I believe starting with macOS 10.14.4, the swift libraries are part of the OS and won't be bundled, so it's worth checking to see if there's indeed a difference there and if so - what other differences there are.
I was able to reproduce this issue with one of realm demos (https://github.com/realm/realm-dart-samples/tree/main/flutter_flexible_sync).
I created the repo to include the CI code and connect it to Xcode Cloud: https://github.com/Bilonik/flutter_flexible_sync
Hi @nirinchev ,
Let me know if you need any more information.
Thank you
Hey @Bilonik,
I'm currently trying to reproduce the issue you describe. I haven't used Xcode Cloud before so it's taking me a while. I hope I can have an answer soon.
I've been able to reproduce this on Xcode Cloud, but also locally, even in a brand new app I made with flutter create
. It seems that CocoaPods is ignoring the realm native library and not generating the right Xcode build phase to include it in the app bundle. What is the CocoaPods version you're running locally where the build correctly embeds the dylib?
In the mean time, a workaround is to manually add the Flutter/ephemeral/.symlinks/plugins/realm/macos/librealm_dart.dylib
file in the macos
folder in your project to the Link Binary with Libraries
build phase of the Runner target in Runner.xcodeproj in Xcode.
@fealebenpae CocoaPod version 1.14.3 locally works.
Any updates on this topic? I have the same issue on building macOS app with GitHub actions. We use the version 20.0.0 of the lib.
ASI found [dyld] (sensitive) 'Library not loaded: @rpath/librealm_dart.dylib
Referenced from: <35359B32-D6CF-3EF4-97B5-00CE7EDEC38D> /Applications/OSOI_macOS.app/Contents/MacOS/OSOI_macOS
Reason: tried: '/usr/lib/swift/librealm_dart.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/librealm_dart.dylib' (no such file), '/Applications/OSOI_macOS.app/Contents/Frameworks/librealm_dart.dylib' (no such file), '/Applications/OSOI_macOS.app/Contents/MacOS/Frameworks/librealm_dart.dylib' (no such file), '/Applications/Xcode_16.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/librealm_dart.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Xcode_16.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/librealm_dart.dylib' (no such file), '/usr/lib/swift/librealm_dart.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/librealm_dart.dylib' (no suc<…>'
Hi, Any updates on this issue? My workaround is to copy the librealm_dart.dylib to this directory ./build/macos/Build/Products/Debug/app.app/Contents/Frameworks/realm.framework/Versions/A/Framework/
@lokalathlet and @WebDucer you need to reach out to MongoDB support directly - otherwise this repo is now relying on the community to solve issues / make improvements. If you see the MongoDB Realm Device Sync depreciation in Google. (I am not a MongoDB employee!)
FYI @lokalathlet and @WebDucer MongoDB team are taking in PRs which they say they will review/etc, so if you have a solution it would be great to get this raised if possible.
@dotjon0 No real solution so far, only a workaround. We execute the build steps twice (in the same GitHub job), then it works.
- name: Restore dependencies
working-directory: "src"
run: |
flutter pub get
flutter precache --macos
- name: Restore Pods
working-directory: "src/macos"
run: |
pod --version
pod repo update
pod install
- name: Build macOS App
working-directory: "src"
run: flutter build macos --release
- name: Restore dependencies 2
working-directory: "src"
run: |
flutter clean
flutter pub get
- name: Restore Pods 2
working-directory: "src/macos"
run: |
pod install
- name: Build macOS App 2
working-directory: "src"
run: flutter build macos --release
@dotjon0 No real solution so far, only a workaround. We execute the build steps twice (in the same GitHub job), then it works.
- name: Restore dependencies working-directory: "src" run: | flutter pub get flutter precache --macos - name: Restore Pods working-directory: "src/macos" run: | pod --version pod repo update pod install - name: Build macOS App working-directory: "src" run: flutter build macos --release - name: Restore dependencies 2 working-directory: "src" run: | flutter clean flutter pub get - name: Restore Pods 2 working-directory: "src/macos" run: | pod install - name: Build macOS App 2 working-directory: "src" run: flutter build macos --release
Funny enough we have actually just done the same! Did not clock this was the same issue!
What happened?
Missing librealm_dart.dylib when compiling with Xcode Cloud
Repro steps
Steps to reproduce
1.Install a package like realm. 2.Archive with Xcode Cloud for MacOS
Expected results
On local machine when I Archive and upload to Appstore my package contains all the .dylib
Actual results
On Xcode Cloud when it archive the artifact is missing those dylib.
UNITO-UNDERSCORE!dylib!
Code sample
Code sample
this is my ci_post_clone.sh ```bash #!/bin/sh # The default execution directory of this script is the ci_scripts directory. cd $CI_PRIMARY_REPOSITORY_PATH # change working directory to the root of your cloned repo. # Install Flutter using git. git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter export PATH="$PATH:$HOME/flutter/bin" # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms. flutter precache --macos # Install Flutter dependencies. flutter pub get # Install CocoaPods using Homebrew. HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates. brew install cocoapods dart run realm install cd macos && pod install flutter build macos exit 0 ```Version
1.6.1
What Atlas Services are you using?
Atlas Device Sync
What type of application is this?
Flutter Application
Client OS and version
Mac OS Sonoma 14.2.1
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output
No response