Bug report: @xmtp/node-bindings@1.10.0 darwin-arm64 prebuilt binary links against a Nix-store absolute path, breaking on standard macOS
Package / version: @xmtp/node-bindings@1.10.0 (arm64 macOS prebuilt binary)
Summary:
The bindings_node.darwin-arm64.node shipped in 1.10.0 was built in a Nix environment and its LC_LOAD_DYLIB entry hardcodes an absolute Nix-store path for libiconv instead of the system library. On any non-Nix macOS machine this path does not exist, so dlopen fails and the NAPI-RS loader reports a misleading error.
Environment: macOS (Apple Silicon / arm64), Node v22.23.1
Symptom (misleading — it is NOT actually a missing-binding / npm optional-deps issue):
Error: Cannot find native binding. npm has a bug related to optional dependencies
(https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing
both package-lock.json and node_modules directory.
at .../@xmtp/node-bindings/dist/index.js:567:11
Actual root cause (the real error is swallowed into loadErrors by the NAPI-RS loader). Calling process.dlopen on the binary directly reveals:
dlopen(.../dist/bindings_node.darwin-arm64.node):
Library not loaded: /nix/store/7h6icyvqv6lqd0bcx41c8h3615rjcqb2-libiconv-109.100.2/lib/libiconv.2.dylib
Reason: tried: '/nix/store/.../libiconv.2.dylib' (no such file)
otool -L on the binary confirms it:
/nix/var/nix/builds/nix-2357-1322746074/source/target/aarch64-apple-darwin/release/deps/libbindings_node.dylib
/System/Library/Frameworks/Security.framework/.../Security
/System/Library/Frameworks/CoreFoundation.framework/.../CoreFoundation
/nix/store/7h6icyvqv6lqd0bcx41c8h3615rjcqb2-libiconv-109.100.2/lib/libiconv.2.dylib <-- should be /usr/lib/libiconv.2.dylib
/usr/lib/libSystem.B.dylib
Impact: The prebuilt arm64 binary cannot load on standard macOS installs. npm i / clearing node_modules (as the error text suggests) has no effect, since the file is present and correct — only its libiconv dependency path is wrong.
Expected: The macOS prebuilt binary should link against the system libiconv (/usr/lib/libiconv.2.dylib), not an absolute Nix-store path from the build machine.
Local confirmation / temporary workaround (rewriting the load path lets it load, proving the diagnosis):
install_name_tool -change \
/nix/store/7h6icyvqv6lqd0bcx41c8h3615rjcqb2-libiconv-109.100.2/lib/libiconv.2.dylib \
/usr/lib/libiconv.2.dylib bindings_node.darwin-arm64.node
codesign --force --sign - bindings_node.darwin-arm64.node
Please fix the macOS build so the shipped binary references the system libiconv (e.g. correct the install-name/rpath during the Nix build).
Bug report:
@xmtp/node-bindings@1.10.0darwin-arm64 prebuilt binary links against a Nix-store absolute path, breaking on standard macOSPackage / version:
@xmtp/node-bindings@1.10.0(arm64 macOS prebuilt binary)Summary:
The
bindings_node.darwin-arm64.nodeshipped in1.10.0was built in a Nix environment and itsLC_LOAD_DYLIBentry hardcodes an absolute Nix-store path for libiconv instead of the system library. On any non-Nix macOS machine this path does not exist, sodlopenfails and the NAPI-RS loader reports a misleading error.Environment: macOS (Apple Silicon / arm64), Node v22.23.1
Symptom (misleading — it is NOT actually a missing-binding / npm optional-deps issue):
Actual root cause (the real error is swallowed into
loadErrorsby the NAPI-RS loader). Callingprocess.dlopenon the binary directly reveals:otool -Lon the binary confirms it:Impact: The prebuilt arm64 binary cannot load on standard macOS installs.
npm i/ clearingnode_modules(as the error text suggests) has no effect, since the file is present and correct — only its libiconv dependency path is wrong.Expected: The macOS prebuilt binary should link against the system libiconv (
/usr/lib/libiconv.2.dylib), not an absolute Nix-store path from the build machine.Local confirmation / temporary workaround (rewriting the load path lets it load, proving the diagnosis):
Please fix the macOS build so the shipped binary references the system libiconv (e.g. correct the install-name/rpath during the Nix build).