flathub / org.scilab.Scilab

https://flathub.org/apps/details/org.scilab.Scilab
1 stars 4 forks source link

Plotting doesn't work: GLException: Not a GL2 implementation #8

Closed wjt closed 1 year ago

wjt commented 1 year ago

An Endless OS user reported that Scilab no longer displays plots. Apparently this previously worked and now does not.

I can reproduce this. I see the following exception in the console:

Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Caught GLException: Not a GL2 implementation on thread AWT-EventQueue-0
    at javax.media.opengl.GLException.newGLException(GLException.java:75)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1311)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
    at javax.media.opengl.awt.GLJPanel$OffscreenBackend.doPaintComponent(GLJPanel.java:2024)
    at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:569)
    at javax.swing.JComponent.paint(JComponent.java:1056)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JViewport.paint(JViewport.java:728)
    at javax.swing.JComponent.paintChildren(JComponent.java:889)
    at javax.swing.JComponent.paint(JComponent.java:1065)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5210)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:290)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5158)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4969)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:831)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
    at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: javax.media.opengl.GLException: Not a GL2 implementation
    at jogamp.opengl.gl4.GL4bcImpl.getGL2(GL4bcImpl.java:37071)
    at org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas.getGl(Unknown Source)
    at org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas.display(Unknown Source)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:690)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:672)
    at javax.media.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:1408)
    at javax.media.opengl.awt.GLJPanel$9.run(GLJPanel.java:1483)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1277)
    ... 42 more

I tested the previous build as of 131f5f36, same issue. I also tested on an X11 session, same issue. My final guess is that the user was previously using an older version of Endless OS with an older Mesa, but I haven't tested this further.

I can also reproduce this on a Fedora 37 machine. It is not Endless OS specific. Both machines are Dell XPS laptops with Intel integrated graphics (one from 2015, one from 2019). I do not know the original reporter's hardware information.

The issue above seems to be a known issue upstream:

Forcing software rendering by setting LIBGL_ALWAYS_SOFTWARE=1 in the environment is a somewhat nasty workaround but it would at least make the app usable.

Another (better but more involved) approach would be to remove the dependency on GL2.

wjt commented 1 year ago

I know very little about Java or GL but some Googling suggests that you can explicitly request a GL2 context:

https://github.com/brandonborkholder/mirur/commit/ee7a3a71eaaee255a4b550c810c611747b7b00dc

wjt commented 1 year ago

https://forum.jogamp.org/Not-a-GL2-implementation-exception-td4030873.html suggests that apps should switch from big-GL to GLES2

kevinsmia1939 commented 1 year ago

Does non flatpak scilab work?

wjt commented 1 year ago

Fedora doesn't package it. Endless OS is an immutable system.

I tried installing the scilab package from Debian Bullseye in a toolbx and plotting fails with a different but somewhat similar exception:

Exception in thread "AWT-EventQueue-0" com.jogamp.opengl.GLException: Caught GLException: Profile GL4bc is not available on X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f4570960990, owner true, ResourceToolkitLock[obj 0x61fc1946, isOwner true, <4d4948ac, 59e4a651>[count 1, qsz 0, owner <AWT-EventQueue-0>]]], but: [GLProfile[GLES1/GLES1.hw], GLProfile[GLES2/GLES3.hw], GLProfile[GL2ES1/GLES1.hw], GLProfile[GL4ES3/GL4.hw], GLProfile[GL2ES2/GL4.hw], GLProfile[GL4/GL4.hw], GLProfile[GLES3/GLES3.hw], GLProfile[GL4/GL4.hw], GLProfile[GL3/GL4.hw], GLProfile[GL2GL3/GL4.hw]]
    at com.jogamp.opengl.awt.GLJPanel$OffscreenBackend.initialize(GLJPanel.java:1795)
    at com.jogamp.opengl.awt.GLJPanel.initializeBackendImpl(GLJPanel.java:1377)
    at com.jogamp.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:549)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1074)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JViewport.paint(JViewport.java:737)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at org.scilab.modules.gui.bridge.tab.SwingScilabDockablePanel.paintChildren(Unknown Source)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at org.flexdock.docking.defaults.DefaultDockingPort.paint(DefaultDockingPort.java:1983)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
    at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
    at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5262)
    at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246)
    at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1060)
    at java.desktop/java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
    at java.desktop/sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
    at java.desktop/sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
    at java.desktop/java.awt.Container.paint(Container.java:2002)
    at java.desktop/java.awt.Window.paint(Window.java:3940)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:876)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
    at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
    at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.jogamp.opengl.GLException: Profile GL4bc is not available on X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f4570960990, owner true, ResourceToolkitLock[obj 0x61fc1946, isOwner true, <4d4948ac, 59e4a651>[count 1, qsz 0, owner <AWT-EventQueue-0>]]], but: [GLProfile[GLES1/GLES1.hw], GLProfile[GLES2/GLES3.hw], GLProfile[GL2ES1/GLES1.hw], GLProfile[GL4ES3/GL4.hw], GLProfile[GL2ES2/GL4.hw], GLProfile[GL4/GL4.hw], GLProfile[GLES3/GLES3.hw], GLProfile[GL4/GL4.hw], GLProfile[GL3/GL4.hw], GLProfile[GL2GL3/GL4.hw]]
    at com.jogamp.opengl.GLProfile.get(GLProfile.java:991)
    at jogamp.opengl.GLContextImpl.verifyInstance(GLContextImpl.java:1471)
    at jogamp.opengl.GLContextImpl.setGLFunctionAvailability(GLContextImpl.java:1942)
    at jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:395)
    at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
    at com.jogamp.opengl.awt.GLJPanel$OffscreenBackend.initialize(GLJPanel.java:1731)
    ... 55 more
Exception in thread "Thread-5" com.jogamp.opengl.GLException: java.lang.reflect.InvocationTargetException
    at com.jogamp.opengl.awt.GLJPanel.display(GLJPanel.java:465)
    at org.scilab.modules.gui.bridge.canvas.SwingScilabCanvasImpl$SafeGLJPanel.display(Unknown Source)
    at org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas$CanvasAnimator.run(Unknown Source)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1367)
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1342)
    at com.jogamp.opengl.awt.GLJPanel.display(GLJPanel.java:463)
    ... 3 more
kevinsmia1939 commented 1 year ago

Maybe try the executable from here: https://www.scilab.org/download/scilab-6.1.1

If it does not work it probably an issue with Scilab. But maybe we can turn on LIBGL_ALWAYS_SOFTWARE=1 by default to work around it until it is fix?

wjt commented 1 year ago
scilab-bin: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

I'm afraid I can't spend any more time on this. I'm not a Scilab user, I'm passing on this problem on behalf of a user of our distro.

davidcl commented 1 year ago

could you try overriding MESA GL version using: export MESA_GL_VERSION_OVERRIDE=2.1 before launching Scilab ?

wjt commented 1 year ago

Thanks @davidcl, I opened #10 for that change.