Banner

Banner
Ramast
Linux Developer

Thursday, November 8, 2018

How I compiled FreeCAD in Gentoo (2018 Guide) [ updated 2020 ]

Compiling FreeCAD on gentoo


Introduction:

While you could download FreeCad binary that would work out of the box with 0 hassle, it was slow and not very stable (lot of segmentation errors on my gentoo machine.

There used to be gentoo ebuild for freecad but I couldn't find it during the time of writing this.

I've documented the steps I followed to compile FreeCAD and I am posting it here in case someone finds it useful.

Please note that while compiling from source reduced crashes and increased speed a lot, it didn't help with importing SVG problem (still gives segmentation error).

Download FreeCAD source code

Emerge required packages


echo "sci-libs/vtk X imaging qt5 boost tbb rendering" > /etc/portage/package.use/vtk
echo "dev-libs/xerces-c iconv icu" > "/etc/portage/package.use/xerces-c"

emerge xerces-c

emerge libmed

# Ensure it's version 3 with -static-libs (disable static-libs)
media-libs/coin

# Adding qt repo overlay using layman
emerge app-portage/layman
layman -a qt
layman -E qt



# If u started getting errors related to boost while compiling FreeCAD, consider re-emerge boost
emerge -1 boost


# If getting error
No rule to make target '/usr/lib64/libmedC.so', consider re-emerge libmed


Installing Opencascade

You can either emerge opencascade

emerge libopencascade (+tbb +vtk)

or build it yourself.
At time of writing the available version in portage is 6.9.1-r2 which caused some crashes in FreeCAD
If you couldn't find newer build, It's better that you compile it and install it yourself.

wget 'https://www.opencascade.com/system/files/occt/OCC_7.3.0_release/opencascade-7.3.0.tgz'
(extract and cd into the package)
cmake -DUSE_VTK=1 -DCMAKE_BUILD_TYPE=Release .
make
make install


Finally compile FreeCAD

cmake -DFREECAD_USE_EXTERNAL_PIVY=ON -DCMAKE_BUILD_TYPE=Release  -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 $PWD
cmake --build .



Run it directly first to ensure it's working by executing:
./bin/FreeCAD

You can then install it after
make install

Optional, install openscad for extra FreeCAD features

emerge openscad

No comments:

Post a Comment