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
XiaoShiZiTwenty
Posts: 6
Joined: Sat Dec 12, 2020 6:47 pm

Re: FreeCAD and Raspberry Pi 4

Post by XiaoShiZiTwenty »

-alex- wrote: Fri May 08, 2020 4:22 pm For those who are not so familiar with Linux and admin stuffs (like me), if you want compile FreeCAD 0.19 on Ubuntu 20.04LTS, please see below commands you have to enter in terminal. Step by step:

1- install Ubuntu 20.04: I have a RPI4-4GB, I chose the 64Bit release to test it, if you have a RPI4-1or 2GB you should better install 32Bit release
https://ubuntu.com/download/raspberry-pi

2- install a desktop you like: I chose Xfce, I have some troubles with it (desktop almost freezing somtimes, I have to reboot the systeme by using tty1=Ctrl+AltF1). Edit: Ubuntu settings scroll menu ->disable screensaver and/or disable lock screen: then no troubles with Xfce desktop.

3- Update the system:

Code: Select all

sudo apt-get update
sudo apt-get upgrade

4- Open a terminal then download the FreeCAD source code:

Code: Select all

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

5- Then install dependancies following Compile_on_Linux:
Edit 2020-05-19: add some commands were missing (build-essential libtool lsb-release cmake-curses-gui). Thank you @RustyM for feedback ;-)

Code: Select all

sudo apt install build-essential libtool lsb-release cmake cmake-gui cmake-curses-gui libboost-date-time-dev libboost-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 libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2uic qtbase5-dev qttools5-dev swig
6- You will get:

Code: Select all

E: Unable to locate package libboost-signals-dev
E: Unable to locate package python3-pyside2uic
Don't mind.

7- Install PyQt5 package then substitute following files by using symlinks:

Code: Select all

sudo apt-get install pyqt5-dev
sudo apt-get install pyqt5-dev-tools
cd /usr/bin/
ln -s pyrcc5 pyside2-rcc
ln -s pyuic5 pyside2-uic
 

8- Create freecad-buid folder then compile the source code inside it:

Code: Select all

cd
mkdir freecad-build
cd freecad-build/
cmake ../freecad-source -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DUSE_PYBIND11=ON
Just for your information, at this point you should get a summary report which looks like this:

Code: Select all

==============
Summary report
==============

-- Build type:          
-- Compiler:            /usr/bin/c++ (9.3.0)
-- Flags:               -Wall -Wextra -Wno-write-strings 
-- Standard:            Requires C++11
-- Python:              [/usr/bin/python3] [.cpython-38-aarch64-linux-gnu]
-- PCL:                 not enabled
-- pybind11:            not enabled
-- Boost:               1.71.0
-- XercesC:             [/usr/lib/aarch64-linux-gnu/libxerces-c.so] [/usr/include]
-- ZLIB:                1.2.11
-- PyCXX:               [/home/ubuntu/freecad-source/src]
-- OCC:                 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBin;TKBool;TKBO;TKCDF;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEP;TKSTEPBase;TKSTEPAttr;TKHLR;TKFeat]
-- SMESH:               build internal
--  MEDFile:            [/usr/lib/aarch64-linux-gnu/libmedC.so] [/usr/include]
--  HDF5:               1.10.4
--  VTK:                7.1.1
-- NETGEN:              not enabled
-- SWIG:                4.0.1
-- Eigen3               3.3.7
-- Qt5Core:             5.12.8
-- Qt5Network:          5.12.8
-- Qt5Xml:              5.12.8
-- Qt5XmlPatterns:      5.12.8
-- Qt5Widgets:          5.12.8
-- Qt5PrintSupport:     5.12.8
-- Qt5OpenGL:           5.12.8
-- Qt5Svg:              5.12.8
-- Qt5UiTools:          5.12.8
-- Qt5Concurrent:       5.12.8
-- Qt5WebKitWidgets:    5.212.0
-- Shiboken2:           5.14.0 [/usr/lib/aarch64-linux-gnu/cmake/Shiboken2-5.14.0] [/usr/include/shiboken2;/usr/include/python3.8]
-- PySide2:             5.14.0 [/usr/lib/../include/PySide2]
-- PySide2Tools:        [/usr/bin/pyside2-uic] [/usr/bin/pyside2-rcc]
-- Freetype:            2.10.1
-- OpenGLU:             /usr/lib/aarch64-linux-gnu/libGLU.so [/usr/lib/aarch64-linux-gnu/libGLU.so][/usr/include]
-- Coin3D:              [/usr/lib/aarch64-linux-gnu/libCoin.so] [/usr/include]
-- SPNAV:               [/usr/lib/libspnav.so] [/usr/include]
-- Matplotlib:          3.1.2
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             not found
Then compile the code:

Code: Select all

make -j3
Important! : about make command, you should use -j3 option, not -j4 if you install 64Bit release of Ubuntu like me, otherwise you will overshoot 4GB RAM -> RPI4 freezing.
IMHO, if you have a RPI4-1GB or 2GB: you should install 32Bit Ubuntu then compile with make -j1 or -j2 Max (during the night...takes about 3 or 4 hours)

9- Your RPI4 will compile and heat (good cooling is recomended) during 3 or 4 hours

10- you get FreeCAD 0.19 !

11- Launch it:

Code: Select all

cd freecad-build/bin/
./FreeCAD

12- Enjoy FreeCAD 0.19 with great features on you RPI4! :D
Thx -alex- !
Followed your tutorial on a fresh install on the RPi4 8GB SSD1TB Geekworm housing X829+X735.
Here're some minor tweaks to do to get it build and be running from the sidebar:
1.
2.
  • CTRL+ALT+F1 didn't work, using CTRL+ALT+F2/F8 when only the mouse moves but nothing else happens opens the text login where a reboot can be done.
  • Also in Software & Updates add the Developer Options Pre-released .
5.
  • Each-one had to be entered one by one instead of copy paste and run at once.
    So sudo apt install build-essential CR wait to install next sudo apt install libtool etc. (sometimes you'll have to confirm Y and press Enter) to work on the RPi4 8GB Ubuntu Desktop 20.10 64 bit SSD.

Code: Select all

sudo apt install build-essential
sudo apt install libtool
sudo apt install lsb-release
sudo apt install cmake
sudo apt install cmake-gui
sudo apt install cmake-curses-gui
sudo apt install libboost-date-time-dev
sudo apt install libboost-dev
sudo apt install libboost-filesystem-dev
sudo apt install libboost-graph-dev
sudo apt install libboost-iostreams-dev
sudo apt install libboost-program-options-dev
sudo apt install libboost-python-dev
sudo apt install libboost-regex-dev
sudo apt install libboost-serialization-dev
sudo apt install libboost-signals-dev
sudo apt install libboost-thread-dev
sudo apt install libcoin-dev
sudo apt install libeigen3-dev
sudo apt install libgts-bin
sudo apt install libgts-dev
sudo apt install libkdtree++-dev
sudo apt install libmedc-dev
sudo apt install libocct-data-exchange-dev
sudo apt install libocct-ocaf-dev
sudo apt install libocct-visualization-dev
sudo apt install libopencv-dev
sudo apt install libproj-dev
sudo apt install libpyside2-dev
sudo apt install libqt5opengl5-dev
sudo apt install libqt5svg5-dev
sudo apt install libqt5webkit5-dev
sudo apt install libqt5x11extras5-dev
sudo apt install libqt5xmlpatterns5-dev
sudo apt install libshiboken2-dev
sudo apt install libspnav-dev
sudo apt install libvtk7-dev
sudo apt install libx11-dev
sudo apt install libxerces-c-dev
sudo apt install libzipios++-dev
sudo apt install occt-draw
sudo apt install pyside2-tools
sudo apt install python3-dev
sudo apt install python3-matplotlib
sudo apt install python3-pivy
sudo apt install python3-ply
sudo apt install python3-pyside2.qtcore
sudo apt install python3-pyside2.qtgui
sudo apt install python3-pyside2.qtsvg
sudo apt install python3-pyside2.qtwidgets
sudo apt install python3-pyside2uic
sudo apt install qtbase5-dev
sudo apt install qttools5-dev
sudo apt install swig
13. Add icon on the sidebar of Ubuntu Desktop 20.10 to start FreeCAD 0.19 with one LMB click:

Code: Select all

cd freecad-build/bin/
gedit FreeCAD.desktop
Replace username with your username!

Code: Select all

[Desktop Entry]
Version=0.19
Name=FreeCAD19
Exec=/home/username/freecad-build/bin/FreeCAD
Terminal=false
Icon=/home/username/freecad-build/share/Mod/Start/StartPage/images/freecad.png
Type=Application
Comment=Feature based Parametric Modeler 3D FreeCAD 0.19
Ctrl+S to Save the file.
Ctrl+Q to Quit Gedit.

Back in the terminal enter following to place it in the reachable directory for the sidebar.

Code: Select all

cp ./FreeCAD.desktop ~/.local/share/applications/
Open the Show Application (Nine dots left down corner in the sidebar) and scroll down to the FreeCAD19 Icon(Not the fancy icon of FreeCAD yet)
RMB (Right Mouse Button) click on the icon and select Add to Favorites.
Now you'll see the Fancy FreeCAD icon in your Sidebar and ready to be clicked once and run FreeCAD0.19 on the RPi4 8GB Ubuntu Desktop 20.10 ;-)
Minor remark, the Show Details links to the FreeCAD 0.18 witch is in the software list of Ubuntu Desktop 20.10, not to the actual 0.19.

Kind Regards, big thanxs to -alex- (MERCI BEAUCOUP! <3 ) for his helpful tutorial and enjoy the power FreeCAD brought onto the RPi4,
XSZ, 小獅子

P.S. Now working my way thru to get the path workbench and the Laser on the Pi ;-)
Simple. AddOn Manager working on the RPi4 Ubuntu Desktop 20.10 64bit out of the box. No additional commands in terminal. Just open Addon manager and select/Install the AddOn. Big plus for the team working on the development of FreeCAD!
My purpose is to have my designs made with FreeCAD on the RPi4, process the G-code for 3d printing (Creality Ender 5 Plus), laser engrave and cut (3018 with 5.5W for Wood, paper, plexi), CNC Milling (3018 wood/plastic) and in the near future build a 4 or preferable 5 axis CNC milling machine. Maybe send from the RPi or use another RPi with octopi or just by the SD-card for now. Would be nice indeed to design from the Pi and in the end process the G-code and send it to the steppers all from the same RPi.
A -alex- Merci pour vos renseignement ;-) J'ai pris note. 88
Last edited by XiaoShiZiTwenty on Sun Dec 13, 2020 9:08 pm, edited 3 times in total.
Kind Regards,

