FreeCAD on Raspberry Pi 4

Hey! This is really old! FreeCAD 0.19 is in the Raspberry Pi OS Bullseye repo now:

sudo apt install freecad

FreeCAD window displaying red and white traffic cone model
FreeCAD 0.18.4 running on a Raspberry Pi 4

FreeCAD and the Raspberry Pi haven’t always got on too well. For complex technical reasons the standard package would load and immediately crash on a Raspbian system. For user reasons, this was just another annoyance.

Recent releases seem to run fairly well on a Raspberry Pi 4, though, but only after building them from source. Here’s a method that got FreeCAD 0.18.4 running for me. It’s lightly modified from FreeCAD forum MartijnD‘s post:

sudo apt install cmake build-essential libtool lsb-release swig 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 libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libopencv-dev libproj-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev qt4-dev-tools libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libpyside-dev pyside-tools python-dev python-matplotlib python-pivy python-ply python-pyside libocct*-dev occt-draw libsimage-dev doxygen libcoin-doc dh-exec libspnav-dev

wget https://github.com/FreeCAD/FreeCAD/archive/0.18.4.zip

unzip 0.18.4.zip

rm 0.18.4.zip

mkdir freecad-build

cd freecad-build

cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7.so  -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/  ../FreeCAD-0.18.4/

make -j4

Notes:

  • The only modifications I made to Martijn’s method were in the Python paths in the cmake command. Some of the paths given aren’t valid any more on an up-to-date Buster system
  • I built this on a Raspberry Pi 4 with 4 GB of RAM. It takes quite a bit of free storage: I wouldn’t attempt to build this with less than 4 GB free
  • make -j4 took 95 minutes, and even with a fan my Raspberry Pi 4 was at 70°C
  • Yes, it’s using Python 2.7, but it works
  • I’ve got no idea how to make it install properly, but it runs from the freecad-build/bin directory.

If you want to learn how to use it, look at the tutorials: even the Raspberry Pi Foundation have written some. The UK Traffic Cone model you can have: it’s what I made to learn a bit more about FreeCAD. Don’t worry, I’m still on Team OpenSCAD …

