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

Path + no_std: Compile error in the slint generated code #2026

Closed
hbhong opened this issue Dec 29, 2022 · 9 comments
Closed

Path + no_std: Compile error in the slint generated code #2026

hbhong opened this issue Dec 29, 2022 · 9 comments
Labels
a:renderer-software Software Renderer (mO,bF) bug Something isn't working

Comments

@hbhong
Copy link

hbhong commented Dec 29, 2022

I try to integrate slint into esp32c3 MCU, but when using the Path, it outputs many compile errors:

here is some errors stack:
error[E0433]: failed to resolve: use of undeclared type Path
--> /drn/RustProjects/esp-temp/target/riscv32imc-esp-espidf/debug/build/esp-temp-e58ca89bad1bdb6e/out/m2.rs:69:20
|
69 | + r#Path :: FIELD_OFFSETS . r#elements) . apply_pin (_self) , & self_rc , move | self_rc | {
| ^^^^^^ use of undeclared type Path

error[E0433]: failed to resolve: could not find PathData in re_exports
--> /drn/RustProjects/esp-temp/target/riscv32imc-esp-espidf/debug/build/esp-temp-e58ca89bad1bdb6e/out/m2.rs:80:73
|
80 | ... slint :: private_unstable_api :: re_exports :: PathData :: Elements (slint :: private_unstable_api :: re_exports :: SharedVector ::...
| ^^^^^^^^ could not find PathData in re_exports

error[E0433]: failed to resolve: use of undeclared type Path
--> /drn/RustProjects/esp-temp/target/riscv32imc-esp-espidf/debug/build/esp-temp-e58ca89bad1bdb6e/out/m2.rs:98:16
|
98 | + r#Path :: FIELD_OFFSETS . r#fill) . apply_pin (_self) . set ({
| ^^^^^^ use of undeclared type Path

error[E0433]: failed to resolve: use of undeclared type Path

here is online code

@tronical
Copy link
Member

tronical commented Jan 2, 2023

Unfortunately path rendering is not supported on MCU builds yet (no_std and software renderer) :(

@tronical tronical added bug Something isn't working a:renderer-software Software Renderer (mO,bF) labels Jan 2, 2023
@hbhong
Copy link
Author

hbhong commented Jan 3, 2023

@tronical Thank you for your reply,
I checked the codes, as you said, the 'Path' is enabled only for 'std' feature, the Path is very useful for my project, is there a plan to support this feature?

@tronical
Copy link
Member

tronical commented Jan 3, 2023

Yes, we do plan to support Path with no_std builds.

@hbhong
Copy link
Author

hbhong commented Jan 3, 2023

@tronical
The ESP supports to create with std or bare metal, I'm coding it with the 'std' mode, it works without "Path" in the slint, so to make it work, I append 'std' feature into cargo.toml
but I got the following errors
error[E0425]: cannot find value MAP_FAILED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:93:29
|
93 | if ptr == libc::MAP_FAILED {
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:108:19
|
108 | libc::PROT_READ,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_SHARED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:109:19
|
109 | libc::MAP_SHARED | populate,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:119:19
|
119 | libc::PROT_READ | libc::PROT_EXEC,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_EXEC in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:119:37
|
119 | libc::PROT_READ | libc::PROT_EXEC,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_SHARED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:120:19
|
120 | libc::MAP_SHARED | populate,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:130:19
|
130 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_WRITE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:130:37
|
130 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_SHARED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:131:19
|
131 | libc::MAP_SHARED | populate,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:141:19
|
141 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_WRITE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:141:37
|
141 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_PRIVATE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:142:19
|
142 | libc::MAP_PRIVATE | populate,
| ^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:157:19
|
157 | libc::PROT_READ,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_PRIVATE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:158:19
|
158 | libc::MAP_PRIVATE | populate,
| ^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:169:19
|
169 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_WRITE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:169:37
|
169 | libc::PROT_READ | libc::PROT_WRITE,
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_PRIVATE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:170:19
|
170 | libc::MAP_PRIVATE | libc::MAP_ANON | stack,
| ^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MAP_ANON in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:170:39
|
170 | libc::MAP_PRIVATE | libc::MAP_ANON | stack,
| ^^^^^^^^ not found in libc

error[E0425]: cannot find function msync in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:181:28
|
181 | unsafe { libc::msync(self.ptr.offset(offset), len as libc::size_t, libc::MS_SYNC) };
| ^^^^^ help: a function with a similar name exists: fsync
|
::: /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.138/src/unix/mod.rs:1012:5
|
1012 | pub fn fsync(fd: ::c_int) -> ::c_int;
| ------------------------------------ similarly named function fsync defined here

error[E0425]: cannot find value MS_SYNC in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:181:86
|
181 | unsafe { libc::msync(self.ptr.offset(offset), len as libc::size_t, libc::MS_SYNC) };
| ^^^^^^^ help: a constant with a similar name exists: O_SYNC
|
::: /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.138/src/unix/newlib/mod.rs:393:1
|
393 | pub const O_SYNC: ::c_int = 8192;
| ------------------------- similarly named constant O_SYNC defined here

error[E0425]: cannot find function msync in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:194:28
|
194 | unsafe { libc::msync(self.ptr.offset(offset), len as libc::size_t, libc::MS_ASYNC) };
| ^^^^^ help: a function with a similar name exists: fsync
|
::: /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.138/src/unix/mod.rs:1012:5
|
1012 | pub fn fsync(fd: ::c_int) -> ::c_int;
| ------------------------------------ similarly named function fsync defined here

error[E0425]: cannot find value MS_ASYNC in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:194:86
|
194 | unsafe { libc::msync(self.ptr.offset(offset), len as libc::size_t, libc::MS_ASYNC) };
| ^^^^^^^^ not found in libc

error[E0425]: cannot find function mprotect in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:208:22
|
208 | if libc::mprotect(ptr, len, prot) == 0 {
| ^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:217:29
|
217 | self.mprotect(libc::PROT_READ)
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:221:29
|
221 | self.mprotect(libc::PROT_READ | libc::PROT_EXEC)
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_EXEC in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:221:47
|
221 | self.mprotect(libc::PROT_READ | libc::PROT_EXEC)
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_READ in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:225:29
|
225 | self.mprotect(libc::PROT_READ | libc::PROT_WRITE)
| ^^^^^^^^^ not found in libc

error[E0425]: cannot find value PROT_WRITE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:225:47
|
225 | self.mprotect(libc::PROT_READ | libc::PROT_WRITE)
| ^^^^^^^^^^ not found in libc

error[E0425]: cannot find function madvise in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:245:22
|
245 | if libc::madvise(self.ptr, self.len, advice as i32) != 0 {
| ^^^^^^^ not found in libc

error[E0425]: cannot find value _SC_PAGESIZE in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/unix.rs:297:58
|
297 | let page_size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
| ^^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MADV_NORMAL in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/advice.rs:13:20
|
13 | Normal = libc::MADV_NORMAL,
| ^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MADV_RANDOM in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/advice.rs:19:20
|
19 | Random = libc::MADV_RANDOM,
| ^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MADV_SEQUENTIAL in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/advice.rs:26:24
|
26 | Sequential = libc::MADV_SEQUENTIAL,
| ^^^^^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MADV_WILLNEED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/advice.rs:32:22
|
32 | WillNeed = libc::MADV_WILLNEED,
| ^^^^^^^^^^^^^ not found in libc

error[E0425]: cannot find value MADV_DONTNEED in crate libc
--> /home/hbhong/.cargo/registry/src/github.com-1ecc6299db9ec823/memmap2-0.5.8/src/advice.rs:63:22
|
63 | DontNeed = libc::MADV_DONTNEED,
| ^^^^^^^^^^^^^ not found in libc

I'm new to Rust, I don't know what causes this, I already set the target is riscv32imc-esp-espidf in the config.toml. but seem the error stack shows it is compiling the UNIX codes, could you give me some advice for it? thanks!

@tronical
Copy link
Member

tronical commented Jan 3, 2023

I think that this error is due to some dependency trying to use mmap from the libc crate. That's a feature that requires an operating system kernel and an MMU - that can't be covered by esp's std support. But even with esp's std support, the Path feature also requires an implementation in the software renderer, and that remains missing, too.

@hbhong
Copy link
Author

hbhong commented Jan 3, 2023

I think that this error is due to some dependency trying to use mmap from the libc crate. That's a feature that requires an operating system kernel and an MMU - that can't be covered by esp's std support. But even with esp's std support, the Path feature also requires an implementation in the software renderer, and that remains missing, too.

Thank your information, hope Path feature is implemented soon!

@JohnAZoidberg
Copy link

Is is possible in the slint language to make certain components specific to a target environment?
To avoid those that are not supported by it and render a substitute?

@ogoffart
Copy link
Member

Is is possible in the slint language to make certain components specific to a target environment?

I think we should indeed do that.
Either we should make it a compiler error at .slint compile time (then we somehow need to give the feature information to the slint compiler)
We could also implement Path with no_std to be a no-op (but sill print warning)

@ogoffart ogoffart changed the title Compile error: can not compile when the Path in the slint Path + no_std: Compile error in the slint generated code Jun 27, 2023
@ogoffart
Copy link
Member

ogoffart commented Feb 6, 2024

I'm marking this as suplicate of #223 for better error
(while the PAth in sw renderer is tracked by #4178 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:renderer-software Software Renderer (mO,bF) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants