Comments (7)
I planned to add rpath to rustc-link-arg
as soon as 1.56 becomes stable. I'll be very happy to get rid of .cargo/config.toml
.
from nativeshell.
Alright, I tracked this down to a weird conflict with a specific dependency in our existing crate. I'll chat to the developer on that and see what I can figure out.
from nativeshell.
Perhaps there is an older version of lazy_static
that requires types to be Send
as well? In NativeShell we know that the static is only used from main thread so if this is a big problem maybe we could just add unsafe impl Send for Global {}
, but it would be good to know why exactly is this happening.
from nativeshell.
@knopp I got to the bottom of this, but I don't know the appropriate fix
lazy_static is pulled in a few places, always 1.4.0. However, one of our dependencies pulls in rsa and num-bigint; both of which enable the spin_no_std
feature of lazy_static. Once one dependency enables a feature, everybody gets it.
I can't find the documentation on it, but it's that feature that's requiring Send
across the board.
I can fix this by adding unsafe impl Send...
(at least on macOS, that's for ApplicationDelegateClass
, MenuItemTargetClass
, WindowClass
and WindowDelegateClass
. On Windows it's Global
. I didn't check Linux yet). I could make a PR to that effect.
Otherwise, we could just build our own fork of nativeshell and wait until this all gets worked out upstream. In general there seems some concern over that feature of lazy_static.
Do you have another idea?
from nativeshell.
I took a look at the spin-rs
crate and it seems to be that it is using a very basic spin lock under the hood that might suffer from priority inversion. I find it quite concerning that there are crates unconditionally forcing this behavior.
This might be relevant. Edit: I now noticed that you mentioned the issue already.
All this aside, I do not mind adding Send
to these classes knowing now that lazy_static
might be requiring this in some circumstances. If you submit the PR (preferably with a comment explaining why it there is unsafe Send
) I can merge it.
from nativeshell.
@knopp I will go ahead and do that within the next day or two. Thanks again!
from nativeshell.
I raised PR#91 to correct this.
A further incompatibility arrises with workspaces: when building from the workspace, the project-level .cargo/config.toml
is not consulted. Since (at least on macOS) the rpath is not properly set, the final binary fails with a dynamic linker error.
Currently we can workaround by specifying the configuration inside build.rs instead:
e.g. println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
That's an unstable feature until rust 1.56, so we also to use nightly and a modified build command:
e.g. cargo +nightly build -p nativeshell -Zextra-link-arg
from nativeshell.
Related Issues (20)
- Crashes on multiple monitors in Windows HOT 4
- Is there any way to lower the minimum supported version of macOS HOT 1
- way to run existing flutter code HOT 4
- How to specify libflutter location
- Frameless windows are not resizable on macOS
- Fails to build on apple silicon with Flutter 3.0.0 HOT 2
- The Flutter Attach to Process gets stuck on Waiting... HOT 3
- Invalid read causes segmentation fault HOT 3
- std::rc::Weak<ContextImpl>` cannot be sent between threads safely
- std::rc::Weak<ContextImpl>` cannot be sent between threads safely
- MenuItem clash with flutter widget of the same name HOT 1
- Getting an error when trying to run the examples HOT 2
- Build Error on MacOS 13.2.1 - cargo run or cargo run --release unable to build and run the flutter app for example provided
- Issues with native plugin `media_kit`
- Latest SharedPreferences not working HOT 1
- Jitter when resizing on Windows when frame is `WindowFrame.noTitle` HOT 1
- Unable to build sample project HOT 2
- [super_context_menu] Change/Remove Progress Indicator for DeferredMenuElement
- Calling dart from rust side?
- Support current stable version of Flutter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativeshell.