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

Error building the client. Could not compile ntapi #52

Open
aggnostos opened this issue Feb 16, 2023 · 11 comments
Open

Error building the client. Could not compile ntapi #52

aggnostos opened this issue Feb 16, 2023 · 11 comments
Labels

Comments

@aggnostos
Copy link

An error occurred while building the client. Although server was built successfully.

error[E0793]: reference to packed field is unaligned
--> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.6\src\ntexapi.rs:2785:52
|
2785 |         *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\user\.cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.6\src\ntexapi.rs:2809:25
|
2809 |         ((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` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
[-] Client couldn't be copied: [Errno 2] No such file or directory: 'templates/chromepass-build/target/release/chromepass.exe'
[-] Error building the client
@aggnostos aggnostos added the bug label Feb 16, 2023
@aggnostos aggnostos changed the title Error building the client. could not compile `ntapi Error building the client. could not compile ntapi Feb 16, 2023
@aggnostos aggnostos changed the title Error building the client. could not compile ntapi Error building the client. could not compile ntapi Feb 16, 2023
@aggnostos aggnostos changed the title Error building the client. could not compile ntapi Error building the client. Could not compile ntapi Feb 16, 2023
@QYH2MMT4EVER
Copy link

Have you solved this problem? I am stuck in the same problem! Could you plz give me some help to fix up this problem?

@QYH2MMT4EVER
Copy link

@LiAn39

@darkarp
Copy link
Owner

darkarp commented Mar 15, 2023

I will look into this issue

@aggnostos
Copy link
Author

@QYH2MMT4EVER No

@SHarksGANG
Copy link

### Hi ! How to fix it ?

Compiling solana-frozen-abi-macro v1.14.12
error[E0793]: reference to packed field is unaligned
--> C:\Users\Arcturus.cargo\registry\src\github.com-1ecc6299db9ec823\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\Arcturus.cargo\registry\src\github.com-1ecc6299db9ec823\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)

Compiling miow v0.3.7
For more information about this error, try rustc --explain E0793.
error: could not compile ntapi due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile spl-token-cli v2.4.0, intermediate artifacts can be found at C:\Users\Arcturus\AppData\Local\Temp\cargo-installNHDEtX

C:\Windows\System32>cargo -V
cargo 1.69.0 (6e9a83356 2023-04-12)

C:\Windows\System32>

@yuezhao238
Copy link

ntapi v0.4.1 code may help :) https://github.com/MSxDOS/ntapi/blob/master/src/ntexapi.rs

@SHarksGANG
Copy link

Код NTAPI v0.4.1 может помочь :) https://github.com/MSxDOS/ntapi/blob/master/src/ntexapi.rs

Thank you very much! I'll test it

@guanaug
Copy link

guanaug commented Sep 8, 2023

I solved it by the following step:

cd templates/chromepass-build/ && cargo update

@codingpeace
Copy link

@guanaug Thank you, it's work.

@darkarp
Copy link
Owner

darkarp commented Oct 5, 2023

Thanks for the report. Working on a reboot for this to update the structure and all the dependencies. It will all get fixed in the next version with more optional AV/EDR evasion too.

@noe8xc
Copy link

noe8xc commented Nov 28, 2023

Hi, I have the same error, I have done the update
cd templates/chromepass-build/ && cargo update
but I still have the same error, in my case compiling ntapi v0.3.7

[+] Building Client
Compiling chromepass v4.1.5 (C:\Temp\chromepass\templates\chromepass-build)
Compiling ntapi v0.3.7
error[E0793]: reference to packed field is unaligned
--> C:\Users\a.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: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
= note: 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\a.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: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
= note: 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
[-] Client couldn't be copied: [Errno 2] No such file or directory: 'templates/chromepass-build/target/release/chromepass.exe'
[-] Error building the client

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

No branches or pull requests

8 participants