I'm using Neon to write a Node.js native module that will be run in nodejs-mobile, on mobile architectures such as armeabi-v7a (32 bit), aarch64 and so forth.
Problem
With neon 0.10.1:
Cross-compilation for Android armv7 (32-bit) fails because AtomicU64 is not supported for that architecture. This is assuming that neon's napi-6 feature is enabled, because of
This PR enables napi-6 to support 32-bit architectures, by using AtomicU32 instead. Arguably, we lose a lot more identifiers for InstanceId, but U32 gives us 4 billion identifiers, and maybe this is sufficient?
A follow-up to this PR would switch the AtomicU* type depending on the architecture.
Context
I'm using Neon to write a Node.js native module that will be run in nodejs-mobile, on mobile architectures such as armeabi-v7a (32 bit), aarch64 and so forth.
Problem
With
neon
0.10.1:Cross-compilation for Android armv7 (32-bit) fails because AtomicU64 is not supported for that architecture. This is assuming that neon's
napi-6
feature is enabled, because ofhttps://github.com/neon-bindings/neon/blob/fe4642e7c126b4bffb16be5c655e57bc0ef3432d/crates/neon/src/sys/mod.rs#L34-L35
and
https://github.com/neon-bindings/neon/blob/fe4642e7c126b4bffb16be5c655e57bc0ef3432d/crates/neon/src/lifecycle.rs#L15
If I use
napi-5
feature, compilation succeeds.Solution
This PR enables
napi-6
to support 32-bit architectures, by using AtomicU32 instead. Arguably, we lose a lot more identifiers forInstanceId
, but U32 gives us 4 billion identifiers, and maybe this is sufficient?A follow-up to this PR would switch the
AtomicU*
type depending on the architecture.