nearcore
nearcore copied to clipboard
Compilation error on 32-bit architecture
Describe the bug
![image](https://user-images.githubusercontent.com/304265/184475856-8cbcd6f1-66f2-4193-9baa-0b079cb9aad4.png)
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
Sort-of dupe of https://github.com/near/nearcore/issues/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
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
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).