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

roc_mono: cannot transmute between types of different sizes, or dependently-sized types #5631

Closed
juhp opened this issue Jul 2, 2023 · 6 comments

Comments

@juhp
Copy link

juhp commented Jul 2, 2023

I am trying to build current HEAD (f2e013a) from source on Fedora Rawhide x86_64 with cargo build and hit:

:
   Compiling roc_mono v0.0.1 (/var/home/petersen/src/roc/crates/compiler/mono)
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> crates/compiler/mono/src/ir.rs:77:1
   |
77 | roc_error_macros::assert_sizeof_non_wasm!(Expr, 9 * 8);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `ir::Expr<'_>` (640 bits)
   = note: target type: `[u8; 72]` (576 bits)
   = note: this error originates in the macro `static_assertions::assert_eq_size` which comes from the expansion of the macro `roc_error_macros::assert_sizeof_non_wasm` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> crates/compiler/mono/src/ir.rs:78:1
   |
78 | roc_error_macros::assert_sizeof_non_wasm!(Stmt, 12 * 8);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `Stmt<'_>` (832 bits)
   = note: target type: `[u8; 96]` (768 bits)
   = note: this error originates in the macro `static_assertions::assert_eq_size` which comes from the expansion of the macro `roc_error_macros::assert_sizeof_non_wasm` (in Nightly builds, run with -Z macro-backtrace for more info)

Note this is basically the first time I am attempting to build roc.
To be transparent I should say I am not following the "build-from-source" doc to the letter, but is the above a toolchain issue?
(eg we don't have clang13 in Fedora, only clang13-libs (and clang-16) - Fedora zig-0.9.1 links to clang13-libs and rust is linked to llvm-16)

((I tried reverting the last commit (PR) since it happens to touch mono/, but that didn't help.))

@Anton-4
Copy link
Collaborator

Anton-4 commented Jul 2, 2023

Hi @juhp,
This error usually happens when you're using a different version of rust, you can check with rustc version.
We're currently on 1.66.1, we also use a rust-toolchain.toml file to force the rust version, but it is possible that your system is configured in a way that ignores that.

Building from source with nix should be the easiest option:

  1. Install nix in multi-user mode
  2. Execute nix develop from the root of the roc repo
  3. cargo build --release --bin roc

@juhp juhp changed the title roc_mono: roc_mono: cannot transmute between types of different sizes, or dependently-sized types Jul 2, 2023
@juhp
Copy link
Author

juhp commented Jul 2, 2023

Okay I see, thanks - unfortunately I don't use nix... Fedora currently has rust-1.70.0 (and Centos Stream 9 has 1.69.0).
And the Ubuntu roc binary has a library version (dynlinking) warning with our unversioned libterminfo alas.

@juhp
Copy link
Author

juhp commented Jul 2, 2023

I guess I will check back later then for Fedora, thanks for explaining

But RHEL 9.2 GA has rust-1.66.1, so I can try building there (but no zig package yet)

@juhp juhp closed this as completed Jul 2, 2023
@Anton-4
Copy link
Collaborator

Anton-4 commented Jul 2, 2023

We've been wanting to upgrade our rust version but we are stuck on some difficult test failures.

By the way, rust can easily deal with having multiple versions installed, it's possible to use a specific version of rust only for inside the roc folder and use a different default version system wide. Does rust come preinstalled on fedora rawhide or did you install it yourself?

@Anton-4
Copy link
Collaborator

Anton-4 commented Jul 2, 2023

I think the libterminfo warning /lib64/libtinfo.so.6: no version information available can usually be ignored without issue.

@juhp
Copy link
Author

juhp commented Jul 2, 2023

Ah yes thank you right - not sure why I thought it wasn't working - think I simply forgot to add any args 🫢

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