# Slicer for Ubuntu arm64

**URL:** <https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459>\
**Category:** Development\
**Created:** [April 10, 2019, 9:30pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459 "2019-04-10T21:30:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 10, 2019, 9:30pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/1 "2019-04-10T21:30:05Z")

</div>

Notes on compilation efforts for compiling Slicer for arm64:

**Problem** : VTK does not compile.  
_Solution_:

- Set VTK\_OPENGL\_HAS\_EGL and VTK\_OPENGL\_HAS\_ES
- In `<SlicerDir>/SuperBuild/External_VTK.cmake` remove section that has `-DModule_vtkGUISupportQtOpenGL:BOOL=ON` in it
- Edit `QVTKOpenGLNativeWidget.cxx` to use `QOpenGLExtraFunctions` instead of `QOpenGLFunctions_3_2_Core`

**Problem** : CTKAPPLAUNCHER is a download of amd64  
_Solution_: Overwrite executable `<Slicer-build>/CTKAPPLAUNCHER/bin/CTKAppLauncher` with compiled executable from `<Slicer-build>/CTKAppLauncherLib-build/bin/CTKAppLauncher`

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [April 11, 2019, 2:41pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/2 "2019-04-11T14:41:12Z")

</div>

Thanks for the report.

Could you describe here:

- how you setup the build environment / toolchain ?
- in addition of the change described above, build options used ?

This would help improve the build system.

To enable others to reproduce the build, do you think a docker image could be added to [https://github.com/Slicer/SlicerBuildEnvironment/](https://github.com/Slicer/SlicerBuildEnvironment/) ?

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 11, 2019, 3:53pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/3 "2019-04-11T15:53:33Z")

</div>

For sure, I’m expect it to be a slog, so this post is just for my notes as well as other googlers. Build options are all default unless a note is present in the main post.

> To enable others to reproduce the build, do you think a docker image could be added to [GitHub - Slicer/SlicerBuildEnvironment: A repository of scripts to set up a Slicer build environment.](https://github.com/Slicer/SlicerBuildEnvironment/) ?

Of course, how can I create a docker image?

Platform is [FriendlyDesktop](http://wiki.friendlyarm.com/wiki/index.php/FriendlyDesktop_18.04_for_RK3399) for [NanoPC-T4](http://wiki.friendlyarm.com/wiki/index.php/NanoPC-T4).

Details:  
**Qt**  
Qt 5.10.0, provided in image.  
qtchooser cleaned up:

> pi@NanoPC-T4:~/devel/S4R$ qtchooser -qt=5.10 -print-env  
> QT\_SELECT=“5.10”  
> QTTOOLDIR=“/usr/local/Trolltech/Qt-5.10.0-rk64one-sdk/bin”  
> QTLIBDIR=“/usr/local/Trolltech/Qt-5.10.0-rk64one/lib”

**CMake**  
CMake 3.14.1 built from source (`make && sudo make install`)

**GCC**

> Using built-in specs.  
> COLLECT\_GCC=gcc  
> COLLECT\_LTO\_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/7/lto-wrapper  
> Target: aarch64-linux-gnu  
> Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu/Linaro 7.3.0-27ubuntu1~18.04’ --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu  
> Thread model: posix  
> gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 11, 2019, 4:56pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/4 "2019-04-11T16:56:30Z")

</div>

**Problem** : CTK fails to build  
Issue:

- QtOpenGLTimeMonitor is not available under GL ES2 (at least in 5.10.0)

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 16, 2019, 1:40pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/5 "2019-04-16T13:40:33Z")

</div>

PythonQt version under Slicer does not support OpenGL ES build.

_Solution_:  
Workaround by manually removing non-OpenGL ES classes. Future fix upgrade PythonQt version.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [April 16, 2019, 2:43pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/6 "2019-04-16T14:43:11Z")

</div>

Once I built Slicer on arm32. Please see [here](https://discourse.slicer.org/t/how-to-build-3d-slicer-for-raspberry/2843/4). I 'm surprised it 's so hard for arm64. Unfortunately, I don 't have any arm64 machine and can 't join in this effort. Good luck.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 16, 2019, 9:17pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/7 "2019-04-16T21:17:01Z")

</div>

With OpenGL (ES) hardware acceleration?

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [April 17, 2019, 7:02am UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/8 "2019-04-17T07:02:27Z")

</div>

> [@adamrankin](#):
>
> With OpenGL (ES) hardware acceleration

I doubt it, didn 't even pay attention to that. The build was not usable in practice, VTK GPU rendering did not work, even the slices were not shown in the views. I 'll try a new build paying attention to OpenGL ES some weekend.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 17, 2019, 1:27pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/9 "2019-04-17T13:27:54Z")

</div>

Yeah, that’s the kicker. I’m looking to produce a usable Slicer, hopefully.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 17, 2019, 8:28pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/10 "2019-04-17T20:28:08Z")

</div>

For VTK, enable VTK\_USE\_SYSTEM\_PNG, otherwise VTK builds libpng with NEON enabled.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 18, 2019, 2:12pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/11 "2019-04-18T14:12:27Z")

