LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.81k stars 1.16k forks source link

OpenGL error messages at startup cause error messages #1599

Closed smoe closed 1 year ago

smoe commented 2 years ago

Here are the steps I follow to reproduce the issue:

  1. install Debian bullseye
  2. run linuxcnc
  3. press "OK" (cancel is fine)

This is what I expected to happen:

no idea, it is the first time I started this

This is what happened instead:

$ linuxcnc LINUXCNC - 2.9.0~pre0 Machine configuration directory is '/home/moeller/linuxcnc/configs/sim.axis-1' Machine configuration file is 'axis_mm.ini' Starting LinuxCNC... Found file(lib): /usr/share/linuxcnc/hallib/core_sim.hal Note: Using POSIX non-realtime Found file(lib): /usr/share/linuxcnc/hallib/sim_spindle_encoder.hal Found file(lib): /usr/share/linuxcnc/hallib/axis_manualtoolchange.hal Found file(lib): /usr/share/linuxcnc/hallib/simulated_home.hal PYTHON: exception during 'this' export: TypeError: 'Boost.Python.class' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "", line 1007, in _find_and_load

File "", line 986, in _find_and_load_unlocked

File "", line 666, in _load_unlocked

File "", line 565, in module_from_spec

File "", line 763, in create_module

SystemError: _PyEval_EvalFrameDefault returned a result with an error set

link (updating variable file): Datei oder Verzeichnis nicht gefunden note: MAXV max: 53.340 units/sec 3200.400 units/min note: LJOG max: 53.340 units/sec 3200.400 units/min note: LJOG default: 30.480 units/sec 1828.800 units/min note: jog_order='XYZ' note: jog_invert=set() PYTHON: exception during 'this' export: TypeError: No Python class registered for C++ class Interp

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/OpenGL/latebind.py", line 43, in call return self._finalCall( *args, **named ) TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/axis", line 3979, in commands.set_view_p() File "/usr/bin/axis", line 2181, in set_view_p o.set_view_p() File "/usr/lib/python3/dist-packages/glnav.py", line 448, in set_view_p glRotateScene(self, 1.0, mid[0], mid[1], mid[2], 0, 0, 0, 0) File "/usr/lib/python3/dist-packages/glnav.py", line 116, in glRotateScene mat = glGetDoublev(GL_MODELVIEW_MATRIX) File "/usr/lib/python3/dist-packages/OpenGL/latebind.py", line 47, in call return self._finalCall( *args, **named ) File "/usr/lib/python3/dist-packages/OpenGL/wrapper.py", line 668, in wrapperCall cArgs = tuple(calculate_cArgs( pyArgs )) File "/usr/lib/python3/dist-packages/OpenGL/wrapper.py", line 471, in calculate_cArgs yield converter( pyArgs, index, self ) File "/usr/lib/python3/dist-packages/OpenGL/converters.py", line 251, in call return super( SizedOutputOrInput,self ).call( pyArgs, index, baseOperation ) File "/usr/lib/python3/dist-packages/OpenGL/converters.py", line 196, in call return self.arrayType.zeros( self.getSize(pyArgs) ) File "/usr/lib/python3/dist-packages/OpenGL/arrays/arraydatatype.py", line 177, in zeros return cls.returnHandler().zeros( dims, typeCode or cls.typeConstant ) File "/usr/lib/python3/dist-packages/OpenGL/arrays/arraydatatype.py", line 80, in get_output_handler self.output_handler = self.handler_by_plugin_name( preferred ) File "/usr/lib/python3/dist-packages/OpenGL/arrays/arraydatatype.py", line 67, in handler_by_plugin_name return plugin.load() File "/usr/lib/python3/dist-packages/OpenGL/plugins.py", line 16, in load return importByName( self.import_path ) File "/usr/lib/python3/dist-packages/OpenGL/plugins.py", line 38, in importByName module = import( ".".join(moduleName), {}, {}, moduleName) File "/usr/lib/python3/dist-packages/OpenGL/arrays/numpymodule.py", line 12, in import numpy File "/usr/lib/python3/dist-packages/numpy/init.py", line 150, in from . import core File "/usr/lib/python3/dist-packages/numpy/core/init.py", line 22, in from . import multiarray File "/usr/lib/python3/dist-packages/numpy/core/multiarray.py", line 12, in from . import overrides File "/usr/lib/python3/dist-packages/numpy/core/overrides.py", line 7, in from numpy.core._multiarray_umath import ( TypeError: ("'Boost.Python.class' object is not iterable", 'Failure in cConverter <OpenGL.converters.SizedOutputOrInput object at 0x7fda4a4b9cc0>', (GL_MODELVIEW_MATRIX, <object object at 0x7fda4afecd40>), 1, <OpenGL.platform.baseplatform.glGetDoublev object at 0x7fda4a48c280>) Shutting down and cleaning up LinuxCNC... task: 1763 cycles, min=0.000007, max=0.005435, avg=0.001065, 0 latency excursions (> 10x expected cycle time of 0.001000s) Note: Using POSIX non-realtime

Information about my hardware and software:

No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux bookworm/sid Release: unstable Codename: sid

Linux x230 5.15.0-3-amd64 #1 SMP Debian 5.15.15-2 (2022-01-30) x86_64 GNU/Linux

A recent master, the bug has been reported also for the RPi.

Just the linuxcnc application started from the home directory - KDE.

Nothing attached. Just a blank laptop, not even running a realtime module.

SebKuzminsky commented 1 year ago

There's a bunch of broken stuff, and I agree with you, they should ideally be fixed, but failing that they should not be in the package. PRs gladly accepted.

smoe commented 1 year ago

I am very happy to hear that we no longer have that dependency on GLUT. I just grepped for it and nothing popped up. Happy.

To make sure we are all on the same page, and have me recreate a new .iso for it, would you mind to upload a new version of the Debian package? That soft freeze the day after tomorrow would be another reason :o/

petterreinholdtsen commented 1 year ago

[Steffen Möller]

would you mind to upload a new version of the Debian package? That soft freeze the day after tomorrow would be another reason :o/

From #debian-devel:

uploaded. See -- Happy hacking Petter Reinholdtsen
hansu commented 1 year ago

I tried again on a fresh Bookworm without GLUT and I can confirm that Gmoccapy runs under X11 (RIP). But still problems on Wayland:

Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'

After sudo xhost +

I get

 File "/home/cnc/linuxcnc/linuxcnc-2.9/lib/python/gremlin.py", line 244, in reshape
    self.xwindow_id = GdkX11.X11Window.get_xid(widget.get_window())
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument self: Expected GdkX11.X11Window, but got __gi__.GdkWaylandWindow

I only wonder why gremlin is working under Axis. I thought it's the same code used there.

SebKuzminsky commented 1 year ago

@hansu, does @JetForMe's suggestion of GDK_BACKEND=x11 help? https://github.com/LinuxCNC/linuxcnc/issues/2264#issuecomment-1411221972

If so I suggest we add it here: https://github.com/LinuxCNC/linuxcnc/blob/2.9/scripts/linuxcnc.in#L25-L29

hansu commented 1 year ago

Yes export GDK_BACKEND=x11 does the trick, great! Sorry, I lost a bit track on all these OpenGL stuff. Yes let's add it there!

jepler commented 1 year ago

Since gtk cannot create a compatibility context we need the x11 backend for now too create it via glx calls. Major updates are needed to gremlin before it works with "modern" opengl. I support adding the environment variable workaround unconditionally though I'm not fully aware of the downsides (I don't use Wayland anywhere yet)