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

Add instructions for macos support #11

Open
andrewdavidmackenzie opened this issue Nov 8, 2020 · 13 comments
Open

Add instructions for macos support #11

andrewdavidmackenzie opened this issue Nov 8, 2020 · 13 comments

Comments

@andrewdavidmackenzie
Copy link

now that flutter supports Mac OS, it would be great to include instructions for macos in the readme.

@andrewdavidmackenzie
Copy link
Author

I've tried using all the usual instructionsn to enable mac os that work on other apps, it builds and tries to start but you get the "platform not supported" window shown.

Screenshot 2020-11-14 at 20 15 50

@shekohex
Copy link
Owner

shekohex commented Nov 15, 2020

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:

let config = DynamicLibraryConfig {
ios: DynamicLibraryCreationMode::Executable.into(),
android: DynamicLibraryCreationMode::open("libadder_ffi.so").into(),
..Default::default()
};

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!

@andrewdavidmackenzie
Copy link
Author

andrewdavidmackenzie commented Nov 15, 2020

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"]

@andrewdavidmackenzie
Copy link
Author

I tried making the same Cargo.toml and build.rs modifications for scrap_ffi, then the error message change to:

Screenshot 2020-11-15 at 10 06 01

even though the .dylib file is in target/debug..

So, enough trying in the dark for now - I may come back to this later.

@shekohex
Copy link
Owner

shekohex commented Nov 15, 2020

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 😉

@andrewdavidmackenzie
Copy link
Author

Screenshot 2020-11-15 at 14 31 42

:-(

@andrewdavidmackenzie
Copy link
Author

Maybe if you can get one of the "desktops" supported by Flutter working, then I can copy and modify?
https://flutter.dev/desktop

@myway7
Copy link

myway7 commented Dec 8, 2020

I alse meet the same problem

@myway7
Copy link

myway7 commented Dec 8, 2020

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.

@shekohex
Copy link
Owner

shekohex commented Dec 8, 2020

Hey @fbenpao, you need LLVM.
see https://github.com/shekohex/flutterust#macos
install it: brew install llvm

@adamcypher
Copy link

I get dyld: Library not loaded: @rpath/libclang.dylib and I have LLVM installed.

@suyulin
Copy link

suyulin commented Aug 25, 2021

m1 chip mac mini:
dyld: Library not loaded: @rpath/libclang.dylib
I have LLVM installed.

@adamcypher
Copy link

dart_bindgen and/or it's usage in build.rs is the culprit for the dyld: Library not loaded: @rpath/libclang.dylib error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants