Slicer for Ubuntu arm64

(SET) #21

This Arch Linux for ARM (gcc 8.2) setup provides the following mali drivers :

libEGL.so.1.4, libGLESv1_CM.so.1.1, libGLESv2.so.2.0, libOpenCL.so.1.1, libmali.so

They are installed, nevertheless, the 2D views remain black. Didn’t find any OpenGL ES 3.x driver.

I tried to specify VTK_OPENGL_HAS_EGL, but VTK-build/CMakeCache.txt reported :

//The OpenGL library being used supports EGL
VTK_OPENGL_HAS_EGL:BOOL=OFF

So I just removed that flag during configure.

Perhaps this system is missing some library during build or at runtime.

(Adam Rankin) #22

Compiled! Trying to run, and the install for libs is <prefix>/lib/Slicer-4.11/libXYZ.so. If I configure <prefix>/lib (I have other programs installed in that prefix) under /etc/ld.so.conf.d/myconf.conf, it doesn’t seem to pickup subdirectories. Do I have to add Slicer-4.11 as a folder in my ld config?

(Adam Rankin) #23

And CTK libs are not installed… @jcfr to install Slicer from build tree is it simply make install from <SlicerSuperBuild>\Slicer-build ?

(Andras Lasso) #24

Do not install. Slicer can be launched from the build tree or you can create a self-contained package by building the PACKAGE target.

1 Like
(Adam Rankin) #25

Somehow I broke my GPU driver installation. Trying to sort that out, but then I think it will work!

(Adam Rankin) #26

Driver installation was not the problem. I don’t understand the linux graphics cluster&#!^%.

I am down to
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

(SET) #27

Does Slicer start at least ? Can you load a volume ? See the slices ? Do a quick volume rendering ? A segmentation ? Not that I’ll be able to help, just to know your actual results.

(Adam Rankin) #28

No, Slicer doesn’t even start. abnormal exit (may make a Debug build to get more information).

(Adam Rankin) #29

I am investigating my VTK build. OPENGL_gl_PREFERENCE was set to LEGACY. Switching to GLVND now (no idea what this does, but hey!).

Also, updated VTK include and libs to use vendor provided EGL/GLES libraries (libmali.so symlinked)

(Jean Christophe Fillion Robin) #30

Reading the message associated with this commit should help understand: https://github.com/Slicer/Slicer/commit/245097a63c7e24eed5db95fa89b15c227b6f6ccb

Also copied below for convenience:

 BUG: Fix linux package removing dependency to GLVND libraries

By setting OpenGL_GL_PREFERENCE to LEGACY, this commit ensures that
the applications and libraries are linked against libGL.so (legacy) instead
of libOpenGL.so and libGLX.so (GL Vendor Neutral Dispatch library). It allows
to run the application on system where only libGL is available.

It fixes a regression introduced in r27988 (COMP: Update CMake minimum required
version from 3.5 to 3.13) after which one CMP0072 was set to NEW and led to
have the GLVND libraries being used by default.

Detailed explanation about GLVND (thanks @chuckatkins):
libOpenGL.so and libGLX.so are actually just the stub GLVND interface
libraries with no implementation behind them. GLVND uses a config file
to locate and dlopen the implementation at runtime like a plugin
(/usr/lib64/libGLX_nvidia.so.418.39 for instance).
So it's not really suitable for redistribution unless an implementation
like a glvnd-enabled mesa and associated config files are also packaged.
For broad redistributability, it is preferable to use use the legacy libGL
for now so at runtime it will be available on most systems.
That will likely need to be the case for the next few years until
the non-glvnd implementations are much less common.

Co-authored-by: Chuck Atkins <chuck.atkins@kitware.com>
(Adam Rankin) #31

Removing any mention of libGL.so in VTK cmake. gl2ps (and related projects) have to be removed by editing their CMakeLists.txt or module.cmake. Currently VTK checks for if(ANDROID or IOS) which isn’t correct.

Remaining undefined references

/opt/dev/S4R/VTK-build/lib/libvtkOpenGL-8.2.so.1: undefined reference to `glGetTexImage'
/opt/dev/S4R/VTK-build/lib/libvtkOpenGL-8.2.so.1: undefined reference to `glTexImage1D'
/opt/dev/S4R/VTK-build/lib/libvtkOpenGL-8.2.so.1: undefined reference to `glGetDoublev'
/opt/dev/S4R/VTK-build/lib/libvtkOpenGL-8.2.so.1: undefined reference to `glClearDepth'
/opt/dev/S4R/VTK-build/lib/libvtkOpenGL-8.2.so.1: undefined reference to `glDrawBuffer'
(Adam Rankin) #32

Disabling BUILD_TESTING in Slicer removes more undefined references.

(Adam Rankin) #33

To expand, you can simplify this by changing
<Slicer-build>VTK\CMake\vtkOpenGL.cmake:134

from

find_library(OPENGL_gl_LIBRARY NAMES GLESv3)
to
find_library(OPENGL_gl_LIBRARY NAMES GLESv3 GLESv2)
(GLESv3 is an android specific library name, libGLESv2 on linux actually contains v3 functions)

To disable gl2ps:
<Slicer-build>\VTK\ThirdParty\gl2ps\module.cmake
<Slicer-build>\VTK\Rendering\GL2PSOpenGL2\module.cmake
<Slicer-build>\VTK\IO\ExportOpenGL2\module.cmake
have them return immediately, up to you if you change the if condition or just remove the if condition.

<Slicer-build>VTK\IO\Export\module.cmake
change/remove the if condition so that the depends variable is left blank (equivalent to ANDROID or APPLE_IOS condition met)
<Slicer-build>VTK\IO\Export\CMakeLists.txt
comment out or remove vtkGL2PSExporter.cxx

(Adam Rankin) #34

Docker image (I think):
https://cloud.docker.com/u/adamrankin/repository/docker/adamrankin/slicer4arm

Edit: wait for next tag, many dependencies I mounted to local drives. Moving into container now.

(SET) #35

After reading the above, I installed qt5-xcb-private-headers and xcb-util-cursor, then rebuilt everything. Now the slices are displayed in the 2D views.

Nice hint, thanks.

1 Like
(Adam Rankin) #36

Ok, so trying to build VTK with GLES doesn’t seem to work. I have no idea how they do it for Android.

vtkRenderingContextOpenGL2 relies on OpenGL defines and functions. @jcfr do you think anyone at Kitware would have any use for this use-case (single-board computers with GPU acceleration)?

(Adam Rankin) #37

Did some workarounds by substituting closest GLES equivalent (GL_LINE vs GL_LINES, etc…) and commenting out some gl points logic/functions.

(Adam Rankin) #38

In <Slicer>/Libs/vtkAddon/CMakeLists.txt
remove section that includes OpenGL classes

In Slicer CMake, disable tests BUILD_TESTING:BOOL=OFF

In VTK, defined OPENGL_ES_VERSION:STRING=3.0 (maybe 3.2 would work? my system has headers for 3.2)

(Adam Rankin) #39

in <Slicer>/Libs/MRML/Widgets/qMRMLPlotView.cxx::saveAsSVG comment out contents of function

(Adam Rankin) #40

Developer provided docker image