ERROR:mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64') when build with Mac ARM

Hello everyone,

I get an error when building my vscode NRF5340 project on macOS:

ImportError: dlopen(/Users/lekimtinh/Library/Python/3.9/lib/python/site-packages/_cffi_backend.cpython-39-darwin.so, 0x0002):
tried: '/Users/lekimtinh/Library/Python/3.9/lib/python/site-packages/_cffi_backend.cpython-39-darwin.so'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/lekimtinh/Library/Python/3.9/lib/python/site-packages/_cffi_backend.cpython-39-darwin.so' (no such file),
'/Users/lekimtinh/Library/Python/3.9/lib/python/site-packages/_cffi_backend.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
[4/37] Linking C static library modules/mbedtls/libmodules__mbedtls.a
ninja: build stopped: subcommand failed.

I'm running on a Mac with an Apple Silicon chip (M3), and this error may be related to some library or binary that is not compatible with the x86_64 architecture.

I need help with this issue

  • Hi,

    I have not come across this particular problem, but it seems that you are using a locally installed python version. Are you using the NCS toolchain, or local installed tools? The reason I say this is that python is bundled with the toolchain, and normally that should be used, but here it seems that the path is local to your user folder. 

    So the first thing I would do is make sure you use a toolchain distributed with the SDK. Also, make sure that any components installed (such as J-link, thogh not relevant here, you us ethe universal package if you also have some x86 components) - or make sure to only use arm builds, which is fully supported with the nRF Connect SDK tools.

  • Thank you.
    I completely uninstalled NCS (including in VS code), then reinstalled from scratch and fixed the error.

Related