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

Windows Error installation #269

Closed
directormac opened this issue Jun 16, 2023 · 4 comments
Closed

Windows Error installation #269

directormac opened this issue Jun 16, 2023 · 4 comments

Comments

@directormac
Copy link

current stable rust version
it would be best if we had a scoop package like other tools made in rust!

error[E0793]: reference to packed field is unaligned --> C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.7\src\ntexapi.rs:2783:52 | 2783 | *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use read_unaligned/write_unaligned(loads and stores via*p` must be properly aligned even when using raw pointers)

error[E0793]: reference to packed field is unaligned
--> C:\Users\Administrator.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.7\src\ntexapi.rs:2807:25
|
2807 | ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use read_unaligned/write_unaligned (loads and stores via *p must be properly aligned even when using raw pointers)

For more information about this error, try rustc --explain E0793.
error: could not compile ntapi (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile bandwhich v0.20.0, intermediate artifacts can be found at `C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installE7HHMG``

@maxim-devpronet
Copy link

As a workaround, here is what you can do:

  1. clone the repo

  2. in the root of the repo, create a file named "rust-toolchain" with such content:
    "
    [toolchain]
    channel = "1.68"
    "
    That will use the toolchain that allows the unaligned data.

  3. In the build.rs change the link to the pcap sdk file to (line 19):
    https://npcap.com/dist/npcap-sdk-1.05.zip

Because now it downloads HTTP redirect page now, the link has to be updated.

  1. Run "cargo build" and you find the bin in the target/debug/ folder.

@cyqsimon
Copy link
Collaborator

Fixed in #273. See also #275.

@sohang3112
Copy link

Fixed in #273. See also #275.

@cyqsimon I'm still having this issue while doing cargo install bandwhich in Windows 11. I'm using latest Rust version rustc 1.74.0-nightly.

@cyqsimon
Copy link
Collaborator

Fixed in #273. See also #275.

@cyqsimon I'm still having this issue while doing cargo install bandwhich in Windows 11. I'm using latest Rust version rustc 1.74.0-nightly.

cargo install pulls the latest release from crates.io, which hasn't yet been updated.

I'm in the middle of updating the CD pipeline to automate everything, after which a new release will be published. Meanwhile you can try compiling main branch.

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

4 participants