Closed kingfisherphuoc closed 1 year ago
Hi! Thanks for opening your first issue here! :smile:
Library not loaded: '/Users/*/Library/Developer/Xcode/DerivedData/Runner-eixmpjopssepzedozqbaoavjkhar/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/native.build/cargo_target/aarch64-apple-darwin/release/deps/libnative.dylib'
/cc @Roms1383 IIRC you faced some similar issues when lib cannot be loaded in mac silicon - is this the same?
could be indeed @fzyzcjy, but @kingfisherphuoc you already tried the fix like in this comment I guess ?
@Roms1383 yes, I did try the fix. Previously, I cannot run the project on M1 mac, but after the fix I can run it normally:
// This file initializes the dynamic library and connects it with the stub
// generated by flutter_rust_bridge_codegen.
import 'dart:ffi';
import 'dart:io' as io;
import 'bridge_generated.dart';
// Re-export the bridge so it is only necessary to import this file.
export 'bridge_generated.dart';
const _base = 'native';
// On MacOS, the dynamic library is not bundled with the binary,
// but rather directly **linked** against the binary.
final _dylib = io.Platform.isWindows ? '$_base.dll' : 'lib$_base.so';
final Native api = NativeImpl(((io.Platform.isIOS || io.Platform.isMacOS) && !const bool.fromEnvironment('SILICON', defaultValue: false))
? DynamicLibrary.executable() : DynamicLibrary.open(_dylib));
The problem is when I tried to build flutter build macos
, the generated built (*.app) run well on my Mac. However, when I sent it to others Macs (both M1 or M2), it did not run at all and I got the crash above.
@kingfisherphuoc well, I must admit I have no clue and I cannot reproduce it since I have a single machine (M1 from last year). Is it blocking for you or acceptable to build it on the target platform each time ? Do you think it'd bring some concern later down the pipeline when it comes to e.g. release your final version ? @fzyzcjy probably knows more than I do on this topic, sorry but this is typically an area where my knowledge falls short (which is also part of the reason I came to contribute to FRB in the first place).
I also do not have a M2 indeed (mine is Intel CPU). That looks like general flutter and/or rust setup problem though, so maybe people in general flutter/rust know a bit more.
I have another intel Mac (2013). I will try to create another version from it. (it's working well on other targets: IOS, Android, Windows).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Describe the bug
I built a MacOS app by using Flutter (
flutter build macos
command). It's working well on my M1 Macbook. However, when I tested on my friend's M2 Mac, it crashed. Does anyone have a clue how to fix it? Here's the log:Codegen logs with
RUST_LOG=debug
environment variableTo Reproduce
No response
Expected behavior
No response
Generated binding code
No response
OS
MacOs
Version of
flutter_rust_bridge_codegen
1.45.0
Flutter info
No response
Version of
clang++
No response
Version of
ffigen
No response
Additional context
No response