Creating a Slicer binary for Apple Silicon M1

Hello!
I am trying to create a binary of a custom application based on Slicer for Apple Silicon M1. I have managed built Qt5 (using this tutorial) and installed the other prerequisites. However, when I try building Slicer, I get the following errors:

Here is the cmake command I am using :

cmake \  
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.1 \
-DSlicer_USE_SYSTEM_OpenSSL:BOOL=ON \
-DQt5_DIR:PATH=/Users/efu/qt5-5.15-macOS-release/qtbase/lib/cmake/Qt5 \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DOPENSSL_ROOT_DIR:PATH=/opt/homebrew/opt/openssl/ \
/Users/efu/Slicer

Has anyone come across this problem? Is there a way to fix it?

Thank you!

That’s a python build error so it should be fixable. You may be able to use the system python, or get a (newer?) python and edit this file and related places.

You will no doubt hit more issues when you get to CTK and the Slicer core codebase. It would be great if you could start a draft pull request with any changes you need to make to the Slicer build system so other people can test / contribute.

Thank you! Will using the system python prevent me from creating a functional binary? I am a bit confused about what can be installed directly using homebrew and what has to be built “by hand”.

It might but probably it can be packaged like any python build. Best would be to find a way to build from source using a version that works on the target architecture.

As you’ve seen the Slicer build system is big and it depends on several other large projects so it make take a while to port everything.

1 Like