FreeCAD and Raspberry Pi 4

After the first time running sudo cmake, you will end up with directories owned by root, so subsequent non-sudo calls to cmake may fail, similarly to why make is failing without sudo. If you destroy and recreate your build directory and then run cmake without sudo you should no longer need it at any point, and if you do, that suggests something is broken somewhere else, probably by overuse of sudo as well.


Also, try using -DPYTHON_EXECUTABLE=/usr/bin/python3, not /usr/bin/python3.7, and you will probably not need any more of the other Python flags.

As said by Kremitzki, if you ran sudo cmake at least once, it’s possible that the created directories and files will be owned by root, so you cannot access them by the regular pi user anymore, unless you use sudo again. This is the problem with using sudo indiscriminately. It should only be used when necessary.

Another issue is if the directories that you created were done by sudo. Again, bad.

sudo git clone ...
sudo mkdir freecad-source

And yes, please post the error messages to confirm this is just a permission issue and not something else.

I would advise you to re-create the directories with your regular user and try again. However, since you mentioned it takes a long time to compile, well, do it when you have the chance.

Ah ok, so, no it doesn’t show no any cone. Just a kind of screenshot as the picture shows.

You should get something like this.
Minimal_cone.png

Super cool!

The biggest problem I guess is to make Qt cooperate with Coin3d because with recent Qt5 versions a special attribute must be set. When I first tested FreeCAD with Qt 5.12 I had a similar problem where Coin3d couldn’t get the current OpenGL context. After setting Qt::AA_UseDesktopOpenGL things started to work again.

Now that you have compiled your own FreeCAD binaries you can try if this helps you, too. Therefore go to src/Gui/Application.cpp and search for “Qt::AA_UseDesktopOpenGL”. Change the line above from

#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))

to

#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))

and rebuild FreeCADGui. It’s sufficient to invoke make FreeCADGui/fast

There are some further Qt attributes dealing with OpenGL, see https://doc.qt.io/qt-5/qt.html
Qt::AA_UseOpenGLES, Qt::AA_UseSoftwareOpenGL and Qt::AA_ShareOpenGLContexts (already used)

According to https://doc.qt.io/qt-5/windows-requirements.html the attributes Qt::AA_UseDesktopOpenGL, Qt::AA_UseOpenGLES and Qt::AA_UseSoftwareOpenGL are mutual exclusive and instead of changing the source code you can set the environment variable QT_OPENGL.
Setting Qt::AA_UseDesktopOpenGL is equivalent to QT_OPENGL=desktop
Setting Qt::AA_UseOpenGLES is equivalent to QT_OPENGL=angle
Setting Qt::AA_UseSoftwareOpenGL is equivalent to QT_OPENGL=software

NOTE: This is written on the page for requirements on Windows and I don’t know in how far this applies to other platforms!



Your explations helped me a lot, thanks guys.
I’ve over abused of sudo indeed… by typing sudo -i as first commande before starting last compilations, then sudo again later. My bad :confused:
Ok, hence no more sudo now:

I’ve made backup copies of freecad-source and freecad-build directories (you were right guys, some files were owned by pi user, some others by root user)
then I’ve deleted freecad-build directory then created a new one (empty directory I mean)

mkdir freecad-build

then changed owner of files in freecad-source directory

sudo chown -R pi freecad-source

then cmake

cd freecad-build/
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source

No errors with cmake,.
Then make, still 2 hours compiling.

make -j4

No warnings.

I ran FreeCAD, still crashing at creating of a new document.

Ok, so

pi@raspberrypi:~/freecad-source/src/Gui $ nano Application.cpp

Then I’ve change QT version 5,12,0 → 5, 11,0
then

pi@raspberrypi:~/freecad-build $ make FreeCADGui/fast

But Freecad still crash with same error:

pi@raspberrypi:~/freecad-build/bin $ ./FreeCAD
FreeCAD 0.19, Libs: 0.19R17651 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

using qt5ct plugin
D-Bus global menu: no
D-Bus system tray: no
connect failed: No such file or directory
Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0xb230c120]
pi@raspberrypi:~/freecad-build/bin $

That’s where I am now :neutral_face:

OS: Raspbian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.19.17651 (Git)
Build type: Debug
Branch: master
Hash: 16c26cb3b1cd7209ea8efc8cb30b3b18fd80cf95
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Please provide the backtrace with the debugger gdb, as mentioned earlier, not only the message of the crash.

Also, your version of FreeCAD is a bit old. Currently the master tree is in commit 18374, so you should test with the latest code.

cd freecad-source
git pull

Then cmake and make again.

Sure, below the backtrace, updated version.

pi@raspberrypi:~/freecad-build/bin $ gdb ./FreeCAD
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./FreeCAD...done.
(gdb) run
Starting program: /home/pi/freecad-build/bin/FreeCAD 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
FreeCAD 0.19, Libs: 0.19R18385 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0xad82f210 (LWP 1513)]
using qt5ct plugin
[New Thread 0xa775d210 (LWP 1514)]
D-Bus global menu: no
[New Thread 0xa096f210 (LWP 1527)]
[New Thread 0x9fdff210 (LWP 1528)]
[New Thread 0x9f3ff210 (LWP 1529)]
D-Bus system tray: no
[New Thread 0x9d1ff210 (LWP 1530)]
connect failed: No such file or directory
Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0xaf43fe74 in XDefaultScreenOfDisplay () from /usr/lib/arm-linux-gnueabihf/libX11.so.6
(gdb) bt full
#0  0xaf43fe74 in XDefaultScreenOfDisplay () at /usr/lib/arm-linux-gnueabihf/libX11.so.6
#1  0xb3565ad0 in  () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#2  0xb3566454 in glxglue_init () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#3  0xb355f0e0 in cc_glglue_instance () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#4  0xb3410120 in SoGLRenderActionP::isDirectRendering(SoState const*) const () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#5  0xb3412358 in SoGLRenderActionP::render(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#6  0xb34125a0 in SoGLRenderAction::beginTraversal(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#7  0xb340c2fc in SoAction::apply(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#8  0xb5fb1b38 in Gui::SoBoxSelectionRenderAction::apply(SoNode*) (this=0xfc2c88, node=0xf43328) at /home/pi/freecad-source/src/Gui/SoFCSelectionAction.cpp:1180
        __PRETTY_FUNCTION__ = "virtual void Gui::SoBoxSelectionRenderAction::apply(SoNode*)"
#9  0xb60a529c in Gui::View3DInventorViewer::renderScene() (this=0xfe6ac0) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2245
        vp = {winsize = {vec = {1650, 864}}, vporigin = {vec = {0, 0}}, vpsize = {vec = {1, 1}}, vporigin_s = {vec = {0, 0}}, vpsize_s = {vec = {1650, 864}}, pixperinch = 72}
        origin = {vec = {0, 0}}
        size = {vec = {1650, 864}}
        col = 
              {cspec = QColor::Rgb, ct = {argb = {alpha = 65535, red = 60138, green = 58853, blue = 56540, pad = 0}, ahsv = {alpha = 65535, hue = 60138, saturation = 58853, value = 56540, pad = 0}, acmyk = {alpha = 65535, cyan = 60138, magenta = 58853, yellow = 56540, black = 0}, ahsl = {alpha = 65535, hue = 60138, saturation = 58853, lightness = 56540, pad = 0}, array = {65535, 60138, 58853, 56540, 0}}}
        glra = 0xfc2c88
        state = 0x1158fb8
#10 0xb60a4bb8 in Gui::View3DInventorViewer::actualRedraw() (this=0xfe6ac0) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2128
#11 0xb604775c in SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*) (this=0xfe6ac0, event=0xbeffcf10) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:922
        w = 0xeba200
        __PRETTY_FUNCTION__ = "virtual void SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*)"
#12 0xb6050d24 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::paintEvent(QPaintEvent*) (this=0xfe6ac0, event=0xbeffcf10) at /home/pi/freecad-source/src/Gui/Quarter/SoQTQuarterAdaptor.cpp:723
        start = 1570143140.8593431
#13 0xb287d590 in QWidget::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#14 0xb29261bc in QFrame::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#15 0xb2b83118 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#16 0xb604792c in SIM::Coin3D::Quarter::QuarterWidget::viewportEvent(QEvent*) (this=0xfe6ac0, event=0xbeffcf10) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:996
#17 0xb208a090 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#18 0xb283ada0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb28432a8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0x00eba200 in  ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 1506] will be killed.

Quit anyway? (y or n) y
pi@raspberrypi:~/freecad-build/bin $

OS: Raspbian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.19.18385 (Git)
Build type: Debug
Branch: master
Hash: c314edcaf675dd261e757bbf7b2f8b97c7e72130
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Here is the code of the function cc_glglue_instance: https://bitbucket.org/Coin3D/coin/src/ab8d0e47a4de3230a8137feb39c142d6ba45f97d/src/glue/gl.cpp#lines-2305
So to hunt down the problem we have to find out why setting up the GL context fails. Therefore, next step is to set the environment variable COIN_GL_NO_CURRENT_CONTEXT_CHECK

export COIN_GL_NO_CURRENT_CONTEXT_CHECK=1

before starting FreeCAD. Then we can see if a current context is set or not.

Done:

.....
SAL_USE_VCLPLUGIN=gtk3
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/mail/pi
COIN_GL_NO_CURRENT_CONTEXT_CHECK=1
OLDPWD=/home/pi/freecad-build
TEXTDOMAIN=Linux-PAM
_=/usr/bin/env

I get the following backtrace:

pi@raspberrypi:~/freecad-build/bin $ gdb ./FreeCAD
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./FreeCAD...done.
(gdb) run
Starting program: /home/pi/freecad-build/bin/FreeCAD 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
FreeCAD 0.19, Libs: 0.19R18385 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0xad82f210 (LWP 1963)]
using qt5ct plugin
[New Thread 0xa775d210 (LWP 1964)]
D-Bus global menu: no
[New Thread 0xa09bd210 (LWP 1966)]
[New Thread 0x9fdff210 (LWP 1967)]
[New Thread 0x9f3ff210 (LWP 1968)]
D-Bus system tray: no
[New Thread 0x9d1ff210 (LWP 1969)]
connect failed: No such file or directory
Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0xaf43fe74 in XDefaultScreenOfDisplay () from /usr/lib/arm-linux-gnueabihf/libX11.so.6
(gdb) bt full
#0  0xaf43fe74 in XDefaultScreenOfDisplay () at /usr/lib/arm-linux-gnueabihf/libX11.so.6
#1  0xb3565ad0 in  () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#2  0xb3566454 in glxglue_init () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#3  0xb355f0e0 in cc_glglue_instance () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#4  0xb3410120 in SoGLRenderActionP::isDirectRendering(SoState const*) const () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#5  0xb3412358 in SoGLRenderActionP::render(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#6  0xb34125a0 in SoGLRenderAction::beginTraversal(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#7  0xb340c2fc in SoAction::apply(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#8  0xb5fb1b38 in Gui::SoBoxSelectionRenderAction::apply(SoNode*) (this=0x9b7b68, node=0xe90f28) at /home/pi/freecad-source/src/Gui/SoFCSelectionAction.cpp:1180
        __PRETTY_FUNCTION__ = "virtual void Gui::SoBoxSelectionRenderAction::apply(SoNode*)"
#9  0xb60a529c in Gui::View3DInventorViewer::renderScene() (this=0xfaab28) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2245
        vp = {winsize = {vec = {1650, 638}}, vporigin = {vec = {0, 0}}, vpsize = {vec = {1, 1}}, vporigin_s = {vec = {0, 0}}, vpsize_s = {vec = {1650, 638}}, pixperinch = 72}
        origin = {vec = {0, 0}}
        size = {vec = {1650, 638}}
        col = 
              {cspec = QColor::Rgb, ct = {argb = {alpha = 65535, red = 60138, green = 58853, blue = 56540, pad = 0}, ahsv = {alpha = 65535, hue = 60138, saturation = 58853, value = 56540, pad = 0}, acmyk = {alpha = 65535, cyan = 60138, magenta = 58853, yellow = 56540, black = 0}, ahsl = {alpha = 65535, hue = 60138, saturation = 58853, lightness = 56540, pad = 0}, array = {65535, 60138, 58853, 56540, 0}}}
        glra = 0x9b7b68
        state = 0xfa8de0
#10 0xb60a4bb8 in Gui::View3DInventorViewer::actualRedraw() (this=0xfaab28) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2128
#11 0xb604775c in SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*) (this=0xfaab28, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:922
        w = 0x10280b0
        __PRETTY_FUNCTION__ = "virtual void SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*)"
#12 0xb6050d24 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::paintEvent(QPaintEvent*) (this=0xfaab28, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/SoQTQuarterAdaptor.cpp:723
        start = 1570212998.821115
#13 0xb287d590 in QWidget::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#14 0xb29261bc in QFrame::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#15 0xb2b83118 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#16 0xb604792c in SIM::Coin3D::Quarter::QuarterWidget::viewportEvent(QEvent*) (this=0xfaab28, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:996
#17 0xb208a090 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#18 0xb283ada0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb28432a8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0x010280b0 in  ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 1947] will be killed.

Quit anyway? (y or n) y

Is it what you expected? AFAIK I don’t see any difference with previous backtrace, however I’m like an ant in honey…


FYI sometimes I’ve got another error below when running ./FreeCAD. Freecad even don’t start this time, the last time this error occured while opening “about Freecad” menu.

Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0xb1a0e120]
QMutex: destroying locked mutex
pi@raspberrypi:~/freecad-build/bin $

One comment again: when I had updated the source code with “pull git”, I’ve got an error message about ‘Application.cpp’ file, because of the modification QT_VERSION_CHECK( 5, 12, 0) → 5, 11, 0. So, I’ve modified the file again with QT 5, 12, 0 only during the update. Then I’ve set again with QT 5, 11, 0 once pull git achieved. However, Before this last change, I’ve started Freecad to test, but the clipboard info mentioned 'Qt version/ 5.11.3.
I mean, now no matter if I set Qt 5,12,0 or Qt 5, 11, 0 in Application.cpp, Freecad info always mention QT version: 5.11.3.
Strange or not?

OS: Raspbian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.19.18385 (Git)
Build type: Debug
Branch: master
Hash: c314edcaf675dd261e757bbf7b2f8b97c7e72130
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Mmm. Honey.

Anyway, how are you setting the variable? Are you using some file that you find in Raspbian? That’s not needed.

To test a single environmental variable, you can set it in the terminal, before running your command.

export COIN_GL_NO_CURRENT_CONTEXT_CHECK=1
./FreeCAD

Or in the same line

COIN_GL_NO_CURRENT_CONTEXT_CHECK=1 ./FreeCAD

You can do this as well before launching the debugger, or inside the debugger.

(gdb) set env COIN_GL_NO_CURRENT_CONTEXT_CHECK 1
(gdb) run

To be honest right now I’m eating some chocolate paste :smiley:


Yes that’s what I did, from bash.

I’ve tried it again, this time inside debugger as you say:

pi@raspberrypi:~/freecad-build/bin $ gdb ./FreeCAD
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./FreeCAD...done.
(gdb) set env COIN_GL_NO_CURRENT_CONTEXT_CHECK=1
(gdb) run
Starting program: /home/pi/freecad-build/bin/FreeCAD 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
FreeCAD 0.19, Libs: 0.19R18385 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0xad82f210 (LWP 3687)]
using qt5ct plugin
[New Thread 0xa775d210 (LWP 3688)]
D-Bus global menu: no
[New Thread 0xa09bd210 (LWP 3689)]
[New Thread 0x9fdff210 (LWP 3690)]
[New Thread 0x9f3ff210 (LWP 3691)]
D-Bus system tray: no
[New Thread 0x9d1ff210 (LWP 3692)]
connect failed: No such file or directory
Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0xaf43fe74 in XDefaultScreenOfDisplay () from /usr/lib/arm-linux-gnueabihf/libX11.so.6
(gdb) bt full
#0  0xaf43fe74 in XDefaultScreenOfDisplay () at /usr/lib/arm-linux-gnueabihf/libX11.so.6
#1  0xb3565ad0 in  () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#2  0xb3566454 in glxglue_init () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#3  0xb355f0e0 in cc_glglue_instance () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#4  0xb3410120 in SoGLRenderActionP::isDirectRendering(SoState const*) const () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#5  0xb3412358 in SoGLRenderActionP::render(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#6  0xb34125a0 in SoGLRenderAction::beginTraversal(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#7  0xb340c2fc in SoAction::apply(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#8  0xb5fb1b38 in Gui::SoBoxSelectionRenderAction::apply(SoNode*) (this=0xa99e08, node=0xf2bae8) at /home/pi/freecad-source/src/Gui/SoFCSelectionAction.cpp:1180
        __PRETTY_FUNCTION__ = "virtual void Gui::SoBoxSelectionRenderAction::apply(SoNode*)"
#9  0xb60a529c in Gui::View3DInventorViewer::renderScene() (this=0xfaacf0) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2245
        vp = {winsize = {vec = {1650, 638}}, vporigin = {vec = {0, 0}}, vpsize = {vec = {1, 1}}, vporigin_s = {vec = {0, 0}}, vpsize_s = {vec = {1650, 638}}, pixperinch = 72}
        origin = {vec = {0, 0}}
        size = {vec = {1650, 638}}
        col = 
              {cspec = QColor::Rgb, ct = {argb = {alpha = 65535, red = 60138, green = 58853, blue = 56540, pad = 0}, ahsv = {alpha = 65535, hue = 60138, saturation = 58853, value = 56540, pad = 0}, acmyk = {alpha = 65535, cyan = 60138, magenta = 58853, yellow = 56540, black = 0}, ahsl = {alpha = 65535, hue = 60138, saturation = 58853, lightness = 56540, pad = 0}, array = {65535, 60138, 58853, 56540, 0}}}
        glra = 0xa99e08
        state = 0x1305e18
#10 0xb60a4bb8 in Gui::View3DInventorViewer::actualRedraw() (this=0xfaacf0) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2128
#11 0xb604775c in SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*) (this=0xfaacf0, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:922
        w = 0x8c8c10
        __PRETTY_FUNCTION__ = "virtual void SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*)"
#12 0xb6050d24 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::paintEvent(QPaintEvent*) (this=0xfaacf0, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/SoQTQuarterAdaptor.cpp:723
        start = 1570217811.1295891
#13 0xb287d590 in QWidget::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#14 0xb29261bc in QFrame::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#15 0xb2b83118 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#16 0xb604792c in SIM::Coin3D::Quarter::QuarterWidget::viewportEvent(QEvent*) (this=0xfaacf0, event=0xbeffcfa0) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:996
#17 0xb208a090 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#18 0xb283ada0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb28432a8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0x008c8c10 in  ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 3670] will be killed.

Quit anyway? (y or n) y
pi@raspberrypi:~/freecad-build/bin $

Lines

        glra = 0xa99e08
        state = 0x1305e18

seem different with previous ones. I have no idea if it does matter…

By setting the env. variable this check was done: https://bitbucket.org/Coin3D/coin/src/ab8d0e47a4de3230a8137feb39c142d6ba45f97d/src/glue/gl.cpp#lines-2354
Because the assert() didn’t fail it means that at least a current OpenGL context is set.

Because the last function call is glxglue_init() I think the crash only can happen here: https://bitbucket.org/Coin3D/coin/src/ab8d0e47a4de3230a8137feb39c142d6ba45f97d/src/glue/gl_glx.cpp#lines-486 where glXGetCurrentDisplay is a function pointer to XDefaultScreenOfDisplay.

One comment again: when I had updated the source code with “pull git”, I’ve got an error message about ‘Application.cpp’ file, because of the modification QT_VERSION_CHECK( 5, 12, 0) → 5, 11, 0. So, I’ve modified the file again with QT 5, 12, 0 only during the update.

You can revert your changes again as it appears that these settings are Windows-specific.

When searching for “XDefaultScreenOfDisplay” and “crash” there I found this hit:
https://github.com/flathub/org.freecadweb.FreeCAD/issues/11

Can you try to set the env. variable

export QT_QPA_PLATFORM=xcb

Thanks Werner for you attention and explanations,

Done:

pi@raspberrypi:~ $ env
.......
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/pi
HOME=/home/pi
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=LXDE
VTE_VERSION=5402
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
QT_QPA_PLATFORM=xcb
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=pi
.....

Then backtrace:

