Add instructions for macos support
andrewdavidmackenzie opened this issue · comments
now that flutter supports Mac OS, it would be great to include instructions for macos in the readme.
did you add the macOS
for the codegen at build.rs
?
Here for example you could configure the dart-bindgen
so you could add more platforms:
flutterust/native/adder-ffi/build.rs
Lines 13 to 17 in 41ae6da
on macOS
you should just build using cargo build
and it should generate .dylib
file in the traget/debug
.
but I guess better add the config in the Makefile.toml
.
Feel free to open a PR!
I don't think I know enough about how all this works to do either of the options you mention, but I will keep looking into it...
something like:
let config = DynamicLibraryConfig {
ios: DynamicLibraryCreationMode::Executable.into(),
android: DynamicLibraryCreationMode::open("libadder_ffi.so").into(),
macos: DynamicLibraryCreationMode::open("libadder_ffi.dylib").into(),
..Default::default()
};
and modifying native/adder_ffi/Cargo.toml
(manually to get it working first time) to:
[lib]
name = "adder_ffi"
crate-type = ["dylib"]
Maybe?
(not working so far)
I also tried using the existing staticlib produced, with a reference to libadder_ffi.a
in config, but no dice either.
Also tried:
[lib]
name = "adder_ffi"
crate-type = ["cdylib"]
You are close now, just instead of using libscrap_ffi.dylib
use the full path relative to the dart executable i.e ../trarget/debug/libsceap_ffi.dylib
.
Unfortunately I don't own mac device right now (getting one soon), but once my hands on one I will try to add that.
Unless you figured it out before me 😉
Maybe if you can get one of the "desktops" supported by Flutter working, then I can copy and modify?
https://flutter.dev/desktop
I alse meet the same problem
Compiling adder-ffi v0.1.0 (/Users/admin/flutterust/native/adder-ffi)
error: failed to run custom build command for adder-ffi v0.1.0 (/Users/admin/flutterust/native/adder-ffi)
Caused by:
process didn't exit successfully: /Users/admin/flutterust/target/debug/build/adder-ffi-b63e74a431e464b0/build-script-build
(signal: 6, SIGABRT: process abort signal)
--- stderr
dyld: Library not loaded: @rpath/libclang.dylib
Referenced from: /Users/admin/flutterust/target/debug/build/adder-ffi-b63e74a431e464b0/build-script-build
Reason: image not found
[cargo-make][1] ERROR - Error while executing command, exit code: 101
[cargo-make][1] WARN - Build Failed.
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.
Hey @fbenpao, you need LLVM.
see https://github.com/shekohex/flutterust#macos
install it: brew install llvm
I get dyld: Library not loaded: @rpath/libclang.dylib
and I have LLVM installed.
m1 chip mac mini:
dyld: Library not loaded: @rpath/libclang.dylib
I have LLVM installed.
dart_bindgen
and/or it's usage in build.rs is the culprit for the dyld: Library not loaded: @rpath/libclang.dylib
error.