FreeCAD natively under Gnome/Wayland

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
Post Reply
tsadowski
Posts: 36
Joined: Tue Jan 20, 2015 10:50 pm

FreeCAD natively under Gnome/Wayland

Post by tsadowski »

Hi,

with Qt 5.12 it is possible to run FreeCAD natively under Wayland. All window decorations are nicely drawn. It is also crisper on HiDPI displays because scaling is handled better. I had to hack the Coin3d build to prevent the linking with libglx, because otherwise FreeCAD would crash as soon as a new document is created or opened.

Cheers, Torsten
Attachments
FreeCAD_Wayland.png
FreeCAD_Wayland.png (395.1 KiB) Viewed 7105 times
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreeCAD natively under Gnome/Wayland

Post by NormandC »

Thank you for your report, Torsten. I had been wondering about it, since Linux distros are gradually phasing out the old X server.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: FreeCAD natively under Gnome/Wayland

Post by yorik »

Very nice!! Haven't tried wayland yet, but it's impressive to see that a complex 3D app with lots of (some old) dependencies like freecad works...
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD natively under Gnome/Wayland

Post by Kunda1 »

@tsadowski can you show the code that you hacked to make this happen ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
tsadowski
Posts: 36
Joined: Tue Jan 20, 2015 10:50 pm

Re: FreeCAD natively under Gnome/Wayland

Post by tsadowski »

It was quite easy. Coin works without glx for FreeCAD probably because the funtionality is not needed by FreeCAD and Coin has a dummy implementation. I just had to add a patch to the Arch build recipy:
https://aur.archlinux.org/packages/coin-hg/

not to find glx:

Code: Select all

diff -ura coin/CMakeLists.txt coin.new/CMakeLists.txt
--- coin/CMakeLists.txt 2019-01-10 00:06:52.081521372 +0100
+++ coin.new/CMakeLists.txt     2019-01-10 00:08:32.785648305 +0100
@@ -431,7 +431,7 @@
   check_include_files("GL/gl.h" HAVE_GL_GL_H)
   check_include_files("GL/glu.h" HAVE_GL_GLU_H)
   check_include_files("GL/gl.h;GL/glext.h" HAVE_GL_GLEXT_H)
-  check_include_files("GL/glx.h" HAVE_GLX_H)
+#  check_include_files("GL/glx.h" HAVE_GLX_H)
 endif()
 
 check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
@@ -459,9 +459,9 @@
 check_symbol_exists(CGL_VERSION_1_0 OpenGL/OpenGL.h HAVE_CGL)
 set(HAVE_CGL_PBUFFER ${HAVE_CGL})
 
-if(NOT (HAVE_WGL OR HAVE_AGL OR HAVE_CGL))
-  check_library_exists(GL glXChooseVisual "" HAVE_GLX)
-endif()
+#if(NOT (HAVE_WGL OR HAVE_AGL OR HAVE_CGL))
+#  check_library_exists(GL glXChooseVisual "" HAVE_GLX)
+#endif()
 
 if(HAVE_WINDOWS_H)
   set(SIM_INCLUDE_WINDOWS_H "#include <windows.h>")
I tried to add some runtime workarounds in FreeCAD but this is awkward and probably doomed. Coin probably needs to use EGL instead of GLX. I will check if there is an easy solution and contact the Coin team.

Cheers,
Torsten
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: FreeCAD natively under Gnome/Wayland

Post by triplus »

tsadowski wrote: Fri Jan 11, 2019 10:43 pm I will check if there is an easy solution and contact the Coin team.

Cheers,
Torsten
That would be great. Likely still a few years before Wayland becomes more widely used and majority of applications add support. But FreeCAD providing support should happen sooner rather than later. If possible. Therefore Coin3D needs to get adapted and as for the Qt. You likely had to use QtWayland module in the procedure somehow? Can Wayland/X11 option be set with an environment variable before starting FreeCAD?
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD natively under Gnome/Wayland

Post by hobbes1069 »

tsadowski wrote: Fri Jan 11, 2019 10:43 pm I tried to add some runtime workarounds in FreeCAD but this is awkward and probably doomed. Coin probably needs to use EGL instead of GLX. I will check if there is an easy solution and contact the Coin team.
Any luck with the Coin team with EGL support?

Thanks,
Richard
User avatar
hobbes1069
Posts: 291
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD natively under Gnome/Wayland

Post by hobbes1069 »

For posterity with the current 4.0.0 release I had to update the patch to the following:

Code: Select all

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -586,11 +586,11 @@ if(NOT (HAVE_WGL OR HAVE_AGL OR HAVE_CGL
     list(APPEND COIN_TARGET_LINK_LIBRARIES OpenGL::GLX)
   endif()
   set(CMAKE_REQUIRED_LIBRARIES ${COIN_TARGET_LINK_LIBRARIES})
-  check_cxx_source_compiles("
-    #include <GL/gl.h>
-    #include <GL/glx.h>
-    int main() { (void)glXChooseVisual(0L, 0, 0L); glEnd(); return 0; }
-  " HAVE_GLX)
+#  check_cxx_source_compiles("
+#    #include <GL/gl.h>
+#    #include <GL/glx.h>
+#    int main() { (void)glXChooseVisual(0L, 0, 0L); glEnd(); return 0; }
+#  " HAVE_GLX)
 endif()

 # Checks specific OpenGL configurations
 
Thanks,
Richard
ElliotLee
Posts: 18
Joined: Wed Mar 20, 2019 10:20 pm

Re: FreeCAD natively under Gnome/Wayland

Post by ElliotLee »

I don't see any issues open in the Coin issue tracker on this topic - https://bitbucket.org/Coin3D/coin/issue ... tatus=open

Would someone (with a better grasp of the topic than I) file one?
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: FreeCAD natively under Gnome/Wayland

Post by kkremitzki »

BTW, a move to github.com/coin3d is underway.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
Post Reply