Can't build on M1 laptop

Hi all! Trying to get started building VCV modules. However, when I try to make, I see the following error:

Could not determine CPU architecture of arm64-apple-darwin20.6.0. Try hacking around in arch.mk.  Stop.

In arch.mk, I see that it is checking the architecture before compiling:

MACHINE = $(shell $(CC) -dumpmachine)

ifneq (,$(findstring x86_64-,$(MACHINE)))
	ARCH_x64 := 1
	ARCH_NAME := x64
else ifneq (,$(findstring i686-,$(MACHINE)))
	ARCH_x86 := 1
	ARCH_NAME := x86
else
$(error Could not determine CPU architecture of $(MACHINE). Try hacking around in arch.mk)
endif

I’m a total novice so this is merely speculation, but I’m guessing that being on an arm64 M1 is causing this error. Unfortunately I have no idea (novice) how to update this file so it works. Has anyone else encountered this?

You need to run your development environment under Rosetta.

The way I do this is to make a copy of the Terminal application (under /Applications/Utilities) called “Terminal (Rosetta)” which has the “Open using Rosetta” option checked within “Get Info”.

I can then run either “Terminal” or “Terminal (Rosetta)” to get a terminal for M1 or x64.

1 Like

No need to make a copy of terminal. Just make an alias in youruserdirectory/.zprofile like so:

alias x64='arch -x86_64 zsh'

Now save that and when you want to build for intel you just type x64 and enter and you are done.

see this for full details: Develop Rack x86/64 on M1 Mac

1 Like

Search before posting please. As mentioned below the answer is here:

@islandlife: I’ve recently gone through the same experience. Lars pointed me to the Lindenberg article and all is well now. It’s not at all difficult, but you should be aware that you will not be building an M1-native application. You’ll need to follow Patrick’s instructions closely and you might want to replace this:

arch=nehalem

with this:

arch=x86-64

in the compile.mk and dep.mk files. I don’t think it’s absolutely necessary but I’m a stickler. :slight_smile:

It’s also a good idea to make an alias to switch the shell, as @fractalgee noted. Very handy.

Let me know if you get stuck. I got a lot of great help from people here, I’m happy to pass it on.

Best regards,

dp

Many, many thanks for all the great input on here. I just built my first module successfully - the fixes suggested here did the trick. Apologies for not finding that guide earlier - the forum search failed me but Google search turned it up right away.

Cheers!

2 Likes

Sorry - didn’t think to search M1 development specifically, was just searching the error message and not getting any results. Thanks for pointing me in the right direction!

1 Like