Build & reproduction report - namada-sdk-wrapper-keychain (Termux / proot-distro Ubuntu, ARM64)
Short summary
I attempted to build namada-sdk-wrapper-keychain in Termux → proot-distro (Ubuntu arm64). Build finishes for libnamada_wrapper.so (Rust), but attempts to prepare a minimal Node.js CLI (using ffi-napi) fail: native addon build for ffi-napi breaks on Node 20 / ARM64 (node-gyp errors). Also observed runtime ES module require error when launching the demo CLI.
Environment
Device: Android (Termux + proot-distro)
Distribution: proot-distro Ubuntu (arm64)
Node: v20.19.4
npm: 9.2.0 (used for some steps)
yarn: 1.22.22
Rust: rustc 1.91.0, cargo 1.91.0
Termux storage available; working directory ~/namada-sdk-wrapper-keychain
What I cloned
git clone GitHub - GE-Tnso/namada-sdk-wrapper-keychain
(and later the wallet keychain repo)
Commands I ran (full reproduction)
Run in proot-distro / Ubuntu session:
(prepare basic environment in Termux + proot-distro)
proot-distro login ubuntu
Clone repo (example)
cd ~
git clone GitHub - GE-Tnso/namada-sdk-wrapper-keychain
cd namada-sdk-wrapper-keychain
Install JS toolchain if needed
npm install -g yarn
yarn install
Build Rust wrapper (this completed)
cargo build --release
Check produced artifact
ls -lh target/release/libnamada_wrapper.so
sha256sum target/release/libnamada_wrapper.so
=> 2f6522344cd982c2785d98fa92a32af479b08b19f384a163698fbbf195bbf69c
Create minimal Node CLI and install ffi-napi (this is where failure occurs)
mkdir -p ~/namada-cli && cd ~/namada-cli
cat > package.json <<‘EOF’
{
“name”: “namada-cli”,
“version”: “1.0.0”,
“type”: “module”,
“main”: “index.js”,
“dependencies”: {
“ffi-napi”: “^4.0.3”,
“ref-napi”: “^3.0.3”,
“inquirer”: “^9.2.7”,
“chalk”: “^5.3.0”
}
}
EOF
yarn install
OR: npm install (similar issues)
Observed failures (key excerpts)
When yarn install runs, ffi-napi triggers native build via node-gyp and fails with C++/N-API / header mismatch errors:
gyp ERR! build error
…
../src/ffi.cc:58:41: required from here
/usr/include/nodejs/src/js_native_api.h:528:44: note: initializing argument 4 of ‘napi_status napi_add_finalizer(napi_env, napi_value, void*, node_api_basic_finalize, void*, napi_ref__**)’
…
error: invalid conversion from ‘napi_finalize’ {aka ‘void ()(napi_env__, void*, void*)’} to ‘node_api_basic_finalize’ {aka ‘void ()(const napi_env__, void*, void*)’} [-fpermissive]
…
make: *** [ffi_bindings.target.mk:117: Release/obj.target/ffi_bindings/src/ffi.o] Error 1
gyp ERR! stack Error: make failed with exit code: 2
At runtime (after partial setup), Node throws:
ReferenceError: require is not defined in ES module scope
because package.json contains “type”: “module”
Summary: ffi-napi C++ addon fails to compile under Node 20 + system Node headers on ARM64 (Termux/proot). The napi / node-addon-api expectations appear to mismatch the installed Node headers.
Successful build artifacts (proof)
Rust build produced libnamada_wrapper.so:
-rwxr-xr-x. 2 root root 73M target/release/libnamada_wrapper.so
SHA256: 2f6522344cd982c2785d98fa92a32af479b08b19f384a163698fbbf195bbf69c
(If needed, I can provide the file or upload a copy - currently stored locally in my Termux storage.)
Additional notes & reproduction hints
I reproduced on a clean proot-distro Ubuntu install inside Termux (ARM64). The same ffi-napi build fails consistently.
Attempting npm cache clean, re-installing node-gyp, installing make, g++, Python etc. did not resolve the napi type conversion errors.
git clone of tnso-project/namada-wallet-mobile-keychain returned 404 (repo not found), so I used the wrapper repo above.
Questions / requests for maintainers
-
Node / ffi-napi support: Are there official or recommended Node versions for building the JS CLI (for example Node 18 LTS)? If Node 20 is supported, can maintainers provide guidance for building ffi-napi on ARM64 (Debian/Ubuntu/Termux)?
-
Prebuilt binaries: Could you publish prebuilt libnamada_wrapper.so for aarch64 (or a simple release artifact) to avoid native build on mobile? A prebuilt .so would help testers on Android/Termux.
-
ffi-napi replacement: Consider providing a pure-N-API binding (or a prebuilt node binding) that avoids node-gyp native compilation on mobile/arm64.
-
ES module / CommonJS: Example index.js/packaging guidance: if you publish an example CLI, indicate whether it expects type: “module” or CommonJS; adjust the sample code accordingly (avoid require in ESM).
-
Build matrix in docs: Please add a short supported-platforms note (Linux x86_64, arm64, Node versions) in README so testers know the expected environment.
Attachments / logs
I can attach:
a short terminal log (key errors) - inline above
the produced libnamada_wrapper.so SHA256: 2f6522344cd982c2785d98fa92a32af479b08b19f384a163698fbbf195bbf69c
full yarn install output / npm debug log on request
Final remark
This is reproducible on Termux/proot Ubuntu (arm64) with Node 20. The core issue appears to be native addon compilation for ffi-napi under Node 20 / arm64 (N-API mismatch). For mobile testing and CI, having prebuilt artifacts or official build instructions for ARM would unblock many testers.