Oops!  I meant to send this to the entire list rather than just Olly.

===============
Bill Gee

On 1/14/25 07:06, Bill Gee wrote:
Thanks Olly!  I gave this a try.  It works well.  This is on Fedora 41.

I am not familiar with how to build patch files, so I did this in a slightly different way.

1) Change to the source directory for loch (presumably already downloaded from GIT).  In my case that is ~/Installs/therion-6.3.3/loch

2) cp lxGUI.cxx lxGUI.cxx.backup

3) Use a text editor to modify lxGUI.cxx.  Copy the lines from Olly's message below starting with +#ifdev __WXGTK3__ and continuing to the last +#endif.

4) Paste those lines into lxGUI.cxx starting at line 75.  Save the file.

5) Change to the build directory.  In my case: cd ~/Installs/ therion-6.3.3/build

6) Clean up files from previous compile:  make clean

7) Compile just loch:  make -j 4 loch

8) The new binary is in loch/loch.  In my case: ~/Installs/ therion-6.3.3/build/loch/loch is the filename.

9) Become root, then copy the new loch over the old one.  In my case:

#cp /home/bgee/Installs/therion-6.3.3/build/loch/loch /usr/local/bin


===============
Bill Gee

On 1/13/25 19:38, Olly Betts wrote:
[Including the list in my reply as this seems of broader interest]

On Mon, Jan 13, 2025 at 04:52:46PM -0600, Bill Gee wrote:
Olly, you're a wizard for remembering that bit of arcana.  The command line
you suggested works.  No more seg faults in loch!

Great.

I do not have any packages called "wxWidgets" installed.  On Fedora they are
called wxGTK.  Here is the list of packages I have:

bgee@main2:~$ rpm -qa | grep -i wxGTK
wxGTK-i18n-3.2.6-1.fc41.noarch
wxGTK-3.2.6-1.fc41.x86_64
wxGTK-gl-3.2.6-1.fc41.x86_64
wxGTK-webview-3.2.6-1.fc41.x86_64
wxGTK-media-3.2.6-1.fc41.x86_64
wxGTK-devel-3.2.6-1.fc41.x86_64

Its upstream project name is wxWidgets - wxGTK is the flavour using GTK,
which Fedora have chosen to use as their package name.

I also do not have any packages like "libglew".  It might be part of the VTK
package.  I see a file named vtk-glew.h.

It's not part of VTK - that header seems to be some VTK layer for
supporting building with different versions of glew.

I don't think wxWidgets or therion uses glew so you may well not have it
installed, but some other apps which use wxWidgets also use glew - I
think it's necessary that wxWidgets and glew agree on whether to use EGL
or not for those apps.

I will modify the launcher for loch to set the environment variable.

We have a workaround in Survex's aven for this - I'd suggest something
similar in loch would be helpful as it would avoid these crashes
completely.  I'm not easily able to test this patch actually works as I
don't have Fedora but this or something like it should do the job (I
have checked it compiles on a platform where the conditionals both
evaluate true):

diff --git a/loch/lxGUI.cxx b/loch/lxGUI.cxx
index fc00b31e..41a4583c 100644
--- a/loch/lxGUI.cxx
+++ b/loch/lxGUI.cxx
@@ -73,7 +73,29 @@
  #endif
+#ifdef __WXGTK3__
+# if !(wxUSE_GLCANVAS_EGL-0)
+#  include <stdlib.h>
+
+// The GLX-based wxGLCanvas doesn't work under Wayland, and the code
+// segfaults: https://github.com/wxWidgets/wxWidgets/issues/17702
+//
+// Therefore we force X11 unless we're using the EGL-based wxGLCanvas
+// (which was added in wxWidgets 3.1.5 and hasn't been backported to
+// 3.0.x).
+//
+// Setting GDK_BACKEND=x11 is the recommended workaround, and it seems to
+// work to set it here.  GTK2 doesn't support Wayland, so doesn't need
+// this.
+struct ForceX11 {
+    ForceX11() {
+       setenv("GDK_BACKEND", "x11", 1);
+    }
+};
+static ForceX11 forcex11;
+# endif
+#endif
  ////////////////////////////////////////////////////////////////////////
  // Main frame


Cheers,
     Olly


_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion

Reply via email to