meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[BUG] MeshMonitor-Desktop-4.11.2-x64.dmg bundles re2.node as arm64 instead of x86_64

Open ltitus210 opened this issue 5 months ago • 1 comments

Description of bug MeshMonitor-Desktop-4.11.2-x64.dmg (and other 4.11.x builds) bundles re2.node as arm64, but the x64 app needs x86_64.

To Reproduce Steps to reproduce the behavior:

  1. Preform a clean install via the dmg file.
  2. Run the application.
  3. Enter an IP and click "Start MeshMonitor".
  4. Application hangs showing "Starting...".
  5. Open the logs folder and view server-stderr.log.

Output of server-stderr.log

node:internal/modules/cjs/loader:1920
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node, 0x0001): tried: '/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node' (no such file), '/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))
    at Object..node (node:internal/modules/cjs/loader:1920:18)
    at Module.load (node:internal/modules/cjs/loader:1481:32)
    at Module._load (node:internal/modules/cjs/loader:1300:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
    at Module.require (node:internal/modules/cjs/loader:1504:12)
    at require (node:internal/modules/helpers:152:16)
    at Object.<anonymous> (/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/re2.js:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1761:14)
    at Object..js (node:internal/modules/cjs/loader:1893:10) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v24.12.0

Verification of my computer architecture vs re2.node architecture My CPU's architecture:

ltitus@Larrys-iHack-Pro-15 git % uname -a                                                                                          
Darwin Larrys-iHack-Pro-15.local 24.6.0 Darwin Kernel Version 24.6.0: Tue Apr 21 20:17:54 PDT 2026; root:xnu-11417.140.69.710.16~1/RELEASE_X86_64 x86_64

Architecture of main app binary:

ltitus@Larrys-iHack-Pro-15 git % file /Applications/MeshMonitor.app/Contents/MacOS/*
/Applications/MeshMonitor.app/Contents/MacOS/meshmonitor-desktop: Mach-O 64-bit executable x86_64

Architecture of bundled re2.node:

ltitus@Larrys-iHack-Pro-15 git % file /Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node
/Applications/MeshMonitor.app/Contents/Resources/dist/node_modules/re2/build/Release/re2.node: Mach-O 64-bit bundle arm64

Expected behavior Bundled re2.node in MeshMonitor-Desktop-4.11.2-x64.dmg should be built for x86_64.

Environment:

  • Host OS: macOS 15.7.7
  • CPU: Intel 3.42 GHz Intel(R) Core(TM) i7-13700K
  • Deployment type: Mac App
  • Database backend: SQLite
  • Node type: Heltec V4
  • Node Connection Type: Wifi

Additional context This is a similar bug as the one reported here.

ltitus210 avatar Jun 21 '26 16:06 ltitus210

Thanks for the detailed report — this is a subtle variant of #2901 that the original fix didn't cover.

Root cause

[email protected] uses a custom downloader called install-artifact-from-github (authored by the same developer) to fetch its prebuilt .node binary from GitHub Releases. Unlike prebuild-install (which is used by better-sqlite3, bcrypt, etc.), install-artifact-from-github reads process.arch — the Node.js process's native architecture — rather than the npm_config_arch environment variable.

The x64 macOS build runs on a macos-14 GitHub Actions runner, which is Apple Silicon (arm64). So process.arch === 'arm64', and install-artifact-from-github downloads the arm64 prebuilt regardless of the npm_config_arch=x64 env var we set. The fix for #2901 only covered prebuild-install-based packages.

Fix

After npm ci, the workflow now deletes the wrong arm64 re2.node and rebuilds it from source using node-gyp with explicit -arch x86_64 compiler flags. Apple's clang on macOS natively supports cross-compilation via the -arch flag, so this produces a correct x86_64 binary.

The same fix has been applied to both desktop-release.yml and desktop-ci.yml (the CI workflow was also missing the npm_config_arch flags entirely, a secondary issue).

A PR with the fix is ready for review on branch claude/great-dijkstra-7hs6rz.


Generated by Claude Code

Yeraze avatar Jun 21 '26 16:06 Yeraze