Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load dynamic library #1143

Merged
merged 24 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
73eb8d8
Downgrade macOS and Ubuntu build OS
desistefanova Feb 6, 2023
68dec68
Loading realm library errors for all paths
desistefanova Feb 6, 2023
bfb8b07
Update changelog
desistefanova Feb 6, 2023
5e33a1e
Run tests on ubuntu 20.4
desistefanova Feb 6, 2023
5471102
Update lib/src/init.dart
desistefanova Feb 6, 2023
19fa621
Fix sintax
desistefanova Feb 6, 2023
89f21d3
Fix ci syntax error
desistefanova Feb 6, 2023
9d221b7
Return windows and macos buils to latest runners
desistefanova Feb 6, 2023
74c40ee
Fix tests for ubuntu-20.04
desistefanova Feb 6, 2023
404456c
Return back testing on Linux latest
desistefanova Feb 6, 2023
12d28af
fix expectation
blagoev Feb 7, 2023
333e8bf
Throw RealmError on loading library
desistefanova Feb 7, 2023
1550a2d
fix publish release yaml
blagoev Feb 7, 2023
af387f4
Added tests for ubunto 20.04
desistefanova Feb 7, 2023
58c6230
fix up tests
blagoev Feb 7, 2023
49657ea
expect with a specific message
blagoev Feb 7, 2023
04ff522
Update .github/workflows/flutter-desktop-tests.yml
blagoev Feb 7, 2023
50e423f
jobs renamed
desistefanova Feb 7, 2023
368e6b3
Merge branch 'build_runners_ver' of https://github.com/realm/realm-da…
desistefanova Feb 7, 2023
ad3dfc8
Add a commnet next to the build
desistefanova Feb 7, 2023
48d2009
remove not needed test
blagoev Feb 7, 2023
74cf9bd
Merge branch 'blagoev/fix-exception-expectation' into build_runners_ver
desistefanova Feb 7, 2023
7625372
Update .github/workflows/ci.yml
desistefanova Feb 7, 2023
a8c4947
Apply suggestions from code review
desistefanova Feb 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

jobs:
build-native:
runs-on: ${{ inputs.runner }}-latest
runs-on: ${{ inputs.runner }}
name: Build native
timeout-minutes: 60
strategy:
Expand All @@ -37,7 +37,7 @@ jobs:
uses: actions/cache@v3
with:
path: ./binary/**
key: binaries-${{ matrix.build }}-${{hashFiles('./src/**')}}
key: binaries-${{ matrix.build }}-{{ inputs.runner }}-${{hashFiles('./src/**')}}
desistefanova marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup Ninja
if: contains(github.head_ref, 'release/') || steps.check-cache.outputs.cache-hit != 'true'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,39 +129,39 @@ jobs:
name: Build Windows
uses: ./.github/workflows/build-native.yml
with:
runner: windows
runner: windows-2022
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
binary: windows
build: '["windows"]'

build-macos:
name: Build MacOS
uses: ./.github/workflows/build-native.yml
with:
runner: macos
runner: macos-11
binary: macos
build: '["macos"]'

build-linux:
name: Build Linux
uses: ./.github/workflows/build-native.yml
with:
runner: ubuntu
runner: ubuntu-20.04
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
binary: linux
build: '["linux"]'

build-android:
name: Build Android
uses: ./.github/workflows/build-native.yml
with:
runner: ubuntu
runner: ubuntu-20.04
binary: android
build: '["android-x86", "android-x86_64", "android-armeabi-v7a", "android-arm64-v8a"]'

build-ios:
name: Build IOS
uses: ./.github/workflows/build-native.yml
with:
runner: macos
runner: macos-11
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
binary: ios
build: '["ios-device", "ios-simulator", "ios-catalyst"]'

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**This project is in Release Candidate stage.**

### Enhancements
* None
* Improved error information returned when the `realm_dart` library failed to load. ([#1143](https://github.com/realm/realm-dart/pull/1143))

### Fixed
* Improve performance of interprocess mutexes on iOS which don’t need to support reader-writer locking. The primary beneficiary of this is beginning and ending read transactions, which is now almost as fast as pre-v13.0.0 (Core upgrade).
Expand Down
22 changes: 20 additions & 2 deletions lib/src/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ DynamicLibrary _openRealmLib() {
final root = _getNearestProjectRoot(Platform.script.path) ?? _getNearestProjectRoot(p.current);

// Try to open lib from various candidate paths
Error? ex;
LoadRealmLibraryError? ex;
for (final open in [
() => _open(libName), // just ask OS..
() => _open(p.join(_exeDirName, libName)), // try finding it next to the executable
Expand All @@ -75,7 +75,8 @@ DynamicLibrary _openRealmLib() {
try {
return open();
} on Error catch (e) {
ex ??= e; // remember first exception, if everything fails
ex ??= LoadRealmLibraryError();
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
ex.add(e);
}
}
throw ex!; // rethrow first
Expand Down Expand Up @@ -112,3 +113,20 @@ DynamicLibrary initRealm() {

return _library = realmLibrary;
}

class LoadRealmLibraryError extends Error {
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
List<Error> loadingFromPathErrors = [];
void add(Error err) {
loadingFromPathErrors.add(err);
}

@override
desistefanova marked this conversation as resolved.
Show resolved Hide resolved
@override
String toString() {
List<String> errMessages = [];
for (Error err in loadingFromPathErrors) {
errMessages.add(err.toString());
}
return errMessages.join('\n');
}
}