32 comments

  1. Hi,
    If you’re playing with compiling things that take a while on the Raspberry Pi, then installing ccache is a good idea.

    It’s also possible to setup cross compiling on your own computer, but this is a bit more involved.

    S

  2. I cut the compile time in half on my 4GB PI 4 bu\y using
    make -j8

    I had 8 threads running at around 50% of each CPU \. E\When one waits on a write the other gets 100%. The compile time speeds up a bunch. I assume there is a top end around -j 12 but I haven’t tried it.

  3. No crashes – I just tried it here, making new projects and it worked like a champ.

    If there are issues, bring it up with the developer. I just compiled the thing, it’s not my kid.

  4. Hi, thanks for your tutoral.

    Do you have an idea how to build it on Manjaro for Raspberry Pi 4 ?

  5. Uninstalled the the faulty version I installed with ADD / REMOVE software.
    Followed these instructions to the letter and all seemed fine. Ran the program from the folder it compiled to from the terminal but the result is the same. It crashes instantly.

  6. I just used the instructions to compile 0.19. Worked like a charm

  7. It worked for me.
    Thank you “scruss”.

    I did some more operations:
    > sudo make install
    > rm -rf FreeCAD-0.18.4 freecad-build
    Afterwords (within Pixel), I went to [StartButton]->Preferences->Main Menu Editor …
    … Graphics->FreeCAD->Properties …
    … and I changed the Path to “/usr/local/bin/FreeCAD”

  8. Worked a treat thanks.

    & thanks to Emilian Turbatu for the extra tips

  9. Works great on my PI4 4G… Has anyone been able to get FEM to work with this method? It doesn’t seem to want to mesh using Gmsh, and I can’t fine where the Calculix binaries directory should be. Do you think this is a seperate install?

  10. Hmm, fails at cmake. I even installed latest cmake and it still finishes with errors. Has anyone got this working on a current Raspberry pi OS

    Oct 23 2010

  11. Following instructions exactly to compile fails at cmake, installing precompiled version (by botspot): same problem, or installing from RPI add new software (repository version), installs OK, it runs, but it crashes when you start new project.
    Cmake error log:
    equired components:

    filesystem;program_options;regex;system;thread

    Not found, install the components:

    filesystem;program_options;regex;system;thread

    =============================================

    — Configuring incomplete, errors occurred!
    See also “/home/pi/freecad-build/CMakeFiles/CMakeOutput.log”.
    See also “/home/pi/freecad-build/CMakeFiles/CMakeError.log”.
    make: *** [Makefile:1722: cmake_check_build_system] Error 1

  12. if there’s a problem with botspot’s version, maybe ask them? A precompiled version can’t have cmake problems because it’s precompiled.

  13. During cmake, I get an error “Unable to find the Boost header files.” Is my python installation incomplete or what ?

  14. Can’t say for sure, but there are a lot of boost libraries to install:
    sudo apt install 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

  15. Worked for me / thanks 🙂

    Copy/paste verbatim, without understanding it all very well really, but it worked.

    I left the version installed via the ‘Add / Remove Software’ GUI Preferences utility in place and have just updated the menu item to point to this fix version.

    The GUI utility installed version was suffering the same ‘crash when opening new’ symptom reported in this blog.

    Pi400 overclocked to 2.2Ghz with make J8 tip resulted in compile time of around half an hour.

  16. $ ./FreeCAD
    worked for me.
    I’ve been trying and trying and trying for weeks to get FreeCAD to run and not crash on open new file. On rp4b as a replacement for a computer. While it wont run via main menu options, it DOES run via command prompt $ ./FreeCAD from the ~/freecad-build/bin folder.
    Thank you HUGE!

  17. These are the instructions used to install FreeCAD-0.19.1 oto my Pi 400. Seems to have worked fine. The Main Menu Editor allowed installation from freecad-build/bin and an icon downloaded from the net as an image. Thankyou for all you have done.

    ————————————————————

    sudo apt install cmake build-essential libtool lsb-release swig 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 pencv-dev libproj-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev qt4-dev-tools libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libpyside-dev pyside-tools python-dev python-matplotlib python-pivy python-ply python-pyside libocct*-dev occt-draw libsimage-dev doxygen libcoin-doc dh-exec libspnav-dev

    wget https://github.com/FreeCAD/FreeCAD/archive/0.19.1.zip

    unzip 0.19.1.zip

    mkdir freecad-build

    cd freecad-buil

    cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \ -DPYTHON_INCLUDE_DIR=/usr/include/python2.7m \ -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7m.so \ -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/ ../FreeCAD-0.19.1/

    make -j4

    =======================================

  18. Thanks, Peter. Looks much the same. There are a couple of typos in your apt line, including some missing libraries (libgts*, libeigen*, etc) so I’d stick with the apt line I specified. Also not sure about the “python2.7m” entries in the cmake line, which my system doesn’t know anything about.

  19. Thanks Scruss. I am no expert on Linux picking up what little I know about Linux by hit and miss since retirement. Basically all I did was to use either your or Martins instructions when the other didn’t work by copy off the blog and paste into terminal only hand changeing 0.18.4 to 0.19.1. Martins were the first two instructions and yours were the remainder. The main drive of my contribution was get a full working set in one place so that others with my level of ignorance can more easily cope.

    I noted earlier comments anout Python 2.7 may become redundant but took the simple copy and paste route of “if it ain’t broke don’t fix it”. I have noticed that my Rasperian OS carries 2.7 and 3.7

    I noticed tyhe final d in build on cd instruction is missing

  20. With the Argon 1 case on the Pi4 I rarely saw above 51* during the build process I high recommend it to anyone after a good case for overclocking and heavy work loads

  21. Argon 1 looks neat, but it’s not cheap — and I’d have to buy replacement HDMI cables to use it

  22. Hi Scruss,
    Also now have this working today also on Twister-OS with your FreeCAD v0.18.4 doc. with one additional fix:

    Error: cmake reported error msg “VTK Not Found” :
    Fix: sudo update-alternatives –install /usr/bin/vtk vtk /usr/bin/vtk6 10
    Hardware: Raspberry Pi 400
    OS: Raspian Buster (32 bit)
    OS: Twister OS 2.0.3 (based on 32 bit Raspian)

    P.S I hope to test/verify 0.19.1 on this platform build soon also and using the additional suggestions from PeterHird.
    Thank you for your help guys 🙂

  23. This is a confirmation of this technique for Twister OS and FreeCAD 0.19.2.

    AIM: Upgrade on Twister-OS of installed/verified Freecad 0.18.4 to FreeCAD 0.19.2

    This script follows on from a successful Freecad v0.18.4 install using Scruss’s doc. verbatim.
    Script-2 applies Peter Hird’s additional notes to a FreeCAD V0.19.2 upgrade on a Twister-OS Pi400 platform.
    Doc. Source: scruss.com/blog/2020/02/16/freecad-on-raspberry-pi-4/

    Script-2:
    step-0: rename /pi/freecad-build directory to /pi/freecad-build-v0.18.4 (I used the file manager GUI to do this)
    step-1: wget https://github.com/FreeCAD/FreeCAD/archive/0.19.2.zip
    step-2: unzip 0.19.2.zip
    step-3: mkdir freecad-build
    step-4: cd freecad-build
    step-5: cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \ -DPYTHON_INCLUDE_DIR=/usr/include/python2.7m \ -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7m.so \ -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/ ../FreeCAD-0.19.2/
    step-6: make -j4
    step-7: Execute ~/freecad-build/bin/FreeCAD script to start FreeCAD V0.19.2

    Verification(s):
    1. FreeCAD 0.19.2 executed via GUI file manager via /pi/freecad-build/bin/freecad and started successfully
    2. Open new document within Freecad successfully (i.e. no crash 🙂

    Hardware: Raspberry Pi400
    OS: Twister OS Version 2.0.3
    App: FreeCAD v0.19.2

    Hope this proves helpful, Andrew

  24. Argon One is a definite yes. If it had been available from the outset, I wouldn’t have wasted money on all those “cheap” cases. Some are noisy and some just seem to box in the heat. The full-size HDMI ports are a huge plus, especially if you have to connect to a VGA converter. Micro ports are more prone to damage, and it seems, manufacturing defects. I have an 8 GB Pi 4 with no video output at all.

  25. Do you have updated build instructions for PiOS Bullseye? I’ve noticed that qt4 is dead in bullseye, so is python2.7…

  26. Nope, haven’t touched it in years. It’s in the repo for Bullseye:
    sudo apt install freecad

Comments are closed.