DarkRTA/chronos

Do not hardcode size of included files.

Closed this issue · 3 comments

I’m completely new to Rust so pardon me if this is an error on my end.

Anyway, when I run cargo build --release, I get this output:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS E:\configs-programs\chronos\chronos> cargo build --release
    Updating crates.io index
  Downloaded autocfg v1.1.0
  Downloaded toml v0.5.9
  Downloaded ident_case v1.0.1
  Downloaded cfg-if v1.0.0
  Downloaded cursive_buffered_backend v0.6.1
  Downloaded byteorder v1.4.3
  Downloaded target-lexicon v0.12.5
  Downloaded doc-comment v0.3.3
  Downloaded version_check v0.9.4
  Downloaded jpeg-decoder v0.3.0
  Downloaded time-core v0.1.0
  Downloaded maplit v1.0.2
  Downloaded heck v0.4.0
  Downloaded rand_core v0.6.4
  Downloaded darling v0.14.2
  Downloaded unicode-script v0.5.5
  Downloaded log v0.4.17
  Downloaded serde_derive v1.0.150
  Downloaded serde v1.0.150
  Downloaded libm v0.2.6
  Downloaded rayon v1.6.0
  Downloaded image v0.24.5
  Downloaded cranelift-native v0.89.2
  Downloaded cranelift-isle v0.89.2
  Downloaded cranelift-entity v0.89.2
  Downloaded cranelift-frontend v0.89.2
  Downloaded cranelift-bforest v0.89.2
  Downloaded wasmtime-jit v2.0.2
  Downloaded gimli v0.26.2
  Downloaded cranelift-codegen-shared v0.89.2
  Downloaded enum-map v2.4.1
  Downloaded winapi v0.3.9
  Downloaded regalloc2 v0.4.2
  Downloaded sysinfo v0.26.8
  Downloaded tiny-skia v0.8.2
  Downloaded tiff v0.8.0
  Downloaded snafu v0.7.3
  Downloaded cursive_core v0.3.6
  Downloaded cranelift-wasm v0.89.2
  Downloaded cranelift-codegen v0.89.2
  Downloaded wasmtime v2.0.2
  Downloaded proc-maps v0.3.0
  Downloaded snafu-derive v0.7.3
  Downloaded png v0.17.7
  Downloaded enumset_derive v0.6.1
  Downloaded wasmtime-asm-macros v2.0.2
  Downloaded cranelift-codegen-meta v0.89.2
  Downloaded cursive v0.20.0
  Downloaded wasmtime-runtime v2.0.2
  Downloaded wasmtime-environ v2.0.2
  Downloaded wasmtime-cranelift v2.0.2
  Downloaded wasmparser v0.92.0
  Downloaded tokio v1.23.0
  Downloaded strict-num v0.1.0
  Downloaded tiny-skia-path v0.8.2
  Downloaded wasmtime-types v2.0.2
  Downloaded wasmtime-jit-debug v2.0.2
  Downloaded ntapi v0.4.0
  Downloaded read-process-memory v0.1.5
  Downloaded enum-map-derive v0.10.0
  Downloaded hashbrown v0.13.1
  Downloaded crossterm v0.25.0
  Downloaded weezl v0.1.7
  Downloaded slotmap v1.0.6
  Downloaded unicode-general-category v0.6.0
  Downloaded rustc-demangle v0.1.21
  Downloaded anyhow v1.0.66
  Downloaded num-traits v0.2.15
  Downloaded addr2line v0.17.0
  Downloaded rand_chacha v0.3.1
  Downloaded bytemuck_derive v1.3.0
  Downloaded enumset v1.0.12
  Downloaded simd-abstraction v0.7.1
  Downloaded clap_derive v4.0.21
  Downloaded scopeguard v1.1.0
  Downloaded clap_lex v0.3.0
  Downloaded itoa v1.0.4
  Downloaded cc v1.0.77
  Downloaded outref v0.1.0
  Downloaded windows-sys v0.42.0
  Downloaded windows-sys v0.36.1
  Downloaded winapi-util v0.1.5
  Downloaded windows_x86_64_msvc v0.42.0
  Downloaded windows_x86_64_msvc v0.36.1
  Downloaded thiserror v1.0.37
  Downloaded proc-macro-error-attr v1.0.4
  Downloaded crossbeam-utils v0.8.14
  Downloaded libc v0.2.138
  Downloaded serde_json v1.0.89
  Downloaded rustybuzz v0.6.0
  Downloaded itertools v0.10.5
  Downloaded clap v4.0.29
  Downloaded object v0.29.0
  Downloaded ttf-parser v0.17.1
  Downloaded time v0.3.17
  Downloaded stable_deref_trait v1.2.0
  Downloaded bumpalo v3.11.1
  Downloaded owning_ref v0.4.1
  Downloaded smallvec v1.10.0
  Downloaded slice-group-by v0.3.0
  Downloaded simdutf8 v0.1.4
  Downloaded crc32fast v1.3.2
  Downloaded ryu v1.0.11
  Downloaded rayon-core v1.10.1
  Downloaded flate2 v1.0.25
  Downloaded miniz_oxide v0.6.2
  Downloaded rand v0.8.5
  Downloaded cpp_demangle v0.3.5
  Downloaded hashbrown v0.12.3
  Downloaded bytemuck v1.12.3
  Downloaded memchr v2.5.0
  Downloaded crossbeam-channel v0.5.6
  Downloaded parking_lot v0.12.1
  Downloaded proc-macro2 v1.0.47
  Downloaded darling_core v0.14.2
  Downloaded xi-unicode v0.3.0
  Downloaded unicode-segmentation v1.10.0
  Downloaded unicode-bidi-mirroring v0.1.0
  Downloaded termcolor v1.1.3
  Downloaded bincode v1.3.3
  Downloaded crossbeam-epoch v0.9.13
  Downloaded psm v0.1.21
  Downloaded scoped_threadpool v0.1.9
  Downloaded ppv-lite86 v0.2.17
  Downloaded quote v1.0.21
  Downloaded unicode-ccc v0.1.2
  Downloaded arrayref v0.3.6
  Downloaded ahash v0.8.2
  Downloaded time-macros v0.2.6
  Downloaded paste v1.0.9
  Downloaded strsim v0.10.0
  Downloaded parking_lot_core v0.9.5
  Downloaded os_str_bytes v6.4.1
  Downloaded once_cell v1.16.0
  Downloaded getrandom v0.2.8
  Downloaded crossterm_winapi v0.9.0
  Downloaded base64-simd v0.7.0
  Downloaded num-integer v0.1.45
  Downloaded num v0.4.0
  Downloaded adler v1.0.2
  Downloaded num-iter v0.1.43
  Downloaded memoffset v0.6.5
  Downloaded io-lifetimes v1.0.3
  Downloaded bitflags v1.3.2
  Downloaded num-complex v0.4.2
  Downloaded arrayvec v0.7.2
  Downloaded proc-macro-error v1.0.4
  Downloaded num_cpus v1.14.0
  Downloaded memoffset v0.7.1
  Downloaded pin-project-lite v0.2.9
  Downloaded num-rational v0.4.1
  Downloaded indexmap v1.9.2
  Downloaded ahash v0.7.6
  Downloaded crossbeam-deque v0.8.2
  Downloaded unicode-width v0.1.10
  Downloaded unicode-ident v1.0.5
  Downloaded syn v1.0.105
  Downloaded darling_macro v0.14.2
  Downloaded is-terminal v0.4.1
  Downloaded color_quant v1.1.0
  Downloaded fallible-iterator v0.2.0
  Downloaded either v1.8.0
  Downloaded fxhash v0.2.1
  Downloaded fnv v1.0.7
  Downloaded lazy_static v1.4.0
  Downloaded lock_api v0.4.9
  Downloaded unicase v2.6.0
  Downloaded thiserror-impl v1.0.37
  Downloaded smallstr v0.3.0
  Downloaded term_size v0.3.2
  Downloaded 170 crates (21.5 MB) in 15.24s (largest was `windows-sys` at 3.3 MB)
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.105
   Compiling version_check v0.9.4
   Compiling serde_derive v1.0.150
   Compiling serde v1.0.150
   Compiling getrandom v0.2.8
   Compiling once_cell v1.16.0
   Compiling indexmap v1.9.2
   Compiling ahash v0.7.6
   Compiling log v0.4.17
   Compiling stable_deref_trait v1.2.0
   Compiling winapi v0.3.9
   Compiling smallvec v1.10.0
   Compiling crc32fast v1.3.2
   Compiling crossbeam-utils v0.8.14
   Compiling fallible-iterator v0.2.0
   Compiling hashbrown v0.12.3
   Compiling target-lexicon v0.12.5
   Compiling num-traits v0.2.15
   Compiling scopeguard v1.1.0
   Compiling cranelift-isle v0.89.2
   Compiling thiserror v1.0.37
   Compiling libc v0.2.138
   Compiling cranelift-codegen-shared v0.89.2
   Compiling byteorder v1.4.3
   Compiling cranelift-codegen-meta v0.89.2
   Compiling memoffset v0.7.1
   Compiling num-integer v0.1.45
   Compiling memchr v2.5.0
   Compiling cc v1.0.77
   Compiling windows_x86_64_msvc v0.42.0
   Compiling fxhash v0.2.1
   Compiling crossbeam-channel v0.5.6
   Compiling crossbeam-epoch v0.9.13
   Compiling anyhow v1.0.66
   Compiling slice-group-by v0.3.0
   Compiling regalloc2 v0.4.2
   Compiling num-rational v0.4.1
   Compiling ident_case v1.0.1
   Compiling either v1.8.0
   Compiling windows_x86_64_msvc v0.36.1
   Compiling bumpalo v3.11.1
   Compiling fnv v1.0.7
   Compiling arrayvec v0.7.2
   Compiling darling_core v0.14.2
   Compiling windows-sys v0.42.0
   Compiling cranelift-codegen v0.89.2
   Compiling ahash v0.8.2
   Compiling memoffset v0.6.5
   Compiling rand_core v0.6.4
   Compiling bitflags v1.3.2
   Compiling heck v0.4.0
   Compiling itoa v1.0.4
   Compiling ppv-lite86 v0.2.17
   Compiling rayon-core v1.10.1
   Compiling rand_chacha v0.3.1
   Compiling crossbeam-deque v0.8.2
   Compiling thiserror-impl v1.0.37
   Compiling darling_macro v0.14.2
   Compiling wasmtime-runtime v2.0.2
   Compiling num-iter v0.1.43
   Compiling num_cpus v1.14.0
   Compiling doc-comment v0.3.3
   Compiling time-core v0.1.0
   Compiling cpp_demangle v0.3.5
   Compiling adler v1.0.2
   Compiling darling v0.14.2
   Compiling miniz_oxide v0.6.2
   Compiling time v0.3.17
   Compiling windows-sys v0.36.1
   Compiling rand v0.8.5
   Compiling itertools v0.10.5
   Compiling psm v0.1.21
   Compiling wasmtime-jit-debug v2.0.2
   Compiling proc-macro-error-attr v1.0.4
   Compiling lock_api v0.4.9
   Compiling wasmtime-asm-macros v2.0.2
   Compiling paste v1.0.9
   Compiling ntapi v0.4.0
   Compiling parking_lot_core v0.9.5
   Compiling rayon v1.6.0
   Compiling flate2 v1.0.25
   Compiling enumset_derive v0.6.1
   Compiling enum-map-derive v0.10.0
   Compiling snafu-derive v0.7.3
   Compiling num-complex v0.4.2
   Compiling proc-macro-error v1.0.4
   Compiling unicase v2.6.0
   Compiling slotmap v1.0.6
   Compiling io-lifetimes v1.0.3
   Compiling proc-maps v0.3.0
   Compiling wasmtime v2.0.2
   Compiling rustc-demangle v0.1.21
   Compiling num v0.4.0
   Compiling enumset v1.0.12
   Compiling enum-map v2.4.1
   Compiling bytemuck_derive v1.3.0
   Compiling owning_ref v0.4.1
   Compiling tokio v1.23.0
   Compiling snafu v0.7.3
   Compiling unicode-segmentation v1.10.0
   Compiling lazy_static v1.4.0
   Compiling cranelift-entity v0.89.2
   Compiling bincode v1.3.3
   Compiling toml v0.5.9
   Compiling unicode-width v0.1.10
   Compiling gimli v0.26.2
   Compiling wasmparser v0.92.0
   Compiling cranelift-bforest v0.89.2
   Compiling object v0.29.0
   Compiling jpeg-decoder v0.3.0
   Compiling libm v0.2.6
   Compiling weezl v0.1.7
   Compiling serde_json v1.0.89
   Compiling xi-unicode v0.3.0
   Compiling outref v0.1.0
   Compiling cursive_core v0.3.6
   Compiling simd-abstraction v0.7.1
   Compiling tiff v0.8.0
   Compiling wasmtime-types v2.0.2
   Compiling wasmtime-environ v2.0.2
   Compiling addr2line v0.17.0
   Compiling sysinfo v0.26.8
   Compiling wasmtime-jit v2.0.2
   Compiling bytemuck v1.12.3
   Compiling parking_lot v0.12.1
   Compiling png v0.17.7
   Compiling cranelift-frontend v0.89.2
   Compiling cranelift-native v0.89.2
   Compiling cranelift-wasm v0.89.2
   Compiling wasmtime-cranelift v2.0.2
   Compiling winapi-util v0.1.5
   Compiling crossterm_winapi v0.9.0
   Compiling read-process-memory v0.1.5
   Compiling scoped_threadpool v0.1.9
   Compiling pin-project-lite v0.2.9
   Compiling os_str_bytes v6.4.1
   Compiling color_quant v1.1.0
   Compiling ryu v1.0.11
   Compiling image v0.24.5
   Compiling clap_lex v0.3.0
   Compiling livesplit-auto-splitting v0.1.0 (E:\configs-programs\chronos\chronos\livesplit-core\crates\livesplit-auto-splitting)
   Compiling crossterm v0.25.0
   Compiling termcolor v1.1.3
   Compiling is-terminal v0.4.1
   Compiling livesplit-title-abbreviations v0.2.0 (E:\configs-programs\chronos\chronos\livesplit-core\crates\livesplit-title-abbreviations)
   Compiling clap_derive v4.0.21
   Compiling base64-simd v0.7.0
   Compiling livesplit-hotkey v0.6.0 (E:\configs-programs\chronos\chronos\livesplit-core\crates\livesplit-hotkey)
   Compiling hashbrown v0.13.1
   Compiling term_size v0.3.2
   Compiling smallstr v0.3.0
   Compiling simdutf8 v0.1.4
   Compiling strsim v0.10.0
   Compiling maplit v1.0.2
   Compiling cursive v0.20.0
   Compiling livesplit-core v0.12.0 (E:\configs-programs\chronos\chronos\livesplit-core)
   Compiling clap v4.0.29
   Compiling cursive_buffered_backend v0.6.1
   Compiling chronos v0.3.0 (E:\configs-programs\chronos\chronos)
error[E0308]: mismatched types
  --> src\lib.rs:10:41
   |
10 | pub const DEFAULT_LAYOUT: &[u8; 6413] = include_bytes!("default_layout.ls1l");
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 6413 elements, found one with 6643 elements
   |
   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0308`.
error: could not compile `chronos` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
PS E:\configs-programs\chronos\chronos>
CryZe commented

I would not be surprised if your git checked out the file as having \r\n line endings. This probably should be &[u8] to not hard code the size.

Generally if rust code doesn't compile its the author of it who fucked something up.

I'll have to fix this later

okay i meant to fix this a while ago but i did get around to fixing it today