FreeCAD and Raspberry Pi 4

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
Post Reply
User avatar
kkremitzki
Veteran
Posts: 2515
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: FreeCAD and Raspberry Pi 4

Post by kkremitzki »

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.
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.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Tue Oct 01, 2019 9:56 pm (if no sudo and those compiling options I've got errors during cmake. ... I don't paste errors here, maybe offtopic, but I could if you would).

Then sudo make (otherwise it does not compile):
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.

Code: Select all

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.
Last edited by vocx on Wed Oct 02, 2019 6:06 am, edited 1 time in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

wmayer wrote: Tue Oct 01, 2019 10:58 pm
It seems ok isn't it? So now... any idea?
Does this Quarter widget show a cone? From your screenshot I cannot see that.
Ah ok, so, no it doesn't show no any cone. Just a kind of screenshot as the picture shows.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Wed Oct 02, 2019 5:12 am 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
Minimal_cone.png (16.38 KiB) Viewed 3211 times
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD and Raspberry Pi 4

Post by Kunda1 »

Super cool!
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
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD and Raspberry Pi 4

Post by wmayer »

-alex- wrote: Wed Oct 02, 2019 5:12 am Ah ok, so, no it doesn't show no any cone. Just a kind of screenshot as the picture shows.
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

Code: Select all

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

Code: Select all

#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!
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

kkremitzki wrote: Tue Oct 01, 2019 11:08 pm 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,
vocx wrote: Tue Oct 01, 2019 11:59 pm 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.
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 :?
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)

Code: Select all

mkdir freecad-build
then changed owner of files in freecad-source directory

Code: Select all

sudo chown -R pi freecad-source
then cmake

Code: Select all

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.

Code: Select all

make -j4
No warnings.

I ran FreeCAD, still crashing at creating of a new document.
Last edited by -alex- on Wed Oct 02, 2019 10:33 pm, edited 1 time in total.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

wmayer wrote: Wed Oct 02, 2019 9:43 am 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

Code: Select all

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

Code: Select all

#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
and rebuild FreeCADGui. It's sufficient to invoke make FreeCADGui/fast
Ok, so

Code: Select all

pi@raspberrypi:~/freecad-source/src/Gui $ nano Application.cpp
Then I've change QT version 5,12,0 -> 5, 11,0
then

Code: Select all

pi@raspberrypi:~/freecad-build $ make FreeCADGui/fast
But Freecad still crash with same error:

Code: Select all

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 :|

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)
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Wed Oct 02, 2019 10:06 pm ...
But Freecad still crash with same error:
...
Version: 0.19.17651 (Git)
...
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.

Code: Select all

cd freecad-source
git pull
Then cmake and make again.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

vocx wrote: Wed Oct 02, 2019 11:27 pm Please provide the backtrace with the debugger gdb, as mentioned earlier, not only the message of the crash..... you should test with the latest code.
Sure, below the backtrace, updated version.

Code: Select all

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)
Post Reply