Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux ARM64 support #613

Open
camlloyd opened this issue Dec 16, 2024 · 1 comment
Open

Linux ARM64 support #613

camlloyd opened this issue Dec 16, 2024 · 1 comment

Comments

@camlloyd
Copy link

camlloyd commented Dec 16, 2024

Currently, sciview does not initialize on Linux ARM64.
I wanted to try and get this working, but this is my first time looking at both sciview and scenery, so any advice is appreciated.
Hopefully, this is a starting point.

To reproduce:

  1. Download the 20241022 bundle of Fiji-future for Linux ARM64.

  2. Enable the sciview update site.

  3. Run Plugins > sciview

You should be met by an error similiar to the following (at least after line 5...)

Log ❌
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/pi/Downloads/Fiji-Future.app/jars/logback-classic-1.2.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/pi/Downloads/Fiji-Future.app/jars/slf4j-simple-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Started application as PID 2799 on LINUX/ARM64
imagej-launcher version bigger that non-working version (6.0.2 vs. 4.0.5), all good.
This is sciview 0.4.1-SNAPSHOT (c4f9319) / scenery 0.11.2 (408f011).
[LWJGL] Platform/architecture mismatch detected for module: org.lwjgl
	JVM platform:		Linux aarch64 21.0.5
		OpenJDK 64-Bit Server VM v21.0.5+11-LTS by Azul Systems, Inc.
	Platforms available on classpath:
		linux/x64
		macos/arm64
		windows/x64
[LWJGL] Failed to load a library. Possible solutions:
	a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
	b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
java.util.concurrent.ExecutionException: graphics.scenery.backends.RendererUnavailableException: Vulkan unavailable due to an UnsatisfiedLinkError (null, Failed to locate library: liblwjgl.so), this could be due to the Vulkan runtime not being installed, or a missing dependency.
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at sc.iview.DefaultSciViewService.makeSciView(DefaultSciViewService.java:127)
	at sc.iview.DefaultSciViewService.getOrCreateActiveSciView(DefaultSciViewService.java:175)
	at sc.iview.commands.LaunchViewer.run(LaunchViewer.kt:60)
	at org.scijava.command.CommandModule.run(CommandModule.java:196)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: graphics.scenery.backends.RendererUnavailableException: Vulkan unavailable due to an UnsatisfiedLinkError (null, Failed to locate library: liblwjgl.so), this could be due to the Vulkan runtime not being installed, or a missing dependency.
	at graphics.scenery.backends.Renderer$Companion.createRenderer(Renderer.kt:292)
	at graphics.scenery.backends.Renderer$Companion.createRenderer$default(Renderer.kt:257)
	at sc.iview.ui.SwingMainWindow._init_$lambda$1(SwingMainWindow.kt:276)
	at sc.iview.ui.SwingMainWindow.<init>(SwingMainWindow.kt:320)
	at sc.iview.SciView.init(SciView.kt:409)
	at graphics.scenery.SceneryBase.main(SceneryBase.kt:485)
	at sc.iview.DefaultSciViewService.lambda$makeSciView$0(DefaultSciViewService.java:114)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$1(DefaultThreadService.java:233)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	... 4 more

It looks like, at the very least, we need to do the following:

scenery (upstream):

  1. Add natives-linux-arm64 to utils.kt

But now we are met with the following error when trying to build scenery:

Execution failed for task ':test'.
> Could not resolve all files for configuration ':testRuntimeClasspath'.
   > Could not find lwjgl-openvr-3.3.3-natives-linux-arm64.jar (org.lwjgl:lwjgl-openvr:3.3.3).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/org/lwjgl/lwjgl-openvr/3.3.3/lwjgl-openvr-3.3.3-natives-linux-arm64.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
  1. The above openvr JAR is introduced in LWJGL 3.3.4, let's bump to the latest release: 3.3.5

  2. LWJGL 3.3.4 also adds support for FREEBSD, and this isn't currently handled in scenery, let's do "something" about that 😬

Platform.FREEBSD -> TODO()

sciview

  • Let's also bump lwjgl.version to 3.3.5

