Hello Slicer Community,
I am encountering a linker error while building 3D Slicer from source on Apple Silicon. The build fails at approximately 51% during the
_freeze_importlibstep of the Python internal build.51%] Linking C executable _freeze_importlib
Undefined symbols for architecture arm64:
“_ffi_type_longdouble”, referenced from:
__ctypes_init_fielddesc in cfield.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
System & Toolchain Information:
Machine: Mac Studio (M1/M2/M3 Apple Silicon)
OS: macOS 14.x or 15.x (Sequoia/Sonoma)
Architecture: arm64
Python Version: 3.12.10 (as bundled in the Slicer SuperBuild)
CMake Version: 4.2.1
Build Generator: Unix Makefiles (attempting to switch to Xcode)
LibFFI: Homebrew version 3.5.2 is installed, but the build fails even with
Slicer_USE_SYSTEM_LibFFI:BOOL=OFF.Context: I have attempted to clear the
CMakeCache.txtand rebuild withSlicer_USE_SYSTEM_LibFFIset toOFFto force an internal build of LibFFI. However, the linker still seems to be struggling to find the_ffi_type_longdoublesymbol required by_ctypes. It appears that the linker might be picking up a system library or a Homebrew version that does not correctly export this symbol for the arm64 architecture.Question: Has anyone successfully resolved this architectural mismatch on Apple Silicon? Are there specific CMake flags or environment variables I should set to ensure Python links against a compatible version of LibFFI that supports
longdoubleon ARM64?Thank you for your help!