</div>

**Problem** : libarchive fails to build  
_Solution_: Add `#include <sys/sysmacros.h>` to `<SlicerBuild>/LibArchive/libarchive/archive_pack_dev.c`

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 18, 2019, 2:12pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/12 "2019-04-18T14:12:54Z")

</div>

**Problem** : zlib relocation errors  
_Solution_: where present, use system zlib (via `CMAKE_USE_SYSTEM_ZLIB`, `USE_BUILTIN_ZLIB`, `Slicer_USE_SYSTEM_zlib` depending on project)

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 18, 2019, 3:47pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/13 "2019-04-18T15:47:30Z")

</div>

**Problem** : python-setuptools fails

```auto
/opt/dev/S4R/python-install/bin/PythonSlicer: 5: /opt/dev/S4R/python-install/bin/PythonSlicer: Syntax error: Unterminated quoted string

CMake Error at /opt/dev/S4/CMake/ExternalProjectForNonCMakeProject.cmake:104 (message):
  python-setuptools: bootstrap step failed with exit code '2'.

```

_Solution_: Just another effect of CTKAppLauncher being the wrong architecture. See solution for `CTKAPPLAUNCHER is a download of amd64`

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 19, 2019, 10:18pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/14 "2019-04-19T22:18:55Z")

</div>

**Problem** : CTK fails to build  
Issue:  
PythonQt version under Slicer does not support OpenGL ES build.

- QtOpenGLTimeMonitor is not available under GL ES2 (at least in 5.10.0)

_Solution_ :  
In `CTK/CMakeExternals/PythonQt.cmake:34`, remove `gui` from the list of wrapped modules

_Hint_:  
Set `OpenGL_GL_PREFERENCE:STRING="GLVND"` in PythonQt project

_Notes_:  
My setup did not have Qt Designer built, so I disabled designer plugins in CTK.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 19, 2019, 11:30pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/15 "2019-04-19T23:30:35Z")

</div>

**Problem**  
SimpleITK compilation crashes (NanoPC-T4, 4GB ram, gcc 7.3)

_Solution_:  
Disable SimpleITK  
Possibly cross-compile if it’s a memory issue?

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 20, 2019, 2:36am UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/16 "2019-04-20T02:36:21Z")

</div>

Disable all designer plugins for Slicer if designer is not available. `-DSlicer_BUILD_QT_DESIGNER_PLUGINS:BOOL=OFF`

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 20, 2019, 2:44am UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/17 "2019-04-20T02:44:16Z")

</div>

Slicer wants `vtkGUISupportQtOpenGL`, see if workaround `vtkGUISupportQt` is enough

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [April 20, 2019, 2:29pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/18 "2019-04-20T14:29:30Z")

</div>

Just for information

I rebuilt Slicer on Odroid XU4 with a 32-bit ARM CPU. A clean build succeeded with this cmake config line :

> #! Setting -DADDITIONAL\_CXX\_FLAGS -DCMAKE\_C\_FLAGS -DCMAKE\_CXX\_FLAGS is not sufficient.  
> #! export is required for python to build here  
> export CFLAGS=-I/usr/include/tirpc  
> export CXXFLAGS=-I/usr/include/tirpc; cmake -DSlicer\_VTK\_VERSION\_MAJOR:INT=8 -DQt5\_DIR:PATH=/usr/lib/cmake/Qt5 -DSlicer\_USE\_PYTHONQT\_WITH\_OPENSSL:BOOL=0 -DBUILD\_TESTING:BOOL=0 -DCMAKE\_BUILD\_TYPE:STRING=Release -DSlicer\_USE\_SimpleITK:BOOL=0 …/Slicer

With a quick test, only one functionality is missing : viewing slices in 2D slice views ! With or without mali drivers. Volume rendering, segmention models show up. Slice data is visible in the 3D view, in the zoom preview (bottom left) but not in the RYG views. Would it really be an OpenGL ES problem ? I won’t insist of course, was just an experiment.

 ![slicer_odroid_xu4](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/e/de738f6dc9870f318d5b744ff831500ceb5efb5c.png)

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 20, 2019, 2:49pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/19 "2019-04-20T14:49:37Z")

</div>

Does that machine/setup have OpenGL drivers for the Mali? If so, that simplifies things tremendously. Otherwise your setup is doing Mesa (software) rendering.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [April 20, 2019, 3:11pm UTC](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459/20 "2019-04-20T15:11:51Z")

</div>

Looks like no, OpenGL ES 3.1. Would you check your VTK build to see if `VTK_USE_OPENGL_ES` is `ON`?

[Next page](https://discourse.slicer.org/t/slicer-for-ubuntu-arm64/6459.md?page=2)
