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

Issue with fresh "cargo make" #12

Open
secana opened this issue Mar 20, 2024 · 2 comments
Open

Issue with fresh "cargo make" #12

secana opened this issue Mar 20, 2024 · 2 comments

Comments

@secana
Copy link

secana commented Mar 20, 2024

Hi!

I've tried to compile the example code on Windows 11 ARM, but it fails with the following error message:

As user:

**********************************************************************
** Enterprise Windows Driver Kit (WDK) build environment
** Version ni_release_svc_prod1.22621.2428
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.1.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
C:\Users\x\repos\Windows-rust-driver-samples>cargo make
[cargo-make] INFO - cargo make 0.37.10
[cargo-make] INFO - Execute Command: "rust-script" "target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Running Task: workspace
C:\Users\x\repos\Windows-rust-driver-samples
[cargo-make][1] INFO - Execute Command: "rust-script" "C:\\Users\\x\\repos\\Windows-rust-driver-samples\\target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make][1] INFO - Calling cargo metadata to extract project info
[cargo-make][1] INFO - Cargo metadata done
[cargo-make][1] INFO - Project: echoapp
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Skipping Task: legacy-migration
[cargo-make][1] INFO - Running Task: build
[cargo-make][1] INFO - Execute Command: "cargo" "build"
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
echoapp does not contain a package.metadata.wdk section in its manifest. Skipping package-driver task.
[cargo-make][1] INFO - Skipping Task: package-driver-flow
[cargo-make][1] INFO - Running Task: default
[cargo-make][1] INFO - Build Done in 1.14 seconds.
[cargo-make][1] INFO - Execute Command: "rust-script" "C:\\Users\\x\\repos\\Windows-rust-driver-samples\\target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make][1] INFO - Calling cargo metadata to extract project info
[cargo-make][1] INFO - Cargo metadata done
[cargo-make][1] INFO - Project: echo-2
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Skipping Task: legacy-migration
[cargo-make][1] INFO - Running Task: build
[cargo-make][1] INFO - Execute Command: "cargo" "build"
   Compiling wdk-sys v0.2.0
