rust 货物构建卡在最后一个二进制文件上

icomxhvb  于 2023-05-17  发布在  其他
关注(0)|答案(1)|浏览(227)

当运行cargo build --verbosecargo run --verbose时,它会编译特定Rust项目上的所有依赖项,但会在最后一个文件上卡住。
输出:

Fresh unicode-ident v1.0.8
       Fresh proc-macro2 v1.0.56
       Fresh quote v1.0.27
       Fresh memchr v2.5.0
       Fresh syn v2.0.15
       Fresh aho-corasick v1.0.1
       Fresh serde_derive v1.0.163
       Fresh regex-syntax v0.7.1
       Fresh regex v1.8.1
       Fresh serde v1.0.163
       Fresh lazy_static v1.4.0
       Fresh itoa v1.0.6
       Fresh ryu v1.0.13
       Fresh Inflector v0.11.4
       Fresh windows_x86_64_msvc v0.48.0
       Fresh serde_json v1.0.96
       Fresh syn v1.0.109
       Fresh windows-targets v0.48.0
       Fresh deno_bindgen_macro v0.8.0
       Fresh windows v0.48.0
       Fresh deno_bindgen v0.8.0
   Compiling win_user_interaction v0.1.0 (C:\..\win_user_interaction)
     Running `rustc --crate-name win_user_interaction --edition=2021 src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=130 --crate-type cdylib --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=67ea228bc136237f --out-dir C:\...\win_user_interaction\target\debug\deps -C incremental=C:\...\win_user_interaction\target\debug\incremental -L dependency=C:\...\win_user_interaction\target\debug\deps --extern deno_bindgen=C:\...\win_user_interaction\target\debug\deps\libdeno_bindgen-1e5d169b6ae8380d.rlib --extern serde=C:\...\win_user_interaction\target\debug\deps\libserde-985b6777e5633ea0.rlib --extern windows=C:\...\win_user_interaction\target\debug\deps\libwindows-3a8b4eb173ae451b.rlib -L native=C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\windows_x86_64_msvc-0.48.0\lib`
    Building [=========================> ] 35/36: win_user_interaction

该项目只是一个文件,即,

use deno_bindgen::deno_bindgen;

pub mod touch_injection {
    use windows::Win32::UI::Input::Pointer::{InitializeTouchInjection, TOUCH_FEEDBACK_MODE};

    #[deno_bindgen]
    pub enum TouchFeedbackMode {
        Default = 0x1,
        Indirect = 0x2,
        None = 0x3
    }

    #[deno_bindgen]
    pub fn initialize_touch_injection(max_count: u32, mode: TouchFeedbackMode) {
        unsafe {
            InitializeTouchInjection(max_count, TOUCH_FEEDBACK_MODE(mode as u32));
        }
    }
}
  • cargo --version:货物1.69.0(6 e9 a83356 2023-04-12)
  • rustc --version:rustc 1.69.0(84c898d65 2023-04-16)
  • rustup --version:rustup 1.26.0(5af9b9484 2023-04-05)
  • rustup toolchain list:stable-x86_64-pc-windows-msvc(默认)

Cargo.toml:

[package]
name = "win_user_interaction"
version = "0.1.0"
edition = "2021"

[lib]
name = "win_user_interaction"
crate-type = ["cdylib"]

[dependencies]
deno_bindgen = "0.8.0"
serde = { version = "1.0.163", features = ["derive"] }
windows = { version = "0.48.0", features = ["Win32_Foundation", "Win32_UI_Input_Pointer"] }

我尝试过但不起作用的可能解决方案:

  • cargo clean
  • rustup update
  • 创建一个新的rust项目,并在Cargo.toml +中复制
qpgpyjmq

qpgpyjmq1#

显然,问题是由@Finomnis提到的,我在模块外部导入deno_bindgen
我使用IntelliJ Idea与Rust插件和货物检查打开,但它没有显示错误,甚至rustc只是坚持它没有显示任何错误。

相关问题