Hello everyone
I am trying to set up a Mac M1 for SuperCollider work and it is royally kicking my ass. I am opening this thread to help others (and myself) figure out some of the intricacies here.
Building plugins for Rosetta/X86
By default, when building plugins on an M1, the compiler will detect the ARM architecture. That sounds fine - but odds are, youve probably installed SuperCollider by downloading the prebuilt binary from supercollider.github.io. This will then run under Rosettas X86 compatibility layer and āthinkā it is running on a intel mac.
This works fine - but when you start compiling plugins, the compiler will detect ARM and create arm binaries for you, which will make SC say it cant open the plugin and it has wrong architecture.
Most plugins allow to pass -DCMAKE_OSX_ARCHITECTURES=x86_64
as a build flag to cmake to force the compiler to create the x86 version that works with your x86 version of SC.
As an example, heres how I built sc3 plugins like this:
git clone --recursive https://github.com/supercollider/sc3-plugins.git
cd sc3-plugins
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=$HOME/supercollider -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
cmake --build . --config Release
cmake --build . --config Release --target install
cp -av SC3plugins "$HOME/Library/Application Support/SuperCollider/Extensions"
Checking the architecture of a plugin binary
If you want to check whether or not a plugin has been compiled for arm or x86, you can use the file
command. eg. file SomePlugin.scx
- this will tell you whether it is arm or x86 architecture.
Compiling SuperCollider plugins using faust
If you are dependent on SuperCollider plugins written in Faust, you will run into some problems as well (eg by running SUPERCOLLIDER_HEADERS=$HOME/supercollider/include faust2supercollider some-faust-file.dsp
.
Again, the faust compiler will detect the ARM architecture and compile arm binaries which will mismatch with your SC if it isnt compiled for arm.
(and forget about using the online IDE for faust - the resulting binaries will be detected as malware by MacOS)
If you are running SuperCollider under Rosetta/x86 there is a (not so elegant) way to force faust2supercollider to compile correctly to that architecture my adding -arch x86_64
to the compilation options and make a new version of the script that explicitly forces to x86.
I have made such a version here:
Running natively on ARM
To be able to run it all arm natively, the only way I see to do it now is to compile SC from source:
# If xcode license has not been agreed to, cmake will output errors about compilers not being found.
# run:
# sudo xcode-select --reset
# sudo xcodebuild -license
git clone --recursive https://github.com/supercollider/supercollider.git
cd SuperCollider
brew install git cmake libsndfile readline qt5
brew install portaudio fftw
mkdir -p build
cd build
cmake -G Xcode -DCMAKE_PREFIX_PATH=`brew --prefix qt5` -DSUPERNOVA=ON ..
cmake --build . --target install --config RelWithDebInfo
And then, if succesful, compile all plugins again without the aforementioned build flag.
But, I am running into problems here: If anyone knows how to get over this hurdle, please let me know as I am desperately trying to figure this out.