memory allocation of 26306674688 bytes failed132: wdk-sys(build)
[cargo-make][1] ERROR - Error while executing command, exit code: -1073740791
[cargo-make][1] WARN - Build Failed.
[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 8 - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

I guessed that A required privilege is not held by the client. may mean that administrator rights are needed, to I re-ran it in an admin prompt.

As admin user:

**********************************************************************
** Enterprise Windows Driver Kit (WDK) build environment
** Version ni_release_svc_prod1.22621.2428
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.1.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

C:\Users\x\repos\Windows-rust-driver-samples>cargo make
[cargo-make] INFO - cargo make 0.37.10
[cargo-make] INFO - Execute Command: "rust-script" "target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Running Task: workspace
C:\Users\x\repos\Windows-rust-driver-samples
[cargo-make][1] INFO - Execute Command: "rust-script" "C:\\Users\\x\\repos\\Windows-rust-driver-samples\\target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make][1] INFO - Calling cargo metadata to extract project info
[cargo-make][1] INFO - Cargo metadata done
[cargo-make][1] INFO - Project: echoapp
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Skipping Task: legacy-migration
[cargo-make][1] INFO - Running Task: build
[cargo-make][1] INFO - Execute Command: "cargo" "build"
   Compiling proc-macro2 v1.0.78
   Compiling unicode-ident v1.0.12
   Compiling windows_aarch64_msvc v0.52.0
   Compiling once_cell v1.19.0
   Compiling windows-targets v0.52.0
   Compiling windows-sys v0.52.0
   Compiling quote v1.0.35
   Compiling syn v2.0.48
   Compiling uuid-macro-internal v1.7.0
   Compiling uuid v1.7.0
   Compiling echoapp v0.1.0 (C:\Users\x\repos\Windows-rust-driver-samples\general\echo\kmdf\exe)
    Finished dev [unoptimized + debuginfo] target(s) in 5.53s
echoapp does not contain a package.metadata.wdk section in its manifest. Skipping package-driver task.
[cargo-make][1] INFO - Skipping Task: package-driver-flow
[cargo-make][1] INFO - Running Task: default
[cargo-make][1] INFO - Build Done in 6.56 seconds.
[cargo-make][1] INFO - Execute Command: "rust-script" "C:\\Users\\x\\repos\\Windows-rust-driver-samples\\target\\_cargo_make_temp\\persisted_scripts\\D4060E7434B3779E78A683E8BA00D06A5D08BE8C95BC432359E22F06CB30EF1C.rs"
[cargo-make][1] INFO - Calling cargo metadata to extract project info
[cargo-make][1] INFO - Cargo metadata done
[cargo-make][1] INFO - Project: echo-2
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Skipping Task: legacy-migration
[cargo-make][1] INFO - Running Task: build
[cargo-make][1] INFO - Execute Command: "cargo" "build"
   Compiling proc-macro2 v1.0.78
   Compiling windows_aarch64_msvc v0.48.5
   Compiling windows_aarch64_msvc v0.52.0
   Compiling once_cell v1.19.0
   Compiling windows-targets v0.52.0
   Compiling windows-sys v0.52.0
   Compiling serde v1.0.196
   Compiling anstyle v1.0.6
...
   Compiling wdk-panic v0.2.0
   Compiling wdk v0.2.0
   Compiling echo-2 v0.1.0 (C:\Users\x\repos\Windows-rust-driver-samples\general\echo\kmdf\driver\DriverSync)
   Compiling wdk-sys v0.2.0
memory allocation of 26306674688 bytes failed132: wdk-sys(build)
[cargo-make][1] ERROR - Error while executing command, exit code: -1073740791
[cargo-make][1] WARN - Build Failed.
[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 8 - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Any ideas what went wrong?

@wmmc88
Copy link
Collaborator

wmmc88 commented Mar 20, 2024

To eliminate any possibility of the issue being in one of the cargo-make scripts, could you please just run cargo build and see if you still encounter this error.

Compiling wdk-sys v0.2.0 memory allocation of 26306674688 bytes failed132: wdk-sys(build)

This seems to indicate that the build-script for wdk-sys failed to execute because it failed to allocate some block of memory. Are you running on a system with small amount of free RAM? although 26GB allocation seems like quite a bit...

@secana
Copy link
Author

secana commented Mar 22, 2024

Hi,

I ran jut cargo build with the following result:

C:\Users\x\repos\Windows-rust-driver-samples>cargo build
   Compiling proc-macro2 v1.0.78
   Compiling unicode-ident v1.0.12
   Compiling windows_aarch64_msvc v0.52.0
   Compiling windows_aarch64_msvc v0.48.5
   Compiling serde v1.0.196
...
   Compiling smallvec v1.13.1
   Compiling spin v0.5.2
   Compiling wdk-macros v0.2.0
   Compiling tracing-subscriber v0.3.18
   Compiling paste v1.0.14
   Compiling uuid-macro-internal v1.7.0
   Compiling uuid v1.7.0
   Compiling wdk v0.2.0
   Compiling echo-2 v0.1.0 (C:\Users\x\repos\Windows-rust-driver-samples\general\echo\kmdf\driver\DriverSync)
   Compiling wdk-sys v0.2.0
   Compiling wdk-panic v0.2.0
   Compiling echoapp v0.1.0 (C:\Users\x\repos\Windows-rust-driver-samples\general\echo\kmdf\exe)
error: failed to run custom build command for `wdk-sys v0.2.0`

Caused by:
  process didn't exit successfully: `C:\Users\x\repos\Windows-rust-driver-samples\target\debug\build\wdk-sys-4349d9c8a3407fd1\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64-pc-windows-msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_aarch64_pc_windows_msvc
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=src/ntddk-input.h
  cargo:rerun-if-changed=src/wdf-input.h

  --- stderr
  C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:318:33: warning: cast to smaller integer type 'unsigned long' from 'const void * __ptr32' [-Wvoid-pointer-to-int-cast]
  C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:327:32: warning: cast to smaller integer type 'long' from 'const void * __ptr32' [-Wvoid-pointer-to-int-cast]
  C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:336:12: warning: cast to 'void * __ptr32' from smaller integer type 'unsigned long' [-Wint-to-void-pointer-cast]
  C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\km\crt\intrin.h:411:33: error: conflicting types for '__prefetch'
  C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\km\crt\intrin.h:411:33: note: '__prefetch' is a builtin with type 'void (void *)'
  C:\ewdk\Program Files\Windows Kits\10\Include\wdf\kmdf\1.33\wdfdevice.h:1414:13: warning: enumeration value 'IdleCapsInvalid' not handled in switch [-Wswitch]
  clang diag: C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:318:33: warning: cast to smaller integer type 'unsigned long' from 'const void * __ptr32' [-Wvoid-pointer-to-int-cast]
  clang diag: C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:327:32: warning: cast to smaller integer type 'long' from 'const void * __ptr32' [-Wvoid-pointer-to-int-cast]
  clang diag: C:\ewdk\Program Files\Windows Kits\10\Include\10.0.22621.0\shared\basetsd.h:336:12: warning: cast to 'void * __ptr32' from smaller integer type 'unsigned long' [-Wint-to-void-pointer-cast]
  clang diag: C:\ewdk\Program Files\Windows Kits\10\Include\wdf\kmdf\1.33\wdfdevice.h:1414:13: warning: enumeration value 'IdleCapsInvalid' not handled in switch [-Wswitch]
  thread 'main' panicked at C:\Users\x\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wdk-sys-0.2.0\build.rs:27:14:
  Bindings should succeed to generate: ClangDiagnostic("C:\\ewdk\\Program Files\\Windows Kits\\10\\Include\\10.0.22621.0\\km\\crt\\intrin.h:411:33: error: conflicting types for '__prefetch'\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

A bit more information about the system I use:

  • Parallels VM on a Macbook Pro M2 (aarch64)
  • Windows 11 Pro Version 10.0.22631 Build 22631
  • 4 Cores, 8 GB RAM

Is it possible that there is an out-of-memory due to RAM and VRAM exhausted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants