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

rten compile error (size_of not found) #165

Closed
potatoes1286 opened this issue Feb 9, 2025 · 3 comments
Closed

rten compile error (size_of not found) #165

potatoes1286 opened this issue Feb 9, 2025 · 3 comments

Comments

@potatoes1286
Copy link

title. not knowledgeable on rust so i do not know if i am doing something wrong, but i just used the command.

potatoes@fedora:~/Documents/temp-working$ cargo install ocrs-cli --locked
    Updating crates.io index
  Installing ocrs-cli v0.10.2
    Updating crates.io index
    Updating crates.io index
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.151
   Compiling crossbeam-utils v0.8.18
   Compiling semver v1.0.20
   Compiling proc-macro2 v1.0.89
   Compiling crc32fast v1.3.2
   Compiling smallvec v1.13.2
   Compiling simd-adler32 v0.3.7
   Compiling unicode-ident v1.0.12
   Compiling rustls-pki-types v1.11.0
   Compiling bitflags v1.3.2
   Compiling rayon-core v1.12.1
   Compiling adler2 v2.0.0
   Compiling spin v0.9.8
   Compiling httparse v1.10.0
   Compiling untrusted v0.9.0
   Compiling autocfg v1.1.0
   Compiling itoa v1.0.10
   Compiling percent-encoding v2.3.1
   Compiling miniz_oxide v0.8.0
   Compiling thiserror v2.0.3
   Compiling anyhow v1.0.95
   Compiling bytes v1.10.0
   Compiling rten-tensor v0.16.0
   Compiling log v0.4.25
   Compiling fnv v1.0.7
   Compiling serde v1.0.194
   Compiling rten-simd v0.16.0
   Compiling num-traits v0.2.17
   Compiling rustls v0.23.22
   Compiling rustc_version v0.4.0
   Compiling either v1.9.0
   Compiling rten-vecmath v0.16.0
   Compiling fdeflate v0.3.3
   Compiling byteorder-lite v0.1.0
   Compiling serde_json v1.0.134
   Compiling utf8_iter v1.0.4
   Compiling flate2 v1.0.35
   Compiling crossbeam-epoch v0.9.17
   Compiling quote v1.0.35
   Compiling flatbuffers v24.3.25
   Compiling http v1.2.0
   Compiling syn v2.0.87
   Compiling cc v1.0.83
   Compiling getrandom v0.2.11
   Compiling crossbeam-deque v0.8.4
   Compiling num_cpus v1.16.0
   Compiling subtle v2.5.0
   Compiling quick-error v2.0.1
   Compiling rustc-hash v2.0.0
   Compiling once_cell v1.19.0
   Compiling base64 v0.22.1
   Compiling idna_adapter v1.0.0
   Compiling zune-core v0.4.12
   Compiling zeroize v1.7.0
   Compiling idna v1.0.3
   Compiling image-webp v0.2.0
   Compiling png v0.17.16
   Compiling rten-imageproc v0.16.0
   Compiling zune-jpeg v0.4.13
   Compiling rayon v1.10.0
   Compiling ureq-proto v0.3.0
   Compiling webpki-roots v0.26.8
   Compiling rustls-pemfile v2.2.0
   Compiling ring v0.17.7
   Compiling form_urlencoded v1.2.1
   Compiling bytemuck v1.14.0
   Compiling memchr v2.7.4
   Compiling ryu v1.0.16
   Compiling utf-8 v0.7.6
   Compiling url v2.5.4
   Compiling lexopt v0.3.0
   Compiling home v0.5.9
   Compiling image v0.25.5
   Compiling thiserror-impl v2.0.3
   Compiling rten v0.16.0
error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/im2col.rs:244:31
    |
244 |         const K_TILE: usize = size_of::<i32>() / size_of::<i8>();
    |                               ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/im2col.rs:244:50
    |
244 |         const K_TILE: usize = size_of::<i32>() / size_of::<i8>();
    |                                                  ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/kernels/simd_generic.rs:271:40
    |
271 |             let min_len = depth * MR * size_of::<f32>();
    |                                        ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `align_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/kernels/simd_generic.rs:570:38
    |
570 |     assert_eq!(a.as_ptr() as usize % align_of::<i32>(), 0);
    |                                      ^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::align_of;
    |
1   + use std::mem::align_of;
    |

error[E0425]: cannot find function `align_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing/int8.rs:32:17
   |
32 |     let align = align_of::<i32>();
   |                 ^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
8  + use core::mem::align_of;
   |
8  + use std::mem::align_of;
   |

error[E0425]: cannot find function `align_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing/int8.rs:166:17
    |
166 |     let align = align_of::<i32>();
    |                 ^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
8   + use core::mem::align_of;
    |
8   + use std::mem::align_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing/int8.rs:245:41
    |
245 |     let row_sum_offset = a.len() - MR * size_of::<i32>();
    |                                         ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
8   + use core::mem::size_of;
    |
8   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing/int8.rs:253:41
    |
253 |     let col_sum_offset = b.len() - NR * size_of::<i32>();
    |                                         ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
8   + use core::mem::size_of;
    |
8   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:57:51
   |
57 |     let size = rows.next_multiple_of(MR) * cols * size_of::<T>();
   |                                                   ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::size_of;
   |
1  + use std::mem::size_of;
   |

error[E0425]: cannot find function `size_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:58:36
   |
58 |     let panel_stride = MR * cols * size_of::<T>();
   |                                    ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::size_of;
   |
1  + use std::mem::size_of;
   |

error[E0425]: cannot find function `align_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:59:29
   |
59 |     PackedLayout::new(size, align_of::<T>(), panel_stride)
   |                             ^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::align_of;
   |
1  + use std::mem::align_of;
   |

error[E0425]: cannot find function `size_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:99:51
   |
99 |     let size = cols.next_multiple_of(NR) * rows * size_of::<T>();
   |                                                   ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::size_of;
   |
1  + use std::mem::size_of;
   |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:100:36
    |
100 |     let panel_stride = NR * rows * size_of::<T>();
    |                                    ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `align_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:101:29
    |
101 |     PackedLayout::new(size, align_of::<T>(), panel_stride)
    |                             ^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::align_of;
    |
1   + use std::mem::align_of;
    |

error[E0425]: cannot find function `align_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:234:26
    |
234 |         assert!(align <= align_of::<PackElem>());
    |                          ^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::align_of;
    |
1   + use std::mem::align_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:236:37
    |
236 |         let buf_len = size.div_ceil(size_of::<PackElem>());
    |                                     ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `align_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:256:26
    |
256 |         assert!(align <= align_of::<PackElem>());
    |                          ^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::align_of;
    |
1   + use std::mem::align_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:258:37
    |
258 |         let buf_len = size.div_ceil(size_of::<PackElem>());
    |                                     ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:268:60
    |
268 |         let rounded_len = initialized_len.next_multiple_of(size_of::<PackElem>());
    |                                                            ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/gemm/packing.rs:271:37
    |
271 |         let buf_len = rounded_len / size_of::<PackElem>();
    |                                     ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

error[E0425]: cannot find function `align_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/slice_cast.rs:22:34
   |
22 |     if (src.as_ptr() as usize) % align_of::<Dst>() != 0 {
   |                                  ^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::align_of;
   |
1  + use std::mem::align_of;
   |

error[E0425]: cannot find function `size_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/slice_cast.rs:27:23
   |
27 |     if src_byte_len % size_of::<Dst>() != 0 {
   |                       ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::size_of;
   |
1  + use std::mem::size_of;
   |

error[E0425]: cannot find function `size_of` in this scope
  --> /home/potatoes/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rten-0.16.0/src/slice_cast.rs:31:25
   |
31 |     Some(src_byte_len / size_of::<Dst>())
   |                         ^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  + use core::mem::size_of;
   |
1  + use std::mem::size_of;
   |

For more information about this error, try `rustc --explain E0425`.
error: could not compile `rten` (lib) due to 23 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `ocrs-cli v0.10.2`, intermediate artifacts can be found at `/tmp/cargo-installc3Mkwb`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Fedora linux 41.

@robertknight
Copy link
Owner

robertknight commented Feb 9, 2025

You need to update to Rust v1.80 or later. The compile error here relates to rust-lang/rust#123168, which is a change that shipped in v1.80.

@robertknight robertknight changed the title rten wont compile rten compile error (size_of not found) Feb 9, 2025
@robertknight
Copy link
Owner

There is an issue in rten here that it doesn't declare the minimum Rust version. If it did, that would have resulted in a more helpful error.

@potatoes1286
Copy link
Author

Yup, that was it! Thanks a ton!

Had to go through some extra hoops because rustup update was failing as well. But after reinstall, rten installs fine.

Sorry about the silly error. Maybe add a disclaimer to rustup update for other ppl who forget 🙃

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