Error: unknown target CPU armv8.3-a+

error: unknown target CPU 'armv8.3-a+crypto+sha2+aes+crc+fp16+lse+simd+ras+rdm+rcpc'

I’ve encountered this error a couple of times, and I’m pretty sure the issue is with trying to build something on an M1 mac that has x86_64 hard coded somewhere in the code being compiled.

I’m posting this here so that when searching for this error, people might find information that isn’t specific to a single package, although at this point all I have is a workaround once you’ve identified the problem which the package you’re building.

For example, check out this native binding for nodejs. The important bit is this:

'OTHER_CFLAGS': ['-arch x86_64', '-arch arm64'],
'OTHER_LDFLAGS': ['-arch x86_64', '-arch arm64']

They’re trying to do a nice thing and prebuild binaries for multiple architectures, but it’s not going to fly under nix. (it still works via macOS’s clang, but that’s not why I’m here). Using the following substitution I was able to get nix to stop trying to compile the x86_64 bindings and my build worked as expected.

substituteInPlace node_modules/bufferutil/binding.gyp --replace "x86_64" "arm64"

A more robust solution would be to get nix’s cross compiling working in this scenario, but I have no idea how to do such a thing. I hope that someone who does will come across this, but at the very least, I hope that you got an answer as to why your particular build failed, and what you should look for to work around it.

2 Likes

I encountered this too. Seems like nix brings in tooling that expects only the arm64 architecture. But can’t seem to handle universal binary building on nodejs. Was attempting it here: ci: merge staging to master by MatrixAI-Bot · Pull Request #38 · MatrixAI/js-db · GitHub

Hey, same thing here while trying to install the @contrast/fn-inspect package. Anyone has an idea on how to solve this?