# Build Error: \_ffi\_type\_longdouble symbol not found for arm64 during Python build

**URL:** <https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650>\
**Category:** Development\
**Created:** [January 1, 2026, 10:40am UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650 "2026-01-01T10:40:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![salim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/salim/32/80773_2.png) [@salim](https://discourse.slicer.org/u/salim)\
**Post date:** [January 1, 2026, 10:40am UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/1 "2026-01-01T10:40:42Z")

</div>

**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_importlib` step 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.txt` and rebuild with `Slicer_USE_SYSTEM_LibFFI` set to `OFF` to force an internal build of LibFFI. However, the linker still seems to be struggling to find the `_ffi_type_longdouble` symbol 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 `longdouble` on ARM64?
> 
> Thank you for your help!

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 1, 2026, 1:40pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/2 "2026-01-01T13:40:23Z")

</div>

Currently macOS arm64 builds are not supported. There are still some remaining items to fix as you discovered. You can however build on an Apple Silicon Mac by building the application as x86\_64 and running it using Rosetta 2.

See the following issue and other discourse thread about current state of things:

> <https://github.com/Slicer/Slicer/issues/6811>
>
> This is meta issues aiming to organize the sub-tasks associated with arm64 suppo…rt. See Sub-issues listed below.
> 
> 
> Related issues and pull requests:
> \* https://github.com/Slicer/Slicer/issues/5944
> \* https://github.com/Slicer/Slicer/issues/6705
> \* https://github.com/Slicer/Slicer/issues/6490
> \* https://github.com/Slicer/Slicer/pull/8097
> 
> Related discourse posts:
> \* https://discourse.slicer.org/t/issues-running-slicer-on-macbook-m1-max/23974/3
> \* https://discourse.slicer.org/t/slicer-quit-unexpectedly-on-macbook-with-m1-chip/25989
> \* https://discourse.slicer.org/t/build-arm-32-openssl/31204
> \* https://discourse.slicer.org/t/developing-for-slicer-on-apple-silicon-build-targeting-x86-64/40686

