Investigate, document, and fix any issues related to building Slicer from source on ARM-based systems (e.g. Apple silicon or Nvidia linux systems).
During the Slicer Week, we plan to have a working 3D Slicer version on ARM architecture. This version will facilitate the use of Slicer for volume rendering and access to other modules with segmentation AI models for interaction with radiology copilots. We’ll have virtual (ssh) access to an IGX box for testing this and finding the gaps for a complete solution to ARM version of 3DSlicer.
$ uname -a
Linux demos-NVIDIA-IGX-Orin-Development-Kit 5.15.0-1012-nvidia-tegra-igx #12-Ubuntu SMP Wed Apr 24 15:57:28 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
$ cd ~/Projects
$ ./build-CTKAppLauncher.sh
[...]
[100%] Built target CTKAppLauncher
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /home/demos/Projects/CTKAppLauncher-install/bin/CTKAppLauncher
-- Up-to-date: /home/demos/Projects/CTKAppLauncher-install/CMake/ctkAppLauncher.cmake
-- Up-to-date: /home/demos/Projects/CTKAppLauncher-install/CMake/ctkAppLauncher-configure.cmake
-- Up-to-date: /home/demos/Projects/CTKAppLauncher-install/bin/CTKAppLauncherSettings.ini.in
-- Up-to-date: /home/demos/Projects/CTKAppLauncher-install/./CTKAppLauncherConfig.cmake
$ ./build-tbb.sh
[...]
[100%] Built target tbb
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /home/demos/Projects/tbb-install/lib/libtbb.so.12.15
-- Up-to-date: /home/demos/Projects/tbb-install/lib/libtbb.so.12
-- Up-to-date: /home/demos/Projects/tbb-install/lib/libtbb.so
[...]
$ ./build-Slicer.sh
[...]
[ 99%] No install step for 'Slicer'
[ 99%] Forcing configure step for 'Slicer'
[100%] Completed 'Slicer'
[100%] Built target Slicer
Next steps:
Building and running 3D Slicer on the NVIDIA IGX box (ARM architecture) involves several steps:
Qt: There are no Qt binary packages for arm64.
CTKAppLauncher This launcher is needed to set up Qt paths so that dynamically-loaded Qt libraries can be found. Since Qt paths are not set up for the launcher itself, the launcher has to be built statically (all the libraries has to be linked into the executable). We don’t build CTKAppLauncher executable as part of the Slicer build process because static linking of Qt libraries would require a paid Qt license. Link to comments
Threading Building Blocks (TBB) This has to be built agains the Qt version available on the system
VTK: VTK needs to be built with Qt and Python support on ARM.
CUDA Library Compatibility: Some Holoscan applications that rely on CUDA have shown instability due to library differences, leading to crashes when deallocating memory.
Long-term Maintenance: Maintaining these custom builds for ARM devices can pose a significant long-term effort unless a broader community helps to support and test the codebase.
Component Disabling: Some Qt components may need to be disabled due to build errors, potentially limiting functionality.
Note: 3D Slicer works on Mac with ARM architecture (Apple Silicon) primarily due to Apple’s Rosetta 2 translation layer, which allows x86_64 applications to run on ARM-based Macs36. This translation layer is not available on other ARM-based architectures like the NVIDIA IGX. While 3D Slicer is not yet natively compiled for ARM on Mac, the Rosetta 2 emulation is efficient enough to provide good performance. In contrast, other ARM-based systems like the IGX would require a native ARM build of 3D Slicer, which is not yet available.
This section provides instructions for building Slicer on x86 systems:
sudo apt update && sudo apt install git build-essential \
cmake cmake-curses-gui cmake-qt-gui \
libqt5x11extras5-dev qtmultimedia5-dev libqt5svg5-dev qtwebengine5-dev libqt5xmlpatterns5-dev qttools5-dev qtbase5-private-dev \
libxt-dev libssl-dev
mkdir ~/Slicers
cd ~/Slicers
git clone https://github.com/Slicer/Slicer.git
Locate the Qt installation. It is typically found in /opt/qt/. For example: /opt/qt/5.15.2/gcc_64/lib/cmake/Qt5
Run the following bash commands to set up the environment and build Slicer:
# Set variables
export Slicer_RELEASE_TYPE=Stable
export SLICER_CODE_PATH=/home/$USER/Slicers/Slicer
export SLICER_SUPERBUILD_PATH=/home/$USER/Slicers/SlicerR
export SLICER_BUILD_PATH=$SLICER_SUPERBUILD_PATH/Slicer-build
export NUMBER_OF_SLICER_COMPILATION_JOBS=2
# Create build directory
mkdir -p $SLICER_SUPERBUILD_PATH
cd $SLICER_SUPERBUILD_PATH
# Configure Slicer build
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DQt5_DIR:PATH=/opt/qt/5.15.2/gcc_64/lib/cmake/Qt5 $SLICER_CODE_PATH
# Build Slicer
time make -j$NUMBER_OF_SLICER_COMPILATION_JOBS
The effort to build 3D Slicer on ARM architecture is part of a broader initiative to expand the platform’s compatibility and leverage the capabilities of modern ARM-based systems. This project aligns with the growing trend of ARM adoption in various computing environments, from mobile devices to high-performance computing.