rust2go icon indicating copy to clipboard operation
rust2go copied to clipboard

Compile issue on my OS Windows11

Open lirenjie95 opened this issue 1 year ago • 3 comments

Steps to reproduce

cd test
cargo build

And then I got this issue: Image

lirenjie95 avatar Jan 30 '25 11:01 lirenjie95

After making following change, the compile issue looks like got mitigated, but we have another issue

diff --git a/Cargo.lock b/Cargo.lock
index 0b4c675..1bb3ef0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -994,8 +994,8 @@ dependencies = [
 name = "test"
 version = "0.1.0"
 dependencies = [
- "monoio",
  "rust2go",
+ "tokio",
 ]
 
 [[package]]
diff --git a/test/Cargo.toml b/test/Cargo.toml
index dfe55c4..19e345e 100644
--- a/test/Cargo.toml
+++ b/test/Cargo.toml
@@ -6,7 +6,7 @@ publish = false
 
 [dependencies]
 rust2go = { path = "../rust2go" }
-monoio = { workspace = true, features = ["sync"] }
+tokio = { version = "1", features = ["rt", "macros"] }
 
 [build-dependencies]
 rust2go = { path = "../rust2go", features = ["build"] }
diff --git a/test/build.rs b/test/build.rs
index 853198e..5a497d9 100644
--- a/test/build.rs
+++ b/test/build.rs
@@ -1,11 +1,21 @@
+use std::path::PathBuf;
+
 use rust2go::RegenArgs;
 
 fn main() {
     rust2go::Builder::new()
-        .with_go_src("./go")
+        .with_go_src(PathBuf::from(".").join("go"))
         .with_regen_arg(RegenArgs {
-            src: "./src/user.rs".into(),
-            dst: "./go/gen.go".into(),
+            src: PathBuf::from(".")
+                .join("src")
+                .join("user.rs")
+                .to_string_lossy()
+                .into_owned(),
+            dst: PathBuf::from(".")
+                .join("go")
+                .join("gen.go")
+                .to_string_lossy()
+                .into_owned(),
             go118: true,
             ..Default::default()
         })
diff --git a/test/src/lib.rs b/test/src/lib.rs
index ac37986..02bf903 100644
--- a/test/src/lib.rs
+++ b/test/src/lib.rs
@@ -9,7 +9,7 @@ mod tests {
         assert_eq!(TestCallImpl::ping(1995), 1995);
     }
 
-    #[monoio::test(timer_enabled = true)]
+    #[tokio::test]
     async fn login() {
         macro_rules! login {
             ($id:expr, $name:expr, $pass:expr, $message: expr) => {{
@@ -36,7 +36,7 @@ mod tests {
         });
     }
 
-    #[monoio::test(timer_enabled = true)]
+    #[tokio::test]
     async fn add_friends() {
         let wrong_token_req = unsafe {
             TestCallImpl::add_friends(&FriendsListRequest {
@@ -69,7 +69,7 @@ mod tests {
         );
     }
 
-    #[monoio::test(timer_enabled = true)]
+    #[tokio::test]
     async fn delete_friends() {
         unsafe {
             TestCallImpl::add_friends(&FriendsListRequest {
@@ -89,7 +89,7 @@ mod tests {
         );
     }
 
-    #[monoio::test(timer_enabled = true)]
+    #[tokio::test]
     async fn pm_friends() {
         unsafe {
             TestCallImpl::add_friends(&FriendsListRequest {

Image

Image

Image

lirenjie95 avatar Jan 30 '25 11:01 lirenjie95

@ihciah @suikammd Can you take a look and guide me work through it? Look like we can open a PR for enhancement.

lirenjie95 avatar Jan 30 '25 11:01 lirenjie95

It's due to the initial design of the mem-ring which uses unix domain socket.

To solve this problem, we can use #[cfg(unix)] conditional compilation for mem-ring related code(for windows, #[mem] will be treated as normal cgo based implementation); later we can consider using some kind of UDS replacement for the Windows platform.

ihciah avatar Jan 30 '25 11:01 ihciah

As windows user, WSL would be a good option to run this project.

lirenjie95 avatar Jul 27 '25 14:07 lirenjie95