1

I am having problems with adding the dependency to bonsaidb. I'm getting following error when compiling, from ntapi specifically:

error[E0793]: reference to packed field is unaligned
    --> C:\Users\makes\.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\makes\.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)

These are the dependencies I use:

[dependencies]
bonsaidb = { version = "0.4.1", features = ["local"] }
rand = "0.8.5"
reqwest = "0.11.18"
serde = "1.0.171"
serde_json = "1.0.102"
tokio = { version = "1.29.1", features = ["full"] }

I'm on cargo 1.69.0.

I'll post the full 'cargo tree', but 'ntapi v0.3.7' is referenced from 'bonsaidb-local v0.4.1'

miste_r_x v0.1.0 (C:\Github\miste_r_x\miste_r_x)
├── bonsaidb v0.4.1
│   ├── bonsaidb-core v0.4.1
│   │   ├── actionable v0.2.0
│   │   │   ├── actionable-macros v0.2.0 (proc-macro)
│   │   │   │   ├── darling v0.13.4
│   │   │   │   │   ├── darling_core v0.13.4
│   │   │   │   │   │   ├── fnv v1.0.7
│   │   │   │   │   │   ├── ident_case v1.0.1
│   │   │   │   │   │   ├── proc-macro2 v1.0.64
│   │   │   │   │   │   │   └── unicode-ident v1.0.10
│   │   │   │   │   │   ├── quote v1.0.29
│   │   │   │   │   │   │   └── proc-macro2 v1.0.64 (*)
│   │   │   │   │   │   ├── strsim v0.10.0
│   │   │   │   │   │   └── syn v1.0.109
│   │   │   │   │   │       ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   │       ├── quote v1.0.29 (*)
│   │   │   │   │   │       └── unicode-ident v1.0.10
│   │   │   │   │   └── darling_macro v0.13.4 (proc-macro)
│   │   │   │   │       ├── darling_core v0.13.4 (*)
│   │   │   │   │       ├── quote v1.0.29 (*)
│   │   │   │   │       └── syn v1.0.109 (*)
│   │   │   │   ├── ident_case v1.0.1
│   │   │   │   ├── proc-macro-error v1.0.4
│   │   │   │   │   ├── proc-macro-error-attr v1.0.4 (proc-macro)
│   │   │   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   │   └── quote v1.0.29 (*)
│   │   │   │   │   │   [build-dependencies]
│   │   │   │   │   │   └── version_check v0.9.4
│   │   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   │   └── syn v1.0.109 (*)
│   │   │   │   │   [build-dependencies]
│   │   │   │   │   └── version_check v0.9.4
│   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   ├── syn v1.0.109 (*)
│   │   │   │   └── thiserror v1.0.43
│   │   │   │       └── thiserror-impl v1.0.43 (proc-macro)
│   │   │   │           ├── proc-macro2 v1.0.64 (*)
│   │   │   │           ├── quote v1.0.29 (*)
│   │   │   │           └── syn v2.0.25
│   │   │   │               ├── proc-macro2 v1.0.64 (*)
│   │   │   │               ├── quote v1.0.29 (*)
│   │   │   │               └── unicode-ident v1.0.10
│   │   │   ├── async-trait v0.1.71 (proc-macro)
│   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   └── syn v2.0.25 (*)
│   │   │   ├── serde v1.0.171
│   │   │   │   └── serde_derive v1.0.171 (proc-macro)
│   │   │   │       ├── proc-macro2 v1.0.64 (*)
│   │   │   │       ├── quote v1.0.29 (*)
│   │   │   │       └── syn v2.0.25 (*)
│   │   │   └── thiserror v1.0.43 (*)
│   │   ├── arc-bytes v0.3.5
│   │   │   ├── serde v1.0.171 (*)
│   │   │   └── thiserror v1.0.43 (*)
│   │   ├── async-trait v0.1.71 (proc-macro) (*)
│   │   ├── bonsaidb-macros v0.4.1 (proc-macro)
│   │   │   ├── attribute-derive v0.2.2
│   │   │   │   ├── attribute-derive-macro v0.2.0 (proc-macro)
│   │   │   │   │   ├── proc-macro-error v1.0.4 (*)
│   │   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   │   └── syn v1.0.109 (*)
│   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   └── syn v1.0.109 (*)
│   │   │   ├── proc-macro-crate v1.3.1
│   │   │   │   ├── once_cell v1.18.0
│   │   │   │   └── toml_edit v0.19.12
│   │   │   │       ├── indexmap v2.0.0
│   │   │   │       │   ├── equivalent v1.0.1
│   │   │   │       │   └── hashbrown v0.14.0
│   │   │   │       ├── toml_datetime v0.6.3
│   │   │   │       └── winnow v0.4.9
│   │   │   ├── proc-macro-error v1.0.4 (*)
│   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   ├── quote v1.0.29 (*)
│   │   │   ├── syn v1.0.109 (*)
│   │   │   └── trybuild v1.0.81
│   │   │       ├── basic-toml v0.1.3
│   │   │       │   └── serde v1.0.171
│   │   │       ├── glob v0.3.1
│   │   │       ├── once_cell v1.18.0
│   │   │       ├── serde v1.0.171
│   │   │       ├── serde_derive v1.0.171 (proc-macro) (*)
│   │   │       ├── serde_json v1.0.102
│   │   │       │   ├── itoa v1.0.8
│   │   │       │   ├── ryu v1.0.14
│   │   │       │   └── serde v1.0.171
│   │   │       └── termcolor v1.2.0
│   │   │           └── winapi-util v0.1.5
│   │   │               └── winapi v0.3.9
│   │   ├── circulate v0.3.0
│   │   │   ├── arc-bytes v0.3.5 (*)
│   │   │   ├── flume v0.10.14
│   │   │   │   ├── futures-core v0.3.28
│   │   │   │   ├── futures-sink v0.3.28
│   │   │   │   ├── nanorand v0.7.0
│   │   │   │   │   └── getrandom v0.2.10
│   │   │   │   │       └── cfg-if v1.0.0
│   │   │   │   ├── pin-project v1.1.2
│   │   │   │   │   └── pin-project-internal v1.1.2 (proc-macro)
│   │   │   │   │       ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │       ├── quote v1.0.29 (*)
│   │   │   │   │       └── syn v2.0.25 (*)
│   │   │   │   └── spin v0.9.8
│   │   │   │       └── lock_api v0.4.10
│   │   │   │           └── scopeguard v1.1.0
│   │   │   │           [build-dependencies]
│   │   │   │           └── autocfg v1.1.0
│   │   │   ├── futures v0.3.28
│   │   │   │   ├── futures-channel v0.3.28
│   │   │   │   │   ├── futures-core v0.3.28
│   │   │   │   │   └── futures-sink v0.3.28
│   │   │   │   ├── futures-core v0.3.28
│   │   │   │   ├── futures-executor v0.3.28
│   │   │   │   │   ├── futures-core v0.3.28
│   │   │   │   │   ├── futures-task v0.3.28
│   │   │   │   │   └── futures-util v0.3.28
│   │   │   │   │       ├── futures-channel v0.3.28 (*)
│   │   │   │   │       ├── futures-core v0.3.28
│   │   │   │   │       ├── futures-io v0.3.28
│   │   │   │   │       ├── futures-macro v0.3.28 (proc-macro)
│   │   │   │   │       │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │       │   ├── quote v1.0.29 (*)
│   │   │   │   │       │   └── syn v2.0.25 (*)
│   │   │   │   │       ├── futures-sink v0.3.28
│   │   │   │   │       ├── futures-task v0.3.28
│   │   │   │   │       ├── memchr v2.5.0
│   │   │   │   │       ├── pin-project-lite v0.2.10
│   │   │   │   │       ├── pin-utils v0.1.0
│   │   │   │   │       └── slab v0.4.8
│   │   │   │   │           [build-dependencies]
│   │   │   │   │           └── autocfg v1.1.0
│   │   │   │   ├── futures-io v0.3.28
│   │   │   │   ├── futures-sink v0.3.28
│   │   │   │   ├── futures-task v0.3.28
│   │   │   │   └── futures-util v0.3.28 (*)
│   │   │   ├── parking_lot v0.12.1
│   │   │   │   ├── lock_api v0.4.10 (*)
│   │   │   │   └── parking_lot_core v0.9.8
│   │   │   │       ├── cfg-if v1.0.0
│   │   │   │       ├── smallvec v1.11.0
│   │   │   │       └── windows-targets v0.48.1
│   │   │   │           └── windows_x86_64_msvc v0.48.0
│   │   │   ├── pot v1.0.2
│   │   │   │   ├── byteorder v1.4.3
│   │   │   │   ├── bytes v1.4.0
│   │   │   │   ├── derive-where v1.0.0-rc.2 (proc-macro)
│   │   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   │   └── syn v1.0.109 (*)
│   │   │   │   ├── half v1.8.2
│   │   │   │   ├── serde v1.0.171 (*)
│   │   │   │   └── thiserror v1.0.43 (*)
│   │   │   └── serde v1.0.171 (*)
│   │   ├── derive-where v1.0.0-rc.2 (proc-macro) (*)
│   │   ├── futures v0.3.28 (*)
│   │   ├── itertools v0.10.5
│   │   │   └── either v1.8.1
│   │   ├── num-traits v0.2.15
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   ├── ordered-varint v1.0.1
│   │   ├── pot v1.0.2 (*)
│   │   ├── serde v1.0.171 (*)
│   │   ├── sha2 v0.10.7
│   │   │   ├── cfg-if v1.0.0
│   │   │   ├── cpufeatures v0.2.9
│   │   │   └── digest v0.10.7
│   │   │       ├── block-buffer v0.10.4
│   │   │       │   └── generic-array v0.14.7
│   │   │       │       └── typenum v1.16.0
│   │   │       │       [build-dependencies]
│   │   │       │       └── version_check v0.9.4
│   │   │       └── crypto-common v0.1.6
│   │   │           ├── generic-array v0.14.7 (*)
│   │   │           └── typenum v1.16.0
│   │   ├── thiserror v1.0.43 (*)
│   │   ├── transmog v0.1.0
│   │   ├── transmog-pot v0.1.0
│   │   │   ├── pot v1.0.2 (*)
│   │   │   ├── serde v1.0.171 (*)
│   │   │   └── transmog v0.1.0
│   │   └── zeroize v1.4.3
│   │       └── zeroize_derive v1.4.2 (proc-macro)
│   │           ├── proc-macro2 v1.0.64 (*)
│   │           ├── quote v1.0.29 (*)
│   │           └── syn v2.0.25 (*)
│   └── bonsaidb-local v0.4.1
│       ├── bincode v1.3.3
│       │   └── serde v1.0.171 (*)
│       ├── bonsaidb-core v0.4.1 (*)
│       ├── bonsaidb-utils v0.4.1
│       ├── byteorder v1.4.3
│       ├── derive-where v1.0.0-rc.2 (proc-macro) (*)
│       ├── easy-parallel v3.3.0
│       ├── flume v0.10.14 (*)
│       ├── itertools v0.10.5 (*)
│       ├── log v0.4.19
│       ├── nebari v0.5.5
│       │   ├── arc-bytes v0.3.5 (*)
│       │   ├── backtrace v0.3.68
│       │   │   ├── addr2line v0.20.0
│       │   │   │   └── gimli v0.27.3
│       │   │   ├── cfg-if v1.0.0
│       │   │   ├── libc v0.2.147
│       │   │   ├── miniz_oxide v0.7.1
│       │   │   │   └── adler v1.0.2
│       │   │   ├── object v0.31.1
│       │   │   │   └── memchr v2.5.0
│       │   │   └── rustc-demangle v0.1.23
│       │   │   [build-dependencies]
│       │   │   └── cc v1.0.79
│       │   ├── byteorder v1.4.3
│       │   ├── crc v3.0.1
│       │   │   └── crc-catalog v2.2.0
│       │   ├── flume v0.10.14 (*)
│       │   ├── lru v0.7.8
│       │   │   └── hashbrown v0.12.3
│       │   │       └── ahash v0.7.6
│       │   │           ├── getrandom v0.2.10 (*)
│       │   │           └── once_cell v1.18.0
│       │   │           [build-dependencies]
│       │   │           └── version_check v0.9.4
│       │   ├── num_cpus v1.16.0
│       │   ├── once_cell v1.18.0
│       │   ├── parking_lot v0.12.1 (*)
│       │   └── thiserror v1.0.43 (*)
│       ├── p256 v0.9.0
│       │   ├── ecdsa v0.12.4
│       │   │   ├── der v0.4.5
│       │   │   │   └── const-oid v0.6.2
│       │   │   ├── elliptic-curve v0.10.6
│       │   │   │   ├── crypto-bigint v0.2.11
│       │   │   │   │   ├── generic-array v0.14.7 (*)
│       │   │   │   │   ├── rand_core v0.6.4
│       │   │   │   │   │   └── getrandom v0.2.10 (*)
│       │   │   │   │   ├── subtle v2.4.1
│       │   │   │   │   └── zeroize v1.4.3 (*)
│       │   │   │   ├── ff v0.10.1
│       │   │   │   │   ├── rand_core v0.6.4 (*)
│       │   │   │   │   └── subtle v2.4.1
│       │   │   │   ├── generic-array v0.14.7 (*)
│       │   │   │   ├── group v0.10.0
│       │   │   │   │   ├── ff v0.10.1 (*)
│       │   │   │   │   ├── rand_core v0.6.4 (*)
│       │   │   │   │   └── subtle v2.4.1
│       │   │   │   ├── pkcs8 v0.7.6
│       │   │   │   │   ├── der v0.4.5 (*)
│       │   │   │   │   └── spki v0.4.1
│       │   │   │   │       └── der v0.4.5 (*)
│       │   │   │   ├── rand_core v0.6.4 (*)
│       │   │   │   ├── subtle v2.4.1
│       │   │   │   └── zeroize v1.4.3 (*)
│       │   │   ├── hmac v0.11.0
│       │   │   │   ├── crypto-mac v0.11.1
│       │   │   │   │   ├── generic-array v0.14.7 (*)
│       │   │   │   │   └── subtle v2.4.1
│       │   │   │   └── digest v0.9.0
│       │   │   │       └── generic-array v0.14.7 (*)
│       │   │   └── signature v1.3.2
│       │   │       ├── digest v0.9.0 (*)
│       │   │       └── rand_core v0.6.4 (*)
│       │   ├── elliptic-curve v0.10.6 (*)
│       │   └── sha2 v0.9.9
│       │       ├── block-buffer v0.9.0
│       │       │   └── generic-array v0.14.7 (*)
│       │       ├── cfg-if v1.0.0
│       │       ├── cpufeatures v0.2.9
│       │       ├── digest v0.9.0 (*)
│       │       └── opaque-debug v0.3.0
│       ├── parking_lot v0.12.1 (*)
│       ├── pot v1.0.2 (*)
│       ├── rand v0.8.5
│       │   ├── rand_chacha v0.3.1
│       │   │   ├── ppv-lite86 v0.2.17
│       │   │   └── rand_core v0.6.4 (*)
│       │   └── rand_core v0.6.4 (*)
│       ├── serde v1.0.171 (*)
│       ├── sysinfo v0.23.13
│       │   ├── cfg-if v1.0.0
│       │   ├── libc v0.2.147
│       │   ├── ntapi v0.3.7
│       │   │   └── winapi v0.3.9
│       │   ├── once_cell v1.18.0
│       │   └── winapi v0.3.9
│       ├── thiserror v1.0.43 (*)
│       ├── transmog-versions v0.1.1
│       │   ├── ordered-varint v2.0.0
│       │   ├── thiserror v1.0.43 (*)
│       │   └── transmog v0.1.0
│       └── watchable v0.1.0
│           ├── event-listener v2.5.3
│           ├── futures-util v0.3.28 (*)
│           ├── parking_lot v0.12.1 (*)
│           └── thiserror v1.0.43 (*)
├── rand v0.8.5 (*)
├── reqwest v0.11.18
│   ├── base64 v0.21.2
│   ├── bytes v1.4.0
│   ├── encoding_rs v0.8.32
│   │   └── cfg-if v1.0.0
│   ├── futures-core v0.3.28
│   ├── futures-util v0.3.28 (*)
│   ├── h2 v0.3.20
│   │   ├── bytes v1.4.0
│   │   ├── fnv v1.0.7
│   │   ├── futures-core v0.3.28
│   │   ├── futures-sink v0.3.28
│   │   ├── futures-util v0.3.28 (*)
│   │   ├── http v0.2.9
│   │   │   ├── bytes v1.4.0
│   │   │   ├── fnv v1.0.7
│   │   │   └── itoa v1.0.8
│   │   ├── indexmap v1.9.3
│   │   │   └── hashbrown v0.12.3 (*)
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   ├── slab v0.4.8 (*)
│   │   ├── tokio v1.29.1
│   │   │   ├── bytes v1.4.0
│   │   │   ├── mio v0.8.8
│   │   │   │   └── windows-sys v0.48.0
│   │   │   │       └── windows-targets v0.48.1 (*)
│   │   │   ├── num_cpus v1.16.0
│   │   │   ├── parking_lot v0.12.1 (*)
│   │   │   ├── pin-project-lite v0.2.10
│   │   │   ├── socket2 v0.4.9
│   │   │   │   └── winapi v0.3.9
│   │   │   ├── tokio-macros v2.1.0 (proc-macro)
│   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   └── syn v2.0.25 (*)
│   │   │   └── windows-sys v0.48.0 (*)
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   ├── tokio-util v0.7.8
│   │   │   ├── bytes v1.4.0
│   │   │   ├── futures-core v0.3.28
│   │   │   ├── futures-sink v0.3.28
│   │   │   ├── pin-project-lite v0.2.10
│   │   │   ├── tokio v1.29.1 (*)
│   │   │   └── tracing v0.1.37
│   │   │       ├── cfg-if v1.0.0
│   │   │       ├── pin-project-lite v0.2.10
│   │   │       └── tracing-core v0.1.31
│   │   │           └── once_cell v1.18.0
│   │   └── tracing v0.1.37 (*)
│   ├── http v0.2.9 (*)
│   ├── http-body v0.4.5
│   │   ├── bytes v1.4.0
│   │   ├── http v0.2.9 (*)
│   │   └── pin-project-lite v0.2.10
│   ├── hyper v0.14.27
│   │   ├── bytes v1.4.0
│   │   ├── futures-channel v0.3.28 (*)
│   │   ├── futures-core v0.3.28
│   │   ├── futures-util v0.3.28 (*)
│   │   ├── h2 v0.3.20 (*)
│   │   ├── http v0.2.9 (*)
│   │   ├── http-body v0.4.5 (*)
│   │   ├── httparse v1.8.0
│   │   ├── httpdate v1.0.2
│   │   ├── itoa v1.0.8
│   │   ├── pin-project-lite v0.2.10
│   │   ├── socket2 v0.4.9 (*)
│   │   ├── tokio v1.29.1 (*)
│   │   ├── tower-service v0.3.2
│   │   ├── tracing v0.1.37 (*)
│   │   └── want v0.3.1
│   │       └── try-lock v0.2.4
│   ├── hyper-tls v0.5.0
│   │   ├── bytes v1.4.0
│   │   ├── hyper v0.14.27 (*)
│   │   ├── native-tls v0.2.11
│   │   │   └── schannel v0.1.22
│   │   │       └── windows-sys v0.48.0 (*)
│   │   ├── tokio v1.29.1 (*)
│   │   └── tokio-native-tls v0.3.1
│   │       ├── native-tls v0.2.11 (*)
│   │       └── tokio v1.29.1 (*)
│   ├── ipnet v2.8.0
│   ├── log v0.4.19
│   ├── mime v0.3.17
│   ├── native-tls v0.2.11 (*)
│   ├── once_cell v1.18.0
│   ├── percent-encoding v2.3.0
│   ├── pin-project-lite v0.2.10
│   ├── serde v1.0.171 (*)
│   ├── serde_urlencoded v0.7.1
│   │   ├── form_urlencoded v1.2.0
│   │   │   └── percent-encoding v2.3.0
│   │   ├── itoa v1.0.8
│   │   ├── ryu v1.0.14
│   │   └── serde v1.0.171 (*)
│   ├── tokio v1.29.1 (*)
│   ├── tokio-native-tls v0.3.1 (*)
│   ├── tower-service v0.3.2
│   ├── url v2.4.0
│   │   ├── form_urlencoded v1.2.0 (*)
│   │   ├── idna v0.4.0
│   │   │   ├── unicode-bidi v0.3.13
│   │   │   └── unicode-normalization v0.1.22
│   │   │       └── tinyvec v1.6.0
│   │   │           └── tinyvec_macros v0.1.1
│   │   └── percent-encoding v2.3.0
│   └── winreg v0.10.1
│       └── winapi v0.3.9
├── serde v1.0.171 (*)
├── serde_json v1.0.102 (*)
└── tokio v1.29.1 (*)

I am aware that another user has run into a similar problem here, where compiling raises the same error within ntapi, caused by the tokio dependency, not by bonsai db as is the case for me. But I have tried what the comments say there, I.E. update all dependencies to their newest versions, but that didn't seem to work for me.

make2002
  • 11
  • 1
  • The problem is that `bonsaidb-local` uses an old version of `sysinfo` that uses an old version of `ntapi`, and upgrading one of those breaks SemVer. I think your best bet is to patch `bonsaidb-local` to use the latest `sysinfo` (and send a PR). – Chayim Friedman Jul 12 '23 at 18:08

0 Answers0