Compiling FreeCAD on Ubuntu 16.04

Read my another post to compile FreeCAD on Arch:

Getting the source:

git clone free-cad-code

Getting the dependencies:

sudo apt install build-essential cmake python python-matplotlib libtool libcoin80-dev libsoqt4-dev libxerces-c-dev libboost-dev libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev libboost-signals-dev libboost-thread-dev libboost-python-dev libqt4-dev libqt4-opengl-dev qt4-dev-tools python-dev python-pyside pyside-tools oce-draw libeigen3-dev libqtwebkit-dev libshiboken-dev libpyside-dev libode-dev swig libzipios++-dev libfreetype6 libfreetype6-dev liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-visualization-dev liboce-ocaf-lite-dev libsimage-dev checkinstall python-pivy python-qt4 doxygen libspnav-dev


Now first we’ll create a separate directory for storing our build files. This will be out-of-source build. Which means the source code directory will not get modified and there won’t be any issue with git.

mkdir build

cd build


For example, if you have two directories: build and free-cad-code, then go to build directory and run:

cmake ../free-cad-code

Here free-cad-code is my source code directory.

While running cmake, I got an error:

make[2]: *** No rule to make target ‘/usr/lib/’, needed by ‘lib/’. Stop.

This was solved by creating a symlink from /usr/lib/x86_64-linux-gnu/ to /usr/lib/

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

If the above cmake process worked successfully then proceed to the following or just analyze the error and install the missing dependencies. Now type:


to start the compilation.

To speed up the compilation, I did: make -j4 instead of make. It will make the full utilization of CPU and memory. Here 4 is the number of cores. You may find yours using command: nproc or simply run make -j$(nproc)

But wait, I got into a problem due to that. The C++ compiler ran out of memory while compilation. It threw an error:

c++: internal compiler error: Killed (program cc1plus)

Please submit a full bug report, with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.

It was due to the full memory utilization and compiler ran out of memory. I got help regarding this by one of the mentors (ickby) on #freecad irc channel.

Then I tried with make -j2 and it worked flawlessly.

Execute using the following command:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s