
How to build and run FreeCAD under Linux
========================================

Prerequisites
-------------

To compile FreeCAD you will need, besides functioning Linux
and programming tools (like compiler), the following libraries:

o Python (http://www.python.org), >= 2.5.x
o boost (http://www.boost.org), >= 1.33.1
o Qt (http://qt-project.org/), >= 4.1.x
o PySide (http://qt-project.org/wiki/category:LanguageBindings::PySide::Downloads)
o Coin3D (http://www.coin3d.org), >= 2.4.x
o SoQt (http://www.coin3d.org), >= 1.2.x
o Xerces-C++ (http://xml.apache.org/dist/xerces-c/), >= 2.6
o zlib (http://www.zlib.net/)

And for the some FreeCAD modules the additional libraries
o OpenCascade (http://www.opencascade.org), >= 5.2
o Eigen3 (http://eigen.tuxfamily.org/index.php?title=Main_Page), >= 3.0.1
o FreeType
are required.

Note: zlib might be already on your system, as this is a library that is used 
      by a lot of libraries, too.

Note: All libraries listed above must be built as shared library. Refer to their
      documentation to see how to do.

Note: If possible you should enable thread support for the libraries. At least for
      Qt thread support is strongly recommended, otherwise you will run into linker
      errors at build time of FreeCAD.

Note: The package for SoQt for Debian based systems may lack of the soqt.m4 macro file.
      You should download the file from www.coin3d.org and copy it to /usr/share/aclocal.

Note: The package for SoQt (at least for older Debian based systems) is usually built to link 
      against Qt3. This, however, causes a segmentation fault when using with FreeCAD because 
      it links against Qt4 and you get a mixup of Qt3 and Qt4 libraries.
      To fix this problem you must download the sources from www.coin3d.org and run
      configure with the 'with-qt=DIR' switch specifying the location of Qt4.
      Probably, it's best to 'make install' the newly built SoQt into a different directory
      than the installed SoQt to avoid to corrupt your package database and/or to keep other 
      applications working. When configuring FreeCAD you have to use the '--with-soqt=DIR' 
      switch specifying the path of the newly installed SoQt.
      For newer Debian releases this already solved by a new package that links against Qt4.


During the compilation some Python scripts get executed. So the Python interpreter has
to work properly.

Optionally, you can build the Qt plugin that provides all custom widgets of FreeCAD
we need for the Qt Designer. The sources are located under Tools/plugins/widget.
So far, we don't provide a makefile but calling 'qmake plugin.pro' creates it and
calling 'make' will create the library libFreeCAD_widgets.so. To make known this library
to your Qt Designer you have to copy the file to $QTDIR/plugin/designer.

On our Wiki you'll find more information to build with different Linux distributions at 
http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=CompileOnUnix


Configuration
-------------

For the build process of FreeCAD we make use of configure scripts.
To have an overview of all switches type in ./configure --help, first.

You don't need any of these switches unless you have installed a library into a non-standard
path. In this case make use of the appropriate --with-XXX-include or --with-XXX-lib switches,
please. (XXX stands for the corresponding library.)
Of course, for above mentioned problem with SoQt you should use the '--with-soqt=DIR' switch.

Note: To specify FreeCAD's root directory it is recommended to use only the '--prefix'
switch from the configure script but not the --bindir, --libdir, ... switches, because at startup 
FreeCAD makes assumptions about where its module directories are installed.


Installation & Running FreeCAD
------------------------------

Once you have built the sources successfully using 'make', with 'make install' you can
install FreeCAD onto your machine whereever you want. FreeCAD's default root directory 
is $HOME/FreeCAD, so you don't need root privileges therefore. To run FreeCAD go to 
$PREFIX/FreeCAD/bin and type in ./FreeCAD.

Note: In the past there were a lot of problems that the Part workbench couldn't be loaded.
      The problem is that the system wasn't able to find the OpenCascade library files.
      To fix this problem you are strongly recommended to add the path of these libraries
      to LD_LIBRARY_PATH or even to add it to ld.so.conf and run ldconfig.


So, just have fun!



Werner Mayer <wmayer@users.sourceforge.net>
June 2014
