FreeCAD on Raspberry Pi 4

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

24 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

Leave a comment

Your email address will not be published. Required fields are marked *