Building on Apple Silicon (M1) Macs

If the native extensions are built for one version of Ruby, but the app loads by running a different version of Ruby, maybe that’s a problem?

Ok, this sounds like fairly reasonable behaviour. Very glad to see that all the other processes shut down on their own, that’s the new daemon zombie killer script in fully gory action!

I think the issue you’re seeing is with the GUI in M1 compatible mode. It may possibly be due to boost issues with a non-M1-native SuperCollider - it might be a Qt issue or something else, but at least we’re getting closer!

1 Like

Good call, but it’s unlikely an issue now we’re not really using any native extensions in Ruby except for the Rugged stuff which is non-essential at this stage.

1 Like

Sorry to report lack of progress; haven’t had much time to work on this. The idea to use the Python script aqt to semi-automatically pull Qt 5/6 failed on both Mac and Raspbian, because the ARM architecture version is not there.

1 Like

Just a heads up regarding my recent work successfully creating an Apple Silicon build of Sonic Pi - Sonic Pi for Apple Silicon

1 Like

Does this mean the dev branch build should work out of the box on an M1 mac?
I tried it (at commit 71f0796) and I get a warning from mac-config.sh:

    CMake Warning:
    Manually-specified variables were not used by the project:
    CMAKE_OSC_ARCHITECTURES

And then mac-build-gui.sh fails:

ld: warning: ignoring file .../app/build/aubio-package/lib/libaubio.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

And I see that many .o files in the build directory were built for x64:

file $(find build -name *.o)
build/CMakeFiles/3.26.3/CompilerIdC/CMakeCCompilerId.o:                                                      Mach-O 64-bit object arm64
build/CMakeFiles/3.26.3/CompilerIdCXX/CMakeCXXCompilerId.o:                                                  Mach-O 64-bit object arm64
build/external/sp_midi-prefix/src/sp_midi-build/CMakeFiles/libsp_midi.dir/external_libs/rtmidi/RtMidi.cpp.o: Mach-O 64-bit object x86_64
build/external/sp_midi-prefix/src/sp_midi-build/CMakeFiles/libsp_midi.dir/src/utils.cpp.o:                   Mach-O 64-bit object x86_64
...lots more files saying x86_64

It looks like the -DCMAKE_OSC_ARCHITECTURES="ARM64" setting in mac-config.sh is ignored.

Yep, it should do.

Are you working with a completely clean checkout?

Yes, that’s what I did - new git clone and then build.
Here’s the output of ./mac-config.sh in case it’s useful:

-- CMakeLists: Sonic Pi
-- TARGET_MAC
-- System: Darwin-21.3.0
-- Compiler: AppleClang
-- Compiler Version: 13.1.6.13160021
-- Debug Flags: -g -D_DEBUG -DDEBUG
-- Release Flags: -O3 -DNDEBUG
-- Externals Builder
-- USE_SYSTEM_LIBS: OFF
-- ImGui Interface: ON
-- CMakeLists: Sonic Pi Qt GUI
-- Setting prefix to Homebrew's Qt install location: /usr/local/opt/qt@5
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
-- App Root: /Users/bert/workspace/xxx/3upstream-sonic-pi/app
-- Configuring done (1.7s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/bert/workspace/xxx/3upstream-sonic-pi/app/build

Hi there,

please could you raise an issue on GitHub to continue this discussion. I’d prefer to keep these forums for discussing the usage of Sonic Pi - building it is only for people interested in contributing to development and definitely not anything most people should be trying to do. Most people should be just downloading and using the pre-built versions of Sonic Pi found on the website :slight_smile:

Ok, I’ll create an issue!

1 Like

Issue created, Build fails on Apple Silicon: attempting to link with file built for macOS-x86_64 · Issue #3284 · sonic-pi-net/sonic-pi · GitHub

2 Likes