Build Slicer in apple silicon - error "arm64"

Hi all,

During the build process as per Steve’s advice, #5944
I encountered the following issue. Has anyone resolved this?

Computer Specifications:

  • CPU: M1 Pro
  • OS: macOS Ventura
  • Xcode: 13.0

Process:

  1. Installed Qt5 and CMake using Homebrew.
brew install qt@5
brew install cmake
  1. Build OpenSSL:
git clone https://github.com/openssl/openssl.git openssl-git
cd openssl-git
./Configure darwin64-arm64-cc --prefix="/tmp/openssl-arm" no-asm
make && make install
mv OpenSSL-install OpenSSL-install-orig
ln -s /tmp/openssl-arm ./OpenSSL-install

3.Configured using CMake command:

sudo cmake \
  -DCMAKE_OSX_ARCHITECTURES=arm64 \
  -DCMAKE_BUILD_TYPE:STRING=Debug \
  -DSlicer_USE_SYSTEM_OpenSSL:BOOL=ON \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DSlicer_BUILD_DICOM_SUPPORT:BOOL=OFF \
  -DQt5_DIR:PATH=/opt/homebrew/Cellar/qt@5/5.15.13_1/lib/cmake/Qt5 \
  /opt/T/S
  1. Change cmakelists relates to ffi
+       message("skipping ctypes on mac")
+        #add_python_extension(_ctypes
+            #SOURCES ${ctypes_COMMON_SOURCES}
+                    #_ctypes/malloc_closure.c
+                    #_ctypes/darwin/dlfcn_simple.c
+                    #_ctypes/libffi_osx/ffi.c
+                    #_ctypes/libffi_osx/x86/darwin64.S
+                    #_ctypes/libffi_osx/x86/x86-darwin.S
+                    #_ctypes/libffi_osx/x86/x86-ffi_darwin.c
+                    #_ctypes/libffi_osx/x86/x86-ffi64.c
+            #INCLUDEDIRS ${SRC_DIR}/Modules/_ctypes/libffi_osx/include
+                        #${SRC_DIR}/Modules/_ctypes/darwin

Then, I got the error like this

"tbb::detail::r1::terminate(tbb::detail::d1::task_arena_base&)", referenced from:
    tbb::detail::d1::task_arena::terminate() in vtkSMPToolsImpl.cxx.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I haven’t tried building on mac arm in a long time, so more recent changes in the dependencies may have broken things.

One idea is to turn off this flag: