Plugin development on Mac M1

I have some experience developing plugins for VCV Rack on Windows. After recently purchasing an M1 Mac, I would like to be able to develop plugins on that machine as well. For example, I would like to be able to build the Fundamental modules from source.

When I cd into the repo and run make, I get

clang: error: the clang compiler does not support '-march=nocona'

As far as I understand, this is because the $(CXX) commands in the makefile call g++, and g++ --version gives

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.0 (clang-1200.0.32.29) Target: arm64-apple-darwin20.3.0 Thread model: posix

The compiler is targeting arm64, so obviously there will be problems, because Rack is an x86_64 program running through Rosetta2.

What can I change in the makefile to get clang to build x86_64 libraries rather than arm64?

maybe this post and the following ones can help you:

In your terminal run:

arch -x86_64 /bin/bash

source1 source2

Now everything that runs in that terminal runs under Rosetta2 and thinks it’s running on intel. See how that works for the compiler…

1 Like

@rsmus7 @LarsBjerregaard Thank you both for your help. It was sufficient to set up a Rosetta terminal as per source1, and run arch -x86_64 make, and the plugin builds.

Something else I tried was using a separate x86 homebrew installation per this article, and installing gcc separate under this homebrew. For example the native homebrew is /usr/opt/homebrew and the x86 homebrew is /usr/local/homebrew. I added the x86 homebrew to the path and changed CC and CXX to x86_64-apple-darwin20-gcc-10 and x86_64-apple-darwin20-g++-10 respectively, but when I try to build like this I get an error,

x86_64-apple-darwin20-g++-10: error: unrecognized command-line option '-stdlib=libc++'

This seems to be caused by using gcc rather than clang, but I thought gcc was the standard compiler for Rack. Any thoughts?

Again, thanks, my problem is solved because I can simply run arch -x86-64 make; I’m just trying to shore up gaps in my understanding.

1 Like

It was always my impression that “gcc” on the mac is just a front-end for clang that tries to make the command line options look the same. But maybe there is some “real” gcc? In any case the normal way of building VCV plugins on rack does (I’m pretty sure?) use the “built-in” gcc that just drives clang.

Good to hear it!

From one of the wizzards:

In the Mac environment, “gcc” is just a wrapper for clang, so you should be OK.

You should follow the guide at Building — VCV Rack documentation

Mac

Install Homebrew, and install build dependencies: brew install git wget cmake autoconf automake libtool jq python

1 Like