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...)
tsadowski
Posts: 34
Joined: Tue Jan 20, 2015 10:50 pm

FreeCAD natively under Gnome/Wayland

Postby tsadowski » Thu Jan 10, 2019 10:54 pm

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 1998 times
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreeCAD natively under Gnome/Wayland

Postby NormandC » Fri Jan 11, 2019 1:48 am

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
Site Admin
Posts: 12032
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: FreeCAD natively under Gnome/Wayland

Postby yorik » Fri Jan 11, 2019 12:18 pm

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
Posts: 8383
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD natively under Gnome/Wayland

Postby Kunda1 » Fri Jan 11, 2019 12:22 pm

@tsadowski can you show the code that you hacked to make this happen ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
tsadowski
Posts: 34
Joined: Tue Jan 20, 2015 10:50 pm

Re: FreeCAD natively under Gnome/Wayland

Postby tsadowski » Fri Jan 11, 2019 10:43 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: FreeCAD natively under Gnome/Wayland

Postby triplus » Wed Jan 23, 2019 11:12 pm

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: 254
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD natively under Gnome/Wayland

Postby hobbes1069 » Mon Dec 02, 2019 5:29 pm

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: 254
Joined: Wed Nov 09, 2011 3:49 pm
Location: Southaven, MS

Re: FreeCAD natively under Gnome/Wayland

Postby hobbes1069 » Mon Dec 16, 2019 9:43 pm

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: 7
Joined: Wed Mar 20, 2019 10:20 pm

Re: FreeCAD natively under Gnome/Wayland

Postby ElliotLee » Sun Dec 29, 2019 3:12 pm

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
Posts: 2153
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: FreeCAD natively under Gnome/Wayland

Postby kkremitzki » Sun Dec 29, 2019 7:19 pm

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.