pi@raspberrypi:~/freecad-build/bin $ gdb ./FreeCAD
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./FreeCAD...done.
(gdb) run
Starting program: /home/pi/freecad-build/bin/FreeCAD 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
FreeCAD 0.19, Libs: 0.19R18385 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0xad82f210 (LWP 2632)]
using qt5ct plugin
[New Thread 0xa775d210 (LWP 2634)]
D-Bus global menu: no
[New Thread 0xa09bd210 (LWP 2636)]
[New Thread 0x9fdff210 (LWP 2637)]
[New Thread 0x9f3ff210 (LWP 2638)]
D-Bus system tray: no
[New Thread 0x9d1ff210 (LWP 2639)]
connect failed: No such file or directory
[Detaching after fork from child process 2653]
[Detaching after fork from child process 2654]
Coin warning in cc_glglue_instance(): Error when setting up the GL context. This can happen if there is no current context, or if the context has been set up incorrectly.

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0xaf43fe74 in XDefaultScreenOfDisplay () from /usr/lib/arm-linux-gnueabihf/libX11.so.6
(gdb) bt full
#0  0xaf43fe74 in XDefaultScreenOfDisplay () at /usr/lib/arm-linux-gnueabihf/libX11.so.6
#1  0xb3565ad0 in  () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#2  0xb3566454 in glxglue_init () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#3  0xb355f0e0 in cc_glglue_instance () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#4  0xb3410120 in SoGLRenderActionP::isDirectRendering(SoState const*) const () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#5  0xb3412358 in SoGLRenderActionP::render(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#6  0xb34125a0 in SoGLRenderAction::beginTraversal(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#7  0xb340c2fc in SoAction::apply(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#8  0xb5fb1b38 in Gui::SoBoxSelectionRenderAction::apply(SoNode*) (this=0x941488, node=0x1025d88) at /home/pi/freecad-source/src/Gui/SoFCSelectionAction.cpp:1180
        __PRETTY_FUNCTION__ = "virtual void Gui::SoBoxSelectionRenderAction::apply(SoNode*)"
#9  0xb60a529c in Gui::View3DInventorViewer::renderScene() (this=0x12cd900) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2245
        vp = {winsize = {vec = {1650, 638}}, vporigin = {vec = {0, 0}}, vpsize = {vec = {1, 1}}, vporigin_s = {vec = {0, 0}}, vpsize_s = {vec = {1650, 638}}, pixperinch = 72}
        origin = {vec = {0, 0}}
        size = {vec = {1650, 638}}
        col = 
              {cspec = QColor::Rgb, ct = {argb = {alpha = 65535, red = 60138, green = 58853, blue = 56540, pad = 0}, ahsv = {alpha = 65535, hue = 60138, saturation = 58853, value = 56540, pad = 0}, acmyk = {alpha = 65535, cyan = 60138, magenta = 58853, yellow = 56540, black = 0}, ahsl = {alpha = 65535, hue = 60138, saturation = 58853, lightness = 56540, pad = 0}, array = {65535, 60138, 58853, 56540, 0}}}
        glra = 0x941488
        state = 0x1349a58
#10 0xb60a4bb8 in Gui::View3DInventorViewer::actualRedraw() (this=0x12cd900) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:2128
#11 0xb604775c in SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*) (this=0x12cd900, event=0xbeffcf00) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:922
        w = 0x1148af8
        __PRETTY_FUNCTION__ = "virtual void SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*)"
#12 0xb6050d24 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::paintEvent(QPaintEvent*) (this=0x12cd900, event=0xbeffcf00) at /home/pi/freecad-source/src/Gui/Quarter/SoQTQuarterAdaptor.cpp:723
        start = 1570393357.2788661
#13 0xb287d590 in QWidget::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#14 0xb29261bc in QFrame::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#15 0xb2b83118 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#16 0xb604792c in SIM::Coin3D::Quarter::QuarterWidget::viewportEvent(QEvent*) (this=0x12cd900, event=0xbeffcf00) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:996
#17 0xb208a090 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#18 0xb283ada0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb28432a8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0x01148af8 in  ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 2617] will be killed.

Quit anyway? (y or n) y
pi@raspberrypi:~/freecad-build/bin $

OS: Raspbian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.19.18385 (Git)
Build type: Debug
Branch: master
Hash: c314edcaf675dd261e757bbf7b2f8b97c7e72130
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Now I have no idea what else you can try. Maybe it’s a graphic driver problem.

Ok, thanks for your help anyway, much appreciated.
I’m not a developper, so I have not much idea than you of course.

However I have the RPI4 next to me, so I could:

  • try to compile Freecad 0.19 with Py2/Qt4?
  • try to compile Freecad 0.16 with Py2/Qt4 ? (because Papy told he ran 0.16 on RPI4 with success before this version was replaced by 0.18 in repo
    https://forum.freecadweb.org/viewtopic.php?f=12&t=37314#p317122 (french)
    I would like to see that by my own eyes, it could be a way to maybe track the bug?))
  • try to compile Freecad’s pivy in order to use it instead of pivy lib?

Could you guys tell me your opinion if such tries would make sens?

  • try to compile Freecad 0.19 with Py2/Qt4?

Yes, this should be possible. The current master branch still supports Py2 and Qt4.