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...)
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- »

For now I have compiled FreeCAD accordingly to below instructions by following the FreeCAD documentation:

Code: Select all

#install raspbian buster 2010-07-10
#update while first start
#reboot

git clone https://github.com/FreeCAD/FreeCAD.git freecad-source

sudo apt install cmake
sudo apt install libtool
sudo apt install swig
sudo apt install libboost-dev libboost-date-time-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-signals-dev libboost-thread-dev
sudo apt install libcoin-dev
sudo apt install libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libopencv-dev libproj-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev

#Py3 and Qt5
sudo apt install qtbase5-dev qttools5-dev libqt5opengl5-dev libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqt5x11extras5-dev libpyside2-dev libshiboken2-dev pyside2-tools python3-dev python3-matplotlib python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2uic
sudo apt install libocct*-dev
sudo apt install occt-draw
sudo apt install libsimage-dev
sudo apt install checkinstall

mkdir freecad-build
cd freecad-build

sudo cmake -DBUILD_QT5=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3.7 \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m \
    -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \
    -DPYTHON_PACKAGES_PATH=/usr/local/lib/python3.7/dist-packages/ \
    ../freecad-source

sudo make -j4
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Sun Sep 29, 2019 10:15 pm For now I have compiled FreeCAD accordingly to below instructions by following the FreeCAD documentation:
According to this same thread, page 2, you already compiled FreeCAD on the Raspberry Pi 4, so I don't understand why you are doing it again, or why you would need help again.

Code: Select all

sudo cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.7 ../freecad-source

sudo make -j4
In general you don't need all the Python variables, just the executable is enough.

Also, you don't need to run cmake, nor make with sudo. Compilation is not a system operation, it's creating a program in a directory that you own.

Also, I told you it may be good to have a debug version, so you should have added the debug option to cmake.

Code: Select all

cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source
make -j3
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: Sun Sep 29, 2019 10:36 pm According to this same thread, page 2, you already compiled FreeCAD on the Raspberry Pi 4, so I don't understand why you are doing it again, or why you would need help again.
You're totaly right, my bad, my english is not sharp enough sometimes. I meant "The last time I compiled...".
However I have pasted the code I used to compile last time, in case there is some obvious mistake.
I would avoid to compile again by starting with artificial errors due to my bad.

vocx wrote: Sun Sep 29, 2019 10:36 pm In general you don't need all the Python variables, just the executable is enough.
I had to do that because the path of python 3 wasn't find by Cmake otherwise.

vocx wrote: Sun Sep 29, 2019 10:36 pm
Also, you don't need to run cmake, nor make with sudo. Compilation is not a system operation, it's creating a program in a directory that you own.
Also, I told you it may be good to have a debug version, so you should have added the debug option to cmake.
This is exactly the kind of advices I'm looking for and which is useful to me :)
So, do not hesitate to tell me stuffs which seems obvious to you.
Now I have to compile again folowing your advices and those from Looo.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Mon Sep 30, 2019 6:30 pm This is exactly the kind of advices I'm looking for and which is useful to me :)
So, do not hesitate to tell me stuffs which seems obvious to you.
I mean, if you check the CompileOnUnix instructions, there is no sudo in the cmake or make commands.

Exactly, what are you trying to do? Re-compile pivy?
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- »

Ok no sudo necessary for Cmake, I will not do it. But the use of sudo was not a problem though, isn't it?
I'm going to recompile with debug=on as you said. I would like include Freecad's pivy as well.
I should also check soqt and Quarter as Looo said, but on this point I don't really get what it is about... I have to learn.
I should also ask to Papy because on french forum he told that he had installed Freecad 0.16 on RPI. I would know more about that.
But now no time, tomorrow I hope.
Thanks for your attention.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD and Raspberry Pi 4

Post by vocx »

-alex- wrote: Mon Sep 30, 2019 10:15 pm Ok no sudo necessary for Cmake, I will not do it. But the use of sudo was not a problem though, isn't it?
Compiling with sudo may be a problem. The generated files may be owned by "root". So, if later you want to modify them with your normal user "alex", you may not be able to do it. This is the problem with using sudo. You
I'm going to recompile with debug=on as you said.
You don't have to do a lot of things. You just have to do this

Code: Select all

cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source && make -j3
I would like include Freecad's pivy as well.
Why?
I should also check soqt and Quarter as Looo said, but on this point I don't really get what it is about... I have to learn.
But why?!

Don't just follow instructions without knowing what they are about!

I already told you to how to produce a debug version of FreeCAD. Try that first, and then if you need, then you can compile pivy.
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.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD and Raspberry Pi 4

Post by wmayer »

vocx wrote: Mon Sep 30, 2019 11:38 pm
-alex- wrote: Mon Sep 30, 2019 10:15 pm I would like include Freecad's pivy as well.
Why?
I should also check soqt and Quarter as Looo said, but on this point I don't really get what it is about... I have to learn.
But why?!
Well, this way it could be tested outside of FreeCAD to see if Coin3d works as expected. But Debian should already offer the python3-pivy package that provides all needed files so that there is no point in re-compiling yourself -- unless these packages of your Debian version are still broken.

Anyway, here is a Python3 example to check if it also crashes or displays the scene:

Code: Select all

import sys

from PySide2.QtWidgets import QApplication

from pivy.coin import SoSeparator
from pivy.coin import SoBaseColor
from pivy.coin import SbColor
from pivy.coin import SoCone

from pivy.quarter import QuarterWidget

app = QApplication(sys.argv)

root = SoSeparator()
col = SoBaseColor()
col.rgb = SbColor(1, 1, 0)
root.addChild(col)
root.addChild(SoCone())

viewer = QuarterWidget()
viewer.setSceneGraph(root)

viewer.setWindowTitle("minimal")
viewer.show()
sys.exit(app.exec_())
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: Mon Sep 30, 2019 11:38 pm You don't have to do a lot of things. You just have to do this

Code: Select all

cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source && make -j3
Ok, sorry, but I had to do this:

Code: Select all

sudo cmake -DBUILD_QT5=ON     -DPYTHON_EXECUTABLE=/usr/bin/python3.7    DCMAKE_BUILD_TYPE=Debug  -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m     -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so     -DPYTHON_PACKAGES_PATH=/usr/local/lib/python3.7/dist-packages/     ../freecad-source
(if no sudo and those compiling options I've got errors during cmake. Don't ask me why, if I remember I've found those instructions from Freecad compile documentation page. I used it as a workaround to my troubles. I don't paste errors here, maybe offtopic, but I could if you would).

Then sudo make (otherwise it does not compile):

Code: Select all

sudo make -j4
However pi user has usual permission:

Code: Select all

pi@raspberrypi:~/freecad-build/bin $ umask -S
u=rwx,g=rx,o=rx


Anyway, after 2 hours compiling:
(OFF TOPIC: For those who are interesting in performance of RPI4:
make -j4 -> 100% CPU compiling during 2hours, reaching over 2Go RAM sometimes, 63°C Max with passive heatsink ,no fan, ambient temperature 28°C)

I've got the following callstack (similar with the one Werner mentioned above)

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.19R17651 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0xae087210 (LWP 23883)]
using qt5ct plugin
[New Thread 0xa7fbe210 (LWP 23884)]
D-Bus global menu: no
[New Thread 0xa1814210 (LWP 23885)]
[New Thread 0xa1013210 (LWP 23886)]
[New Thread 0xa0812210 (LWP 23887)]
D-Bus system tray: no
[New Thread 0x9edff210 (LWP 23888)]
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.
0xafcbde74 in XDefaultScreenOfDisplay () from /usr/lib/arm-linux-gnueabihf/libX11.so.6
(gdb) bt full
#0  0xafcbde74 in XDefaultScreenOfDisplay () at /usr/lib/arm-linux-gnueabihf/libX11.so.6
#1  0xb3de3ad0 in  () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#2  0xb3de4454 in glxglue_init () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#3  0xb3ddd0e0 in cc_glglue_instance () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#4  0xb3c8e120 in SoGLRenderActionP::isDirectRendering(SoState const*) const () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#5  0xb3c90358 in SoGLRenderActionP::render(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#6  0xb3c905a0 in SoGLRenderAction::beginTraversal(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#7  0xb3c8a2fc in SoAction::apply(SoNode*) () at /usr/lib/arm-linux-gnueabihf/libCoin.so.80c
#8  0xb60fa454 in Gui::SoBoxSelectionRenderAction::apply(SoNode*) (this=0xec9270, node=0xe63b28) at /home/pi/freecad-source/src/Gui/SoFCSelectionAction.cpp:1180
        __PRETTY_FUNCTION__ = "virtual void Gui::SoBoxSelectionRenderAction::apply(SoNode*)"
#9  0xb61e2544 in Gui::View3DInventorViewer::renderScene() (this=0xf08700) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:1744
        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 = 0xec9270
        state = 0xed7bd8
#10 0xb61e1e60 in Gui::View3DInventorViewer::actualRedraw() (this=0xf08700) at /home/pi/freecad-source/src/Gui/View3DInventorViewer.cpp:1627
#11 0xb618798c in SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*) (this=0xf08700, event=0xbeffcf20) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:922
        w = 0xf07358
        __PRETTY_FUNCTION__ = "virtual void SIM::Coin3D::Quarter::QuarterWidget::paintEvent(QPaintEvent*)"
#12 0xb6190fcc in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::paintEvent(QPaintEvent*) (this=0xf08700, event=0xbeffcf20) at /home/pi/freecad-source/src/Gui/Quarter/SoQTQuarterAdaptor.cpp:717
#13 0xb30fb590 in QWidget::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#14 0xb31a41bc in QFrame::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#15 0xb3401118 in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#16 0xb6187b5c in SIM::Coin3D::Quarter::QuarterWidget::viewportEvent(QEvent*) (this=0xf08700, event=0xbeffcf20) at /home/pi/freecad-source/src/Gui/Quarter/QuarterWidget.cpp:996
#17 0xb2908090 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#18 0xb30b8da0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb30c12a8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0x00f07358 in  ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 23868] will be killed.

Quit anyway? (y or n) y
pi@raspberrypi:~/freecad-build/bin $ 
No more to say.. Any comments appreciated. Thanks for attention.

Edit: ambient temperature added about off topic informations
Last edited by -alex- on Wed Oct 02, 2019 5:33 pm, edited 2 times 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: Tue Oct 01, 2019 8:13 am Anyway, here is a Python3 example to check if it also crashes or displays the scene/:
Thank you for the tips Werner, I've got a window with the scene:
2019-10-02-000018_1920x1080_scrot.png
2019-10-02-000018_1920x1080_scrot.png (170.8 KiB) Viewed 3495 times


It seems ok isn't it? So now... any idea? :)
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD and Raspberry Pi 4

Post by wmayer »

It seems ok isn't it? So now... any idea?
Does this Quarter widget show a cone? From your screenshot I cannot see that.
Post Reply