"Illegal hardware instruction" on Apple M1 Mac

When I run a basic example on a 2020 M1 MacBook Air:

cd ./DeepSpeech-examples/ffmpeg_vad_streaming
npm install
node ./index.js --audio /tmp/deepspeech/audio/2830-3980-0043.wav --model /tmp/deepspeech/deepspeech-0.9.0-models.pbmm

I get the error

zsh: illegal hardware instruction  node ./index.js --audio /tmp/deepspeech/audio/2830-3980-0043.wav --model

I get the same error

  • if I run the example from a Terminal instance booted with Rosetta
  • if I run a different example, e.g. ./nodejs_mic_vad_streaming

Has anyone had any luck running inference on an arm64 Mac, with or without emulation?


ffmpeg: 4.3.1
node: 14.15.3

I don’t have a Mac, so I might be wrong. But you should be able to run it if you emulate a X86 platform. Maybe try to run inference with Python command line client which is bit more talkative with the error messages.

We don’t have support for ARM64 M1 on Mac, and we don’t have hardware, so it’s hard to help and give support as well as any time this can be done.

I don’t know how you can tell macOS to change its platform at runtime, our loading code will use arch-specific paths, so since the system sees this is ARM64, it loads it: https://github.com/mozilla/DeepSpeech/blob/fcbd92d0d75beee36473aa44669fa330ca522cdc/native_client/javascript/index.ts#L5 it is handled by node-pre-gyp

If you inspect the nodejs package:

$ tar tvf deepspeech-0.10.0-alpha.3.tgz  package/lib/binding/v0.10.0-alpha.3/ | grep darwin
-rwxr-xr-x 0/0           65788 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v10.0/deepspeech.node
-rwxr-xr-x 0/0           65788 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v10.1/deepspeech.node
-rwxr-xr-x 0/0           71668 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v11.0/deepspeech.node
-rwxr-xr-x 0/0           65796 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v5.0/deepspeech.node
-rwxr-xr-x 0/0           65844 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v6.0/deepspeech.node
-rwxr-xr-x 0/0           65844 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v6.1/deepspeech.node
-rwxr-xr-x 0/0           65844 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v7.0/deepspeech.node
-rwxr-xr-x 0/0           65844 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v7.1/deepspeech.node
-rwxr-xr-x 0/0           65844 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v8.0/deepspeech.node
-rwxr-xr-x 0/0           65908 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v9.0/deepspeech.node
-rwxr-xr-x 0/0           65908 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v9.1/deepspeech.node
-rwxr-xr-x 0/0           65908 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/electron-v9.2/deepspeech.node
-rwxr-xr-x 0/0           65500 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v64/deepspeech.node
-rwxr-xr-x 0/0           65852 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v67/deepspeech.node
-rwxr-xr-x 0/0           65764 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v72/deepspeech.node
-rwxr-xr-x 0/0           65836 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v79/deepspeech.node
-rwxr-xr-x 0/0           71772 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v83/deepspeech.node
-rwxr-xr-x 0/0           71660 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/node-v88/deepspeech.node
-rwxr-xr-x 0/0        46259964 1985-10-26 09:15 package/lib/binding/v0.10.0-alpha.3/darwin-x64/libdeepspeech.so

We only have macOS amd64 binaries there, so if anything is running on your Mac M1, I doubt it’s ARM64 code, but rather translation from amd64. Who knows what can be broken in this case …

1 Like