stefson commented on Issue #1219:
okay, that very error already is underway to get fixed in https://github.com/bytecodealliance/wasmtime/pull/1226
kubkon commented on Issue #1219:
Hey @stefson, thanks for the report. Could you do me a favour actually, and rebase onto #1226 and see if it indeed fixes the error (unless you've already done it of course)?
stefson commented on Issue #1219:
ok, so I git cloned your fork and did
git checkout yanix-error-cleanup
, followed bycd crates/wasi-common/yanix
and cargo build. It turns out that with the commits you added plus my patch from above, there's a new error now:cargo build --target armv7-unknown-linux-gnueabihf Compiling yanix v0.12.0 (/tmp/wasmtime/crates/wasi-common/yanix) error[E0433]: failed to resolve: use of undeclared type or module `Errno` --> crates/wasi-common/yanix/src/file.rs:247:23 | 247 | let offset: i64 = Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?.into(); | ^^^^^ use of undeclared type or module `Errno` error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:10:17 | 10 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0433. For more information about an error, try `rustc --explain E0277`. error: could not compile `yanix`.and I think that's due to you changing from Errno to Error in that line, right?
kubkon labeled Issue #1219:
git clone the repo, cd wasmtime/crates/wasi-common/yanix and execute cargo build fails with this beauty:
crates/wasi-common/yanix $ cargo build Updating crates.io index Downloaded cfg-if v0.1.10 Downloaded thiserror v1.0.11 Downloaded libc v0.2.67 Downloaded log v0.4.8 Downloaded bitflags v1.2.1 Downloaded thiserror-impl v1.0.11 Downloaded proc-macro2 v1.0.8 Downloaded quote v1.0.2 Downloaded unicode-xid v0.2.0 Downloaded syn v1.0.15 Compiling proc-macro2 v1.0.8 Compiling unicode-xid v0.2.0 Compiling syn v1.0.15 Compiling bitflags v1.2.1 Compiling libc v0.2.67 Compiling log v0.4.8 Compiling cfg-if v0.1.10 Compiling quote v1.0.2 Compiling thiserror-impl v1.0.11 Compiling thiserror v1.0.11 Compiling yanix v0.12.0 (/home/tim/wasmtime/crates/wasi-common/yanix) error[E0308]: try expression alternatives have incompatible types --> crates/wasi-common/yanix/src/file.rs:247:23 | 247 | let offset: i64 = Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected `i64`, found `i32` | help: you can convert an `i32` to `i64`: `Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?.into()` error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:10:17 | 10 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. error: could not compile `yanix`.aarch64 seems fine.
rustc is v1.41.1 with llvm-9
kubkon commented on Issue #1219:
Yep, looks like it! So the general gist now is to re-use
std::io::Error
to spawn and wrap raw OS errno values instead of maintaining yet another mapping between errno values and some enum type. Anyhow, thanks for looking into it! After we land #1226, I'll be happy to help you out in weeding out any errors that might have left over.
stefson commented on Issue #1219:
ok, sweet, so here's the rebased patch for your branch, please simply add it if it's to your liking:
--- a/crates/wasi-common/yanix/src/file.rs +++ b/crates/wasi-common/yanix/src/file.rs @@ -244,6 +244,6 @@ pub unsafe fn fionread(fd: RawFd) -> Result<u32> { /// This function is unsafe because it operates on a raw file descriptor. /// It's provided, because std::io::Seek requires a mutable borrow. pub unsafe fn tell(fd: RawFd) -> Result<u64> { - let offset: i64 = Error::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?; + let offset: i64 = Error::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?.into(); Ok(offset.try_into()?) }and thank you for the offer, I'm totally new to rust and might need a bit of help with the other error. The first one was simple, since the compiler error message told me exactly what to do.
kubkon commented on Issue #1219:
No probs, perfect opportunity to learn some Rust then!
Actually, I'd prefer if you submitted a separate PR either with #1226 as base, or waited until that one lands (which should be sometime today/tomorrow). This way we'd have contexts separated which should aid the readability of what's going on in
wasmtime
:-)
kubkon assigned Issue #1219 (assigned to kubkon):
git clone the repo, cd wasmtime/crates/wasi-common/yanix and execute cargo build fails with this beauty:
crates/wasi-common/yanix $ cargo build Updating crates.io index Downloaded cfg-if v0.1.10 Downloaded thiserror v1.0.11 Downloaded libc v0.2.67 Downloaded log v0.4.8 Downloaded bitflags v1.2.1 Downloaded thiserror-impl v1.0.11 Downloaded proc-macro2 v1.0.8 Downloaded quote v1.0.2 Downloaded unicode-xid v0.2.0 Downloaded syn v1.0.15 Compiling proc-macro2 v1.0.8 Compiling unicode-xid v0.2.0 Compiling syn v1.0.15 Compiling bitflags v1.2.1 Compiling libc v0.2.67 Compiling log v0.4.8 Compiling cfg-if v0.1.10 Compiling quote v1.0.2 Compiling thiserror-impl v1.0.11 Compiling thiserror v1.0.11 Compiling yanix v0.12.0 (/home/tim/wasmtime/crates/wasi-common/yanix) error[E0308]: try expression alternatives have incompatible types --> crates/wasi-common/yanix/src/file.rs:247:23 | 247 | let offset: i64 = Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected `i64`, found `i32` | help: you can convert an `i32` to `i64`: `Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?.into()` error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:10:17 | 10 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. error: could not compile `yanix`.aarch64 seems fine.
rustc is v1.41.1 with llvm-9
stefson commented on Issue #1219:
with the rebased source tree, and when #1231 is applied, the second error remains:
error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:10:17 | 10 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`.I tried to switch to
from_raw(loc: i32)
in that line, since i64 seems to be wrong, but that doesn't seem to solve anything :/
stefson commented on Issue #1219:
still struggeling, five new regressions since https://github.com/bytecodealliance/wasmtime/commit/061390ee1b1085a2191019d2219da730ec62485f
/tmp/wasmtime/crates/wasi-common/yanix $ cargo build --target armv7-unknown-linux-gnueabihf Compiling libc v0.2.67 Compiling cfg-if v0.1.10 Compiling bitflags v1.2.1 Compiling log v0.4.8 Compiling filetime v0.2.8 Compiling yanix v0.12.0 (/tmp/wasmtime/crates/wasi-common/yanix) error[E0308]: mismatched types --> crates/wasi-common/yanix/src/filetime.rs:18:29 | 18 | tv_sec: ft.seconds(), | ^^^^^^^^^^^^ expected `i32`, found `i64` error[E0308]: mismatched types --> crates/wasi-common/yanix/src/filetime.rs:19:30 | 19 | tv_nsec: i64::from(ft.nanoseconds()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64` error[E0308]: mismatched types --> crates/wasi-common/yanix/src/filetime.rs:72:22 | 72 | tv_nsec: UTIME_NOW, | ^^^^^^^^^ expected `i32`, found `i64` error[E0308]: mismatched types --> crates/wasi-common/yanix/src/filetime.rs:76:22 | 76 | tv_nsec: UTIME_OMIT, | ^^^^^^^^^^ expected `i32`, found `i64` error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:13:17 | 13 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error[E0308]: mismatched types --> crates/wasi-common/yanix/src/sys/linux/utimesat.rs:39:17 | 39 | tv_sec: ft.seconds(), | ^^^^^^^^^^^^ expected `i32`, found `i64` error: aborting due to 6 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. error: could not compile `yanix`. To learn more, run the command again with --verbose.
stefson commented on Issue #1219:
@kubkon if you happen to commit further changes to yanix, can you please do a testrun with
cargo build --target armv7-unknown-linux-gnueabihf
before you push the changes, to prevent further breakage?
kubkon commented on Issue #1219:
@stefson OK, it's good that these have surfaced now. It looks like we might have to make certain targeted adjustments for
armv7-unknown-linux-gnueabihf
. Is this a 32bit architecture?
stefson commented on Issue #1219:
yes, it is 32bit, with hardfloat.
64bit is aarch64-unknown-linux-gnu (passes fine)
kubkon commented on Issue #1219:
Should now be fixed with #1269 :-)
stefson commented on Issue #1219:
That's right, the yanix crate does now compile just fine. Thank you for helping with this! :+1:
kubkon closed Issue #1219 (assigned to kubkon):
git clone the repo, cd wasmtime/crates/wasi-common/yanix and execute cargo build fails with this beauty:
crates/wasi-common/yanix $ cargo build Updating crates.io index Downloaded cfg-if v0.1.10 Downloaded thiserror v1.0.11 Downloaded libc v0.2.67 Downloaded log v0.4.8 Downloaded bitflags v1.2.1 Downloaded thiserror-impl v1.0.11 Downloaded proc-macro2 v1.0.8 Downloaded quote v1.0.2 Downloaded unicode-xid v0.2.0 Downloaded syn v1.0.15 Compiling proc-macro2 v1.0.8 Compiling unicode-xid v0.2.0 Compiling syn v1.0.15 Compiling bitflags v1.2.1 Compiling libc v0.2.67 Compiling log v0.4.8 Compiling cfg-if v0.1.10 Compiling quote v1.0.2 Compiling thiserror-impl v1.0.11 Compiling thiserror v1.0.11 Compiling yanix v0.12.0 (/home/tim/wasmtime/crates/wasi-common/yanix) error[E0308]: try expression alternatives have incompatible types --> crates/wasi-common/yanix/src/file.rs:247:23 | 247 | let offset: i64 = Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected `i64`, found `i32` | help: you can convert an `i32` to `i64`: `Errno::from_result(libc::lseek(fd, 0, libc::SEEK_CUR))?.into()` error[E0277]: the trait bound `i32: std::convert::From<i64>` is not satisfied --> crates/wasi-common/yanix/src/sys/linux/mod.rs:10:17 | 10 | Ok(Self(loc)) | ^^^ the trait `std::convert::From<i64>` is not implemented for `i32` | = help: the following implementations were found: <i32 as std::convert::From<bool>> <i32 as std::convert::From<i16>> <i32 as std::convert::From<i8>> <i32 as std::convert::From<std::num::NonZeroI32>> and 2 others = note: required because of the requirements on the impl of `std::convert::Into<i32>` for `i64` error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. error: could not compile `yanix`.aarch64 seems fine.
rustc is v1.41.1 with llvm-9
Last updated: Nov 22 2024 at 16:03 UTC