XiaoShiZi, 小獅子.
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

XiaoShiZiTwenty wrote: Sat Dec 12, 2020 8:50 pm Here're some minor tweaks to do to get it build and be running from the sidebar:
Welcome here and a lot of thanks to your feedback and additional tips, xiexie ;)
Much appreciated.
P.S. Now working my way thru to get the path workbench and the Laser on the Pi
Offtopic: I don't know what is your strategy, RPI4 + FreeCAD + Marlin or grbl firmware + stepper drivers I assume? JFYI maybe you could be interested in this direct control strategy RPI4 + FreeCAD + stepper drivers. Raspigcd is for RPI3, and the pulse rate is pretty limited, but RPI4 could get better performances. BTW I didn't test it. See here: https://github.com/pantadeusz/raspigcd
Do not hesitate to open another thread in Path subforum if you want to talk about.
See you, 88
Simo190
Posts: 2
Joined: Wed Dec 23, 2020 9:07 pm

Re: FreeCAD and Raspberry Pi 4

Post by Simo190 »

Please help me, I just try to compile on my Rasp4Pi 8GB with Debin as OS,
my Rasp compile all gone ok, but when i try to start with terminal, Freecad start but all of kind of action i do (new file....) produce the same result, the program closed itself and I receive this messagge on the terminal.
Program received signal SIGSEGV, Segmentation fault.
#0 /lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer+0) [0xb17c9120]
I use the guide posted on this thread
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FreeCAD and Raspberry Pi 4

Post by -alex- »

Simo190 wrote: Wed Dec 23, 2020 9:13 pm Please help me, I just try to compile on my Rasp4Pi 8GB with Debin as OS...Program received signal SIGSEGV, Segmentation fault.
Hi and welcome, please give us more information about your system, are you using Debian OS or Raspberry OS? 32bit or 64bit?
Please give your full FreeCAD information (see http://forum.freecadweb.org/viewtopic.php?f=3&t=2264)
FYI and AFAIK FreeCAD 0.18 and 0.19 still crashes with segfault issue on RaspberryOS 32bit, but as a workarround you can compile it with python2 and Qt4 libraries, then it works, see here: https://forum.freecadweb.org/viewtopic. ... 60#p339874
But if I were you I would compile it on RaspberryOS 64bit beta test, because it doesn't not crash even if you compile it with python3 and Qt5, furthermore you'll take advantage of V3D Broadcom graphic driver and get pretty fast graphical performances. Just follow Compile_on_Linux instructions.
Finally you can also compile it on Ubuntu 64 bit (I don't know about 32B), that works but graphical performances are deprecated (CPU computation), see here: https://forum.freecadweb.org/viewtopic. ... 60#p396652
Simo190
Posts: 2
Joined: Wed Dec 23, 2020 9:07 pm

Re: FreeCAD and Raspberry Pi 4

Post by Simo190 »

-alex- wrote: Thu Dec 24, 2020 6:25 am
Simo190 wrote: Wed Dec 23, 2020 9:13 pm Please help me, I just try to compile on my Rasp4Pi 8GB with Debin as OS...Program received signal SIGSEGV, Segmentation fault.
Hi and welcome, please give us more information about your system, are you using Debian OS or Raspberry OS? 32bit or 64bit?
Please give your full FreeCAD information (see http://forum.freecadweb.org/viewtopic.php?f=3&t=2264)
FYI and AFAIK FreeCAD 0.18 and 0.19 still crashes with segfault issue on RaspberryOS 32bit, but as a workarround you can compile it with python2 and Qt4 libraries, then it works, see here: https://forum.freecadweb.org/viewtopic. ... 60#p339874
But if I were you I would compile it on RaspberryOS 64bit beta test, because it doesn't not crash even if you compile it with python3 and Qt5, furthermore you'll take advantage of V3D Broadcom graphic driver and get pretty fast graphical performances. Just follow Compile_on_Linux instructions.
Finally you can also compile it on Ubuntu 64 bit (I don't know about 32B), that works but graphical performances are deprecated (CPU computation), see here: https://forum.freecadweb.org/viewtopic. ... 60#p396652
Hi!
Many thanks for your answer!
Now I trying to compile FreeCad on OS Raspeberry 32bit.
In the meantime I was reading that for a perfect use it’s be better a OS 64bit.
I will try again to compile with phyton2 as it’s wrote in your link posted.
Maybe with more probability I will set my Rasp with Ubuntu 20 64 bit.
Thanks again!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: FreeCAD and Raspberry Pi 4

Post by jmaustpc »

Simo190 wrote: Thu Dec 24, 2020 9:25 am In the meantime I was reading that for a perfect use it’s be better a OS 64bit.
You have 8GB of RAM, you can not use it all properly with a 32bit OS, you need a 64bit OS for that. 32bit Raspberian uses a trick to split that 8GB ram into pieces so you can use it all but no one single process can use more than a theoretical maximum of 4GB.

So you really want a 64bit OS.
Simo190 wrote: Thu Dec 24, 2020 9:25 amphyton2

Python2 is obsolete and has been for a long time, it is still mostly supported in FreeCAD but you will loose some functionality and FreeCAD will drop all support presumably with the next release, even if your OS does still offer Python2.

My advice above is general in nature and not specific to Raspberry Pi, I have no idea of the specific Raspberry Pi requirements or complications.

Jim
mel
Posts: 7
Joined: Fri Dec 20, 2019 1:24 pm

Re: FreeCAD and Raspberry Pi 4

Post by mel »

raspberry pi 4 4Gb + raspberry pi OS 64 bits (beta) + FreeCAD 0.19 (23841)
I have already installed it and it is working reasonably well, without errors, I have used:

Code: Select all

sudo apt install build-essential libtool lsb-release cmake cmake-gui cmake-curses-gui libboost-date-time-dev libboost-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 libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2uic qtbase5-dev qttools5-dev swig libsimage-dev doxygen libcoin-doc libspnav-dev
git clone https://github.com/FreeCAD/FreeCAD.git freecad-source
cd freecad-source
mkdir build
cd build
cmake .. -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3
make -j4
I start it with:

Code: Select all

~/freecad-source/build/bin/FreeCAD
I don't know how long it took, at least a couple of hours.
max temperature 57ºC. Whit a passive cooler box
WillAdams
Posts: 2
Joined: Fri Feb 22, 2019 5:10 pm

Re: FreeCAD and Raspberry Pi 4

Post by WillAdams »

I was able to install FreeCAD in Raspbian and it launches from the icon as expected, but when I try to create a new blank document, it vanishes.

Is there any way to repair that installation and get it working?

Does anyone have an OS image which has FreeCAD up and running for the rPi 4?
User avatar
papy
Posts: 245
Joined: Sun Sep 09, 2018 10:00 am
Location: Moselle

Re: FreeCAD and Raspberry Pi 4

Post by papy »

WillAdams wrote: Thu Apr 22, 2021 6:31 pm I was able to install FreeCAD in Raspbian and it launches from the icon as expected, but when I try to create a new blank document, it vanishes.

Is there any way to repair that installation and get it working?

Does anyone have an OS image which has FreeCAD up and running for the rPi 4?
Hi,
You have to compile the freecad sources.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: FreeCAD and Raspberry Pi 4

Post by jmaustpc »

WillAdams wrote: Thu Apr 22, 2021 6:31 pm I was able to install FreeCAD in Raspbian and it launches from the icon as expected, but when I try to create a new blank document, it vanishes.

Is there any way to repair that installation and get it working?

Does anyone have an OS image which has FreeCAD up and running for the rPi 4?
Where did you install it from? Or did you compile it yourself? By the way which Pi4 model have you got? Raspberian is now called Raspberrypi OS, if I understand correctly, so I just wondered if you are running some very old version or something. If you start FreeCAD from the command line then sometimes you will get an error message that may help, you can also start it with the log option and read the log file which may help.

Are you running Raspberry Pi OS 32bit (the default) or the experimental 64bit? If the latter, the last time I looked I think it was missing some GPU functionality, specifically I think it was that it would not hardware accelerate video or something like that, which might mean its OpenGL support may not be brilliant. I have not tried it myself but someone told me that they ran Ubuntu on their raspberry so that they could have a 64bit OS that supported all the hardware including the GPU.
Post Reply