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

When the latest versions of esp-hal and slint are present simultaneously, a compilation error occurs #1434

Closed
Song-aff opened this issue Apr 15, 2024 · 5 comments

Comments

@Song-aff
Copy link

When the latest versions of esp-hal and slint are present simultaneously, a compilation error occurs:

[dependencies]
esp-hal = { version = "0.16.1", features = ["esp32c3"] }
slint ={version = "1.5.1", default-features = false, features = [
    "compat-1-2",
    "unsafe-single-threaded",
    "libm",
    "renderer-software"]}

The error message is as follows:

cargo build
   Compiling portable-atomic v1.6.0
error: you may not enable feature `critical-section` and cfg(portable_atomic_unsafe_assume_single_core) at the same time
   --> /Users/admin/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/portable-atomic-1.6.0/src/lib.rs:409:1
    |
409 | / compile_error!(
410 | |     "you may not enable feature `critical-section` and cfg(portable_...
411 | | );
    | |_^

error: could not compile `portable-atomic` (lib) due to 1 previous error
@bjoernQ
Copy link
Contributor

bjoernQ commented Apr 15, 2024

Seems like slint unconditionally enables portable-atomic/critical-section here: https://github.com/slint-ui/slint/blob/master/internal/core/Cargo.toml#L58

While for C3 we enable portable-atomic/unsafe-assume-single-core here:

esp32c3 = ["dep:esp32c3", "riscv", "portable-atomic/unsafe-assume-single-core", "rv-zero-rtc-bss"]

Given this comment in the portable-atomic:

Therefore, for better performance, if all the critical-section implementation for your target does is disable interrupts, prefer using unsafe-assume-single-core feature instead.

I think for C3 we do the right thing here. Ideally Slint would have this a (default) feature to have a way to opt-out of this

@Song-aff
Copy link
Author

Seems like slint unconditionally enables portable-atomic/critical-section here: https://github.com/slint-ui/slint/blob/master/internal/core/Cargo.toml#L58

While for C3 we enable portable-atomic/unsafe-assume-single-core here:

esp32c3 = ["dep:esp32c3", "riscv", "portable-atomic/unsafe-assume-single-core", "rv-zero-rtc-bss"]

Given this comment in the portable-atomic:

Therefore, for better performance, if all the critical-section implementation for your target does is disable interrupts, prefer using unsafe-assume-single-core feature instead.

I think for C3 we do the right thing here. Ideally Slint would have this a (default) feature to have a way to opt-out of this

thank you.
Before the official issue in Slint is resolved, would you recommend me to fork the codebase and modify it to use portable-atomic/critical-section for C3, and then reference it?

@bjoernQ
Copy link
Contributor

bjoernQ commented Apr 15, 2024

Before the official issue in Slint is resolved, would you recommend me to fork the codebase and modify it to use portable-atomic/critical-section for C3, and then reference it?

That is probably a good workaround for now

@MabezDev
Copy link
Member

This is a slint issue, as per https://github.com/taiki-e/portable-atomic 's README, libraries should not enable critical-section etc features themselves.

@MabezDev
Copy link
Member

Closing this, but please file an issue against slint, I'm sure they'd be happy to resolve this on their end :).

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

No branches or pull requests

3 participants