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

Compilation error on 32-bit architecture #7406

Open
frol opened this issue Aug 13, 2022 · 3 comments
Open

Compilation error on 32-bit architecture #7406

frol opened this issue Aug 13, 2022 · 3 comments
Labels
C-bug Category: This is a bug C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on.

Comments

@frol
Copy link
Collaborator

frol commented Aug 13, 2022

Describe the bug

image

error[E0308]: mismatched types
  --> /home/dots/.cargo/registry/src/github.com-1285ae84e5963aae/near-primitives-0.14.0/src/rand.rs:62:50
   |
62 |         let uniform_index = usize::from_le_bytes(usize_seed) % self.aliases.len();
   |                             -------------------- ^^^^^^^^^^ expected an array with a fixed size of 4 elements, found one with 8 elements
   |                             |
   |                             arguments to this function are incorrect

To Reproduce

Compile near-primitives for i686 (32-bit) target (wasm probably will have the same issue).

Expected behavior

It should compile just fine.

Version (please complete the following information):

  • nearcore commit/branch: 0.14 release and master branch
@frol frol added the C-bug Category: This is a bug label Aug 13, 2022
@matklad
Copy link
Contributor

matklad commented Aug 16, 2022

Sort-of dupe of #7137.

At the moment, no effort is spent on making nearcore crates (with the exception of near-account-id) usable outside of nearcore.

In the ideal world, all re-usable functionality would be available from near_sdk, but, as far as I know it, no one is actually working on that.

Practical advice would be:

  • copy-paste vendor the relevant struct definitions or what-not. While the crate itself is unstable, the binary ABI exposed by nearcore is stable
  • create some sort of discussion/tracking issue with dev-platform roped in which tracks how we solve the underlying problem here -- as far as I know, there isn't organized effort here yet

@frol
Copy link
Collaborator Author

frol commented Sep 30, 2022

It was not near-sdk, but near-jsonrpc-client-rs, which depends on near-primitives, and I tried to compile near-cli-rs for x32 platform and failed. Given that it was just one thing that borked, it hoped to find some time to fix it.

cc @miraclx

@frol frol added the C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on. label Sep 30, 2022
@frol
Copy link
Collaborator Author

frol commented Aug 12, 2023

I needed to compile near-jsonrpc-client (and subsequently near-primitives) for x86 again and remembered that I did not mention the hotfix here. In order to get through the compilation error, I patched the file in question in my local cargo registry cache folder by replacing the body of this sample function with 0 (this function is not used by near-jsonrpc-client).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on.
Projects
None yet
Development

No branches or pull requests

2 participants