Finally, we need to copy our new natives-linux-arm64 JARS into jars/linux-arm64 like so:

pi@raspberrypi:~ $ find /home/pi/Desktop/Fiji-Future.app/jars/linux-arm64 -name "lwjgl*"
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-zstd-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-xxhash-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-opengl-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-lz4-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-remotery-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-spvc-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-openvr-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-jemalloc-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-glfw-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-tinyexr-3.3.5-natives-linux-arm64.jar
/home/pi/Desktop/Fiji-Future.app/jars/linux-arm64/lwjgl-shaderc-3.3.5-natives-linux-arm64.jar

Note certain natives-linux-arm64 JARs are not available e.g. lwjgl-vulkan-3.3.5, so these will need to be present in /jars/.

And now, with any luck, sciview should initialize:

Log ✅
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/pi/Downloads/Fiji-Future.app/jars/logback-classic-1.2.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/pi/Downloads/Fiji-Future.app/jars/slf4j-simple-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Started application as PID 4133 on LINUX/ARM64
imagej-launcher version bigger that non-working version (6.0.2 vs. 4.0.5), all good.
This is sciview 0.4.1-SNAPSHOT (9404402) / scenery 0.11.3-SNAPSHOT (511a222).
Loaded Deferred Shading (Deferred Shading, with HDR postprocessing and FXAA)
Creating Vulkan instance with extensions VK_KHR_xlib_surface,VK_KHR_surface,VK_KHR_surface and layers 
Available special-purpose swapchains are: SwingSwapchain, HeadlessSwapchain, OpenGLSwapchain
Physical devices: 
  0: (Unknown vendor) V3D 4.2.14 (IntegratedGPU, driver version 23.2.1, Vulkan API 1.2.255) (selected)
  1: (Unknown vendor) llvmpipe (LLVM 15.0.6, 128 bits) (CPU, driver version 0.0.1, Vulkan API 1.3.255) 
Using swapchain SwingSwapchain
Renderer initialisation complete.
No custom key configuration found, using default keybindings.
No custom key configuration found, using default keybindings.
Recreating Swapchain at frame 0 (SwingSwapchain)
Present queue is 0, graphics queue is 0
Selected present mode: VK_PRESENT_MODE_FIFO_KHR with 3 images
Creating render framebuffer GeometryBuffer for pass Scene (1246x689)
 + attachment NormalsMaterial, RGBA_Float16
 + attachment DiffuseAlbedo, RGBA_UInt8
 + attachment Emission, RGBA_Float16
 + attachment ZBuffer, Depth32
Creating render framebuffer AOTemp1 for pass AO (1246x689)
 + attachment Occlusion, RGBA_UInt8
Creating render framebuffer AOTemp2 for pass AOBlurV (1246x689)
 + attachment Occlusion, RGBA_UInt8
Creating render framebuffer AOBuffer for pass AOBlurH (623x344)
 + attachment Occlusion, RGBA_UInt8
Creating render framebuffer ForwardBuffer for pass DeferredLighting (1246x689)
 + attachment Color, RGBA_Float16
Creating render framebuffer HDRBuffer for pass ForwardShading (1246x689)
 + attachment Color, RGBA_Float16
 + attachment Depth, Depth32
Creating render framebuffer FXAABuffer for pass HDR (1246x689)
 + attachment Color, RGBA_UInt8
Scene initialization started.
Scene initialization complete, took 372.5707843 ms.
Full startup took 23503ms
Done initializing SciView

It's also worth noting that I needed to copy jocl-2.0.5 into Fiji-Future.app/jars otherwise I'm met with the following warning when trying to open Demo > Animation > Volume Timeseries:

[WARN] Failed to initialised OpenCL libraries: java.lang.UnsatisfiedLinkError: Could not initialize native OpenCL library. Implementation library could not be loaded
[WARN] Could not create OpenCL compute context -- Do you have the necessary OpenCL libraries installed? Will fall back to default font.

That's all for now! I'll look at opening some draft PRs (and potentially a forum post for visibility) soon.

@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/running-sciview-on-linux-arm64/106354/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants