Failed to compile deno_runtime #32444
-
|
I'm trying to embed Deno into a Rust program. I followed the instructions from #21968 and used the deno_runtime crate. Rust v1.93.1 Here are my dependencies: [dependencies]
deno_core = "0.388.0"
deno_runtime = "0.243.0"
tokio = { version = "1", features = ["full"] }I encountered errors during the build, with many similar errors like this: error[E0308]: mismatched types
--> <delete>\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\deno_io-0.145.0\winpipe.rs:115:7
|
115 | Ok((server_handle, client_handle))
| ^^^^^^^^^^^^^ expected `libc::c_void`, found `winapi::ctypes::c_void`
|
= note: `winapi::ctypes::c_void` and `libc::c_void` have similar names, but are actually distinct typesI had to add .cast() to all these error locations to make it compile successfully. Is this a bug in the library, or have I not configured it correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I understand what the problem is now. winapi = { version = "=0.3.9", features = ["std"]}and now it compiles correctly. In winapi, pub mod ctypes {
#[cfg(feature = "std")]
pub use std::os::raw::c_void;
#[cfg(not(feature = "std"))]
pub enum c_void {}Only when the "std" feature is enabled can it compile correctly. |
Beta Was this translation helpful? Give feedback.
I understand what the problem is now.
I added
and now it compiles correctly.
In winapi,
Only when the "std" feature is enabled can it compile correctly.
The deno library doesn't explicitly declare this feature, but it may have been implicitly enabled due to features from some other dependencies.