RocketChat / RocketChat/Rocket.Chat

6.2.11/6.3.0 napi rust compile error on arm64

Open
#30,067 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

I am trying to run npm install on arm64 and it gives me the following error, 5.4.1 worked fine.

   Compiling napi v2.13.2
   Compiling futures v0.3.28
   Compiling napi-derive v2.13.0
Failed to manipulate type def file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
error[E0433]: failed to resolve: use of undeclared type `FromNapiValue`
  --> src/request.rs:22:1
   |
22 | #[napi]
   | ^^^^^^^ use of undeclared type `FromNapiValue`
   |
   = note: this error originates in the attribute macro `napi` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this trait
   |
15 + use napi::bindgen_prelude::FromNapiValue;
   |

For more information about this error, try `rustc --explain E0433`.
error: could not compile `matrix-sdk-crypto-nodejs` (lib) due to previous error
Internal Error: Command failed: cargo build 
    at checkExecSyncError (child_process.js:790:11)
    at Object.execSync (child_process.js:863:15)
    at BuildCommand.<anonymous> (/build/bundle/programs/server/npm/node_modules/@napi-rs/cli/scripts/index.js:14602:26)
    at Generator.next (<anonymous>)
    at fulfilled (/build/bundle/programs/server/npm/node_modules/@napi-rs/cli/scripts/index.js:3423:58)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npme[0me[91m e[0me[91mERR! code ELIFECYCLE
e[0me[91mnpm ERR! errnoe[0me[91m 1
e[0me[91mnpm ERR!e[0me[91m @rocket.chat/forked-matrix-sdk-crypto-nodejs@0.1.0-beta.12 postinstall: `node check-exists.js`
npm ERR!e[0me[91m Exit status 1
npm ERR!e[0me[91m 
npm e[0me[91mERR! Failed at the @rocket.chat/forked-matrix-sdk-crypto-nodejs@0.1.0-beta.12 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
e[0me[91m

at the same time build on amd64 is ok.

found this line here:
https://github.com/RocketChat/matrix-rust-sdk-bindings/blob/fork-for-tmp-release/crates/matrix-sdk-crypto-nodejs/src/request.rs#L22

Is it because I am getting napi 2.13.2 instead of 2.0.0 as declared in cargo here:
https://github.com/RocketChat/matrix-rust-sdk-bindings/blob/fork-for-tmp-release/crates/matrix-sdk-crypto-nodejs/Cargo.toml#L19

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with crates/matrix-sdk-crypto-nodejs/src/request.rs at the #[napi] declaration and crates/matrix-sdk-crypto-nodejs/Cargo.toml at the napi dependency. Reproduce the arm64 failure with npm install or cargo build, compare it with the working amd64 and 5.4.1 builds, and confirm that the native module compiles successfully on arm64 without the missing type-definition and FromNapiValue errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.