> [@Build 3D Slicer for MacOS arm64?](https://discourse.slicer.org/t/build-3d-slicer-for-macos-arm64/35699):
>
> PyTorch has support for using the shaders in the M series chips, but to use it, one has to use the arm64 version of Python. Should a native (in this case, M3) build of Slicer3D be possible? If yes, where should I get the 5.15.2 Qt package (for MacOS arm64)? Thank you! Gene

---

<div class="post-metadata">

**Author:** ![GeneRisi](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@GeneRisi](https://discourse.slicer.org/u/GeneRisi)\
**Post date:** [January 1, 2026, 3:40pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/3 "2026-01-01T15:40:42Z")

</div>

I looked up longdouble for both ARM64 and x86\_64 architectures and what I found is that the actual implementation is hardware, compiler and OS specific. Longdouble can be 80 bits in the calculations padded to 128 bits in memory, or 128 bits, or 64 bits and treated the same as double. I don’t know if all of the scenarios are handled in the build process.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 1, 2026, 4:57pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/4 "2026-01-01T16:57:44Z")

</div>

Slicer’s version of libffi needs updating along with other things to support native arm64 builds. For now building on Apple Silicon is possible, but you must build the application as x86\_64 instead of arm64.

---

<div class="post-metadata">

**Author:** ![salim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/salim/32/80773_2.png) [@salim](https://discourse.slicer.org/u/salim)\
**Post date:** [January 6, 2026, 10:21am UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/5 "2026-01-06T10:21:22Z")

</div>

Thank you @jamesobutler for the clarification regarding the current state of macOS arm64 support.  
Based on the guidance, I am building **3D Slicer as x86\_64 on Apple Silicon and running it under Rosetta 2**.

I am working on a **custom 3D Slicer application** , and below are the **exact commands and configuration** I am using, followed by the **errors I am encountering**.

* * *

### 🛠 Build environment

- **macOS** : 14.x (Apple Silicon, Mac Studio)

- **Architecture** : x86\_64 (Rosetta 2)

- **Xcode** : Installed from `/Applications/Xcode.app`

- **Qt** : 5.15.2 (clang\_64)

- **CMake** : system-installed

- **Custom Slicer build**

* * *

### 🧾 CMake configuration used

```auto
cd ~/Slicer-Build

# Clean previous build
rm -rf Slicer-build

cmake \
  -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 \
  -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=14.0 \
  -DCMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DQt5_DIR:PATH=/opt/Qt/5.15.2/clang_64/lib/cmake/Qt5 \
  -DSlicer_USE_SYSTEM_QT:BOOL=ON \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DSlicer_USE_PYTHONQT:BOOL=OFF \
  -DSlicer_USE_PYTHON:BOOL=ON \
  -S ~/Slicer-Source \
  -B .

```

* * *

### 🏗 Build command

```auto
cmake --build . -j4 2>&1 | tee build.log

```

When attempting to build Python explicitly:

```auto
cmake --build . --target python -j4 2>&1 | tee python-build.log

```

* * *

### ❌ Build errors encountered

During the build, I encounter the following error related to Python headers:

```auto
/Users/archiwizstudio/Slicer-Source/Base/QTCore/qSlicerCoreApplication.cxx:1216:8:
error: unknown type name 'Py_ssize_t'; did you mean 'ssize_t'?

```

Additional output:

```auto
[47%] Built target qMRMLWidgets
make[3]: *** [all] Error 2
make[2]: *** [Slicer-prefix/src/Slicer-stamp/Slicer-build] Error 2
make[1]: *** [CMakeFiles/Slicer.dir/all] Error 2
make: *** [all] Error 2

```

Attempting to build the Python target directly results in:

```auto
make: *** No rule to make target `python'. Stop.

```

* * *

### 🔍 CMake cache confirmation

```auto
grep -i "Slicer_USE_PYTHON" CMakeCache.txt

```

Output:

```auto
Slicer_USE_PYTHON:BOOL=ON
Slicer_USE_PYTHONQT:BOOL=OFF

```

No Python include or library paths appear to be populated:

```auto
grep -i "PYTHON" CMakeCache.txt | grep -i "DIR\|INCLUDE\|LIBRARY"

```

* * *

### ❓ Questions

1. Is this Python error (`Py_ssize_t` not found) expected when using **system Python** with `Slicer_USE_PYTHON=ON`?

2. Is it required to use **Slicer SuperBuild–provided Python** instead of system Python on macOS?

3. Are there **recommended Python versions** (e.g., 3.9 / 3.10) known to work reliably for x86\_64 Rosetta builds?

4. Does this configuration depend on a **specific Xcode version** for successful Python integration?

Any guidance or recommended build scripts for resolving Python-related build issues on Apple Silicon (x86\_64 via Rosetta) would be greatly appreciated.  
this is the systmem information  
System

OS: macOS 26.2  
Build: 25C56  
Kernel: Darwin 25.2.0  
Machine Architecture: arm64  
Rosetta Translation: NO (sysctl.proc\_translated = 0)

## Xcode

Xcode Version: 26.2  
Xcode Build: 17C52  
Xcode Path: /Applications/Xcode.app/Contents/Developer  
macOS SDK: MacOSX26.2.sdk  
SDK Version: 26.2

## Compiler

Compiler: Apple clang  
Version: 17.0.0 (clang-1700.6.3.2)  
Target: arm64-apple-darwin25.2.0  
clang Binary: Universal (x86\_64 + arm64e)

## Build Tools

CMake Version: 4.2.1  
CMake Provider: Kitware  
Make Version: GNU Make 3.81  
Make Binary: Universal (x86\_64 + arm64e)  
Ninja Version: 1.13.2  
Ninja Binary: arm64 (/opt/local/bin/ninja)

## Qt

Qt Version: 5.15.2  
QMake Version: 3.1  
Qt Path: /opt/Qt/5.15.2/clang\_64  
Qt Architecture: x86\_64  
Qt5Core: /opt/Qt/5.15.2/clang\_64/lib/libQt5Core.dylib

## Python

python: not found  
python3 Version: 3.14.2  
python3 Path: /opt/homebrew/bin/python3  
Python Architecture: arm64

## Git

Git Version: (not reported)  
Repository: Slicer (custom build)

## Slicer Configuration (relevant flags)

Slicer\_USE\_PYTHON: ON  
Slicer\_USE\_PYTHONQT: OFF  
Slicer\_USE\_SYSTEM\_QT: ON

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 6, 2026, 12:18pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/6 "2026-01-06T12:18:38Z")

</div>

As a first try you should let the Slicer super build build all the dependencies it wants including the python version which becomes an embedded python in the application. It will have to build an x86\_64 python for use in this x86\_64 application.

The following linked post was a good one that helped me build an x86\_64 build on arm mac successfully.

> [@Developing for Slicer on Apple Silicon (build targeting x86\_64)](https://discourse.slicer.org/t/developing-for-slicer-on-apple-silicon-build-targeting-x86-64/40686/6):
>
> This is really helpful @jamesobutler , kudos!

The Slicer factory build machine builds successfully on macOS with the following environment:

> [@Maintenance of macOS dashboard in progress - upgrading from Ventura to Sequoia](https://discourse.slicer.org/t/maintenance-of-macos-dashboard-in-progress-upgrading-from-ventura-to-sequoia/44950/4):
>
> Updates: XCode has been updated to 26.1 and clang version is now 17.0.0. Issue related to the build of Qt 5.15.18 should now all be sorted our and the build is in progress rocket For more details: [[5.15.18] Fix detection of OpenGL Qt backend and OpenSSL linkage on macOS by jcfr · Pull Request #80 · commontk/qt-easy-build · GitHub](https://github.com/commontk/qt-easy-build/pull/80)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 6, 2026, 2:14pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/7 "2026-01-06T14:14:09Z")

</div>

This is unlikely to work:

> -DSlicer\_USE\_PYTHONQT:BOOL=OFF \

I doubt that path is ever tested since PythonQt is pretty central to most Slicer use cases.

---

<div class="post-metadata">

**Author:** ![salim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/salim/32/80773_2.png) [@salim](https://discourse.slicer.org/u/salim)\
**Post date:** [January 12, 2026, 10:40am UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/8 "2026-01-12T10:40:54Z")

</div>

Hello @jamesobutler @pieper

I’m trying to build **3D Slicer on macOS (x86\_64)** using **Xcode 16.1** and the **macOS 15 SDK** , and I’m currently facing linker errors related to Qt during the VTK build stage.

At the moment, I **do not have Qt built from source** , as I couldn’t find an easily available source/build setup for macOS. I am currently using **Qt 5 from Homebrew (`brew install qt@5`)**.

Since I am **new to macOS development** , I’m not sure whether using **Homebrew’s Qt5** is appropriate for building 3D Slicer, or if this could be the cause of the Qt symbol/linker issues I’m seeing.

### Questions:

1. Is **Homebrew Qt5 (`qt@5`)** supported or recommended for building 3D Slicer on macOS?

2. If not, what is the **recommended way to obtain Qt 5.15.2** for macOS (prebuilt binaries or building from source)?

3. For those who have successfully built Slicer on macOS, could you please share:

4. Are there any **known compatibility issues** between **Qt 5.15.x** and **Xcode 16.x / macOS 15 SDK**?

Any guidance, commands, or references would be very helpful, especially from someone who has already completed a successful macOS build.

Thank you very much for your help.

Best regards,  
**Salim Ullah**

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 12, 2026, 3:17pm UTC](https://discourse.slicer.org/t/build-error-ffi-type-longdouble-symbol-not-found-for-arm64-during-python-build/45650/9 "2026-01-12T15:17:36Z")

</div>

I haven’t built from source on a mac recently, and when I tried to rebuild a previous build with the current Slicer source there were errors (I don’t recall the specifics). So I suspect with the ongoing changes in the OS, xcode, cmake, python, homebrew, and Slicer source it’s possible that there is no currently working build formula for any particular machine. I know that the script below did work, maybe a year ago with whatever OS and xcode were current at the time.

```auto
BUILD_TYPE=Debug
#BUILD_TYPE=Release

CMAKE=/Users/pieper/Downloads/cmake-3.31.7-macos10.10-universal/CMake.app/Contents/bin/cmake

${CMAKE} \
	-DSlicer_VTK_VERSION_MAJOR:STRING=9 \
	-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} \
	-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
	-DQt5_VERSION:STRING=5.15 \
	-DQt5_DIR:PATH=/usr/local/Cellar/qt@5/5.15.17/lib/cmake/Qt5 \
	/Users/pieper/slicer/latest/Slicer

```

Personally I’ve been waiting for things to settle down before trying to build again. It would be great if you can work through and get a working combination.
