Skip to content

Instantly share code, notes, and snippets.

@jcfr
Last active February 1, 2025 14:59
Show Gist options
  • Save jcfr/487f5d846bc86e374969be5565c6d95e to your computer and use it in GitHub Desktop.
Save jcfr/487f5d846bc86e374969be5565c6d95e to your computer and use it in GitHub Desktop.
Scripts for building Slicer on Ubuntu ARM aarch64

Slicer on ARM aarch64

These scripts were initially created to support building Slicer on ARM aarch64 associated with NVIDIA IGX running Ubuntu.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.4 LTS
Release:	22.04
Codename:	jammy
$ uname -m
aarch64
$ 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

Download scripts

Assuming we build Slicer and related projects in ~/Projects:

  1. Download scripts
mkdir -p ~/Projects
git clone [email protected]:487f5d846bc86e374969be5565c6d95e.git ~/Projects/scripts
  1. Prepare scripts
cp ~/Projects/scripts/build-* ~/Projects

Run scripts

  1. Build CTKAppLauncher
./build-CTKAppLauncher.sh
  1. Build TBB
sudo apt-get install \
  hwloc \
  libhwloc-dev
./build-tbb.sh
  1. Build Slicer
./build-Slicer.sh

License

It is covered by the Apache License, Version 2.0:

http://www.apache.org/licenses/LICENSE-2.0

#!/bin/bash
# SPDX-FileCopyrightText: 2025 Jean-Christophe Fillion-Robin <[email protected]>
# SPDX-License-Identifier: Apache-2.0
set -eo pipefail
script_dir=$(cd $(dirname $0) || exit 1; pwd)
err() { echo -e >&2 ERROR: $@\\n; }
die() { err $@; exit 1; }
#-----------------------------------------------------------------------------
build_type=Release
source_dir=$script_dir/CTKAppLauncher
build_dir=$script_dir/CTKAppLauncher-$build_type
install_dir=$script_dir/CTKAppLauncher-install
if [[ ! -d $source_dir ]]; then
git clone https://github.com/commontk/AppLauncher $source_dir
fi
echo "source_dir [$source_dir]"
echo "build_dir [$build_dir]"
NUMBER_OF_PHYSICAL_CORES=$(grep -c ^processor /proc/cpuinfo)
echo "Found $NUMBER_OF_PHYSICAL_CORES CPU cores"
cmake \
-DCMAKE_BUILD_TYPE:STRING=$build_type \
-DCTKAppLauncher_QT_VERSION:STRING=5 \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=$install_dir \
-S $source_dir \
-B $build_dir
cmake \
--build $build_dir --target install \
--parallel $NUMBER_OF_PHYSICAL_CORES
#!/bin/bash
# SPDX-FileCopyrightText: 2025 Jean-Christophe Fillion-Robin <[email protected]>
# SPDX-License-Identifier: Apache-2.0
set -eo pipefail
script_dir=$(cd $(dirname $0) || exit 1; pwd)
err() { echo -e >&2 ERROR: $@\\n; }
die() { err $@; exit 1; }
#-----------------------------------------------------------------------------
CTKAppLauncher_DIR=$script_dir/CTKAppLauncher-install
echo "CTKAppLauncher_DIR [$CTKAppLauncher_DIR]"
if [[ ! -d $CTKAppLauncher_DIR ]]; then
die "CTKAppLauncher_DIR does not exist"
fi
tbb_install_dir=$script_dir/tbb-install
TBB_DIR=$tbb_install_dir/lib/cmake/TBB
TBB_BIN_DIR=$tbb_install_dir/lib
TBB_LIB_DIR=$TBB_BIN_DIR
echo "TBB_DIR [$TBB_DIR]"
echo "TBB_BIN_DIR [$TBB_BIN_DIR]"
echo "TBB_LIB_DIR [$TBB_LIB_DIR]"
if [[ ! -d $TBB_DIR ]]; then
die "TBB_DIR does not exist"
fi
if [[ ! -d $TBB_BIN_DIR ]]; then
die "TBB_BIN_DIR does not exist"
fi
if [[ ! -d $TBB_LIB_DIR ]]; then
die "TBB_LIB_DIR does not exist"
fi
#-----------------------------------------------------------------------------
build_type=Release
source_dir=$script_dir/Slicer
build_dir=$script_dir/Slicer-$build_type
if [[ ! -d $source_dir ]]; then
git clone https://github.com/Slicer/Slicer $source_dir
fi
echo "source_dir [$source_dir]"
echo "build_dir [$build_dir]"
NUMBER_OF_PHYSICAL_CORES=$(grep -c ^processor /proc/cpuinfo)
echo "Found $NUMBER_OF_PHYSICAL_CORES CPU cores"
#-----------------------------------------------------------------------------
cmake \
-DCMAKE_BUILD_TYPE:STRING=$build_type \
-DSlicer_BUILD_EXTENSIONMANAGER_SUPPORT:BOOL=OFF \
-DSlicer_USE_SimpleITK:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DCTKAppLauncher_DIR:PATH=$CTKAppLauncher_DIR \
-DTBB_DIR:PATH=$TBB_DIR \
-DTBB_BIN_DIR:PATH=$TBB_BIN_DIR \
-DTBB_LIB_DIR:PATH=$TBB_LIB_DIR \
-S $source_dir \
-B $build_dir
cmake \
--build $build_dir \
--parallel $NUMBER_OF_PHYSICAL_CORES
#!/bin/bash
# SPDX-FileCopyrightText: 2025 Jean-Christophe Fillion-Robin <[email protected]>
# SPDX-License-Identifier: Apache-2.0
set -eo pipefail
script_dir=$(cd $(dirname $0) || exit 1; pwd)
err() { echo -e >&2 ERROR: $@\\n; }
die() { err $@; exit 1; }
#-----------------------------------------------------------------------------
if command -v hwloc-ls >/dev/null 2>&1; then
echo "Binary 'hwloc-ls' is available."
else
echo "Binary 'hwloc-ls' is not available. Considering running 'sudo apt-get install hwloc libhwloc-dev'\nSee https://uxlfoundation.github.io/oneTBB/GSG/next_steps.html#check-hwloc-on-the-system"
fi
#-----------------------------------------------------------------------------
build_type=Release
source_dir=$script_dir/tbb
build_dir=$script_dir/tbb-$build_type
install_dir=$script_dir/tbb-install
if [[ ! -d $source_dir ]]; then
git clone https://github.com/uxlfoundation/oneTBB.git $source_dir
fi
echo "source_dir [$source_dir]"
echo "build_dir [$build_dir]"
NUMBER_OF_PHYSICAL_CORES=$(grep -c ^processor /proc/cpuinfo)
echo "Found $NUMBER_OF_PHYSICAL_CORES CPU cores"
cmake \
-DCMAKE_BUILD_TYPE:STRING=$build_type \
-DCMAKE_INSTALL_PREFIX:PATH=$install_dir \
-DTBB_TEST:BOOL=OFF \
-S $source_dir \
-B $build_dir
cmake \
--build $build_dir --target install \
--parallel $NUMBER_OF_PHYSICAL_CORES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment