CompileOnUnix/es

On recent linux distributions, FreeCAD is generally easy to build, since all dependencies are usually provided by the package manager. It basically involves 3 steps:
 * 1) Getting the FreeCAD source code
 * 2) Getting the dependencies (packages FreeCAD depends upon)
 * 3) Configure with "cmake" and Compile with "make"

Debajo encontrarás explicaciones detalladas sobre todo el proceso y peculiaridades que puedas encontrar. Si encuentras que algo está mal o no está actualizado en el texto debajo (distribuciones Linux cambian frecuentemente), o si usas una distribución que no está listada, por favor ayúdanos a corregirlo.

Obteniendo el código fuente
Antes de que puedas compilar FreeCAD, necesitas el código fuente. Hay 3 maneras de conseguirlo:

Git
The quickest and best way to get the code is to clone the read-only git repository now hosted on GitHub (you need the git package installed):

This will place a copy of the latest version of the FreeCAD source code in a new directory called "free-cad-code".

Github
The official FreeCAD repository is on Github: github.com/FreeCAD/FreeCAD

Paquete fuente
Alternativamente, puedes descargar un paquete fuente, pero podrían ser demasiado antiguos por lo que es mejor obtener el código más reciente vía git o github.


 * Official FreeCAD source packages (distribution-independent): to be advised

Obtener las dependencias
Para compilar FreeCAD en Linux debes de instalar todas las librerías mencionadas en Third Party Libraries/es primero. Ten en cuenta que los nombres y disponibilidad de las librerías dependen de tu distribución. Considera que si no estás en la versión más reciente de tu distribución algunos de los paquetes debajo pueden estar faltando en tus repositorios. En ese caso ve la sección de Distribuciones antiguas y no convencionales debajo.

Skip to Compile FreeCAD

Debian and Ubuntu
On Debian-based systems (Debian, Ubuntu, Mint, etc...) it is quite easy to get all needed dependencies installed. Most of the libraries are available via apt-get or synaptic package manager.

either:
 * build-essential
 * cmake
 * python
 * python-matplotlib
 * libtool
 * libcoin60-dev (Debian Wheezy, Wheezy-backports, Ubuntu 13.04 and before)

or:
 * libcoin80-dev (Debian unstable(Jesse), testing, Ubuntu 13.10 and forward)

either:
 * 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
 * libopencascade-dev (official opencascade version)

or:
 * liboce*-dev (opencascade community edition)
 * oce-draw


 * libeigen3-dev
 * libqtwebkit-dev
 * libshiboken-dev
 * libpyside-dev
 * libode-dev
 * swig
 * libzipios++-dev
 * libfreetype6
 * libfreetype6-dev

Additional instruction for libcoin80-dev Debian wheezy-backports, unstable, testing, Ubuntu 13.10 and forward

Note that liboce*-dev includes the following libraries: You may have to install these packages by individual name.
 * liboce-foundation-dev
 * liboce-modeling-dev
 * liboce-ocaf-dev
 * liboce-visualization-dev
 * liboce-ocaf-lite-dev

Optionally you can also install these extra packages:
 * libsimage-dev (to make Coin to support additional image file formats)
 * checkinstall (to register your installed files into your system's package manager, so yo can easily uninstall later)
 * python-pivy (needed for the 2D Drafting module)
 * python-qt4 (needed for the 2D Drafting module)
 * doxygen and libcoin60-doc (if you intend to generate source code documentation)
 * libspnav-dev (for 3Dconnexion devices support like the Space Navigator or Space Pilot)

Fedora
You need the following packages:


 * gcc-c++ (or possibly another C++ compiler?)
 * cmake
 * doxygen
 * swig
 * gettext
 * dos2unix
 * desktop-file-utils
 * libXmu-devel
 * freeimage-devel
 * mesa-libGLU-devel
 * OCE-devel
 * python
 * python-devel
 * python-pyside-devel
 * pyside-tools
 * boost-devel
 * tbb-devel
 * eigen3-devel
 * qt-devel
 * qt-webkit-devel
 * ode-devel
 * xerces-c
 * xerces-c-devel
 * opencv-devel
 * smesh-devel
 * coin3-devel (if coin2 is the latest available for your version of Fedora, use packages from http://www.zultron.com/rpm-repo/ )
 * soqt-devel
 * freetype
 * freetype-devel

And optionally:


 * libspnav-devel (for 3Dconnexion devices support like the Space Navigator or Space Pilot)
 * pivy ( https://bugzilla.redhat.com/show_bug.cgi?id=458975 Pivy is not mandatory but needed for the Draft module )

Gentoo
Easiest way to check which packages are needed to compile FreeCAD is to check via portage:

emerge -pv freecad

This should give a nice list of extra packages that you need installed on your system.

OpenSUSE
You need the following packages: For FreeCAD 0.14 stable and 0.15 unstable you need to add Eigen3 and swig libraries, that don't seem to be in standard repos. You can get them with a one-click install here:
 * gcc
 * cmake
 * OpenCASCADE-devel
 * libXerces-c-devel
 * python-devel
 * libqt4-devel
 * libshiboken-devel
 * python-pyside-devel
 * python-pyside-tools
 * Coin-devel
 * SoQt-devel
 * boost-devel
 * libode-devel
 * libQtWebKit-devel
 * libeigen3-devel
 * gcc-fortran
 * freetype2
 * freetype2-devel
 * Eigen3
 * swig

Also, note that the Eigen3 Library from Factory Education was causing problems sometimes, so use the one from the KDE 4.8 Extra repo

Arch Linux
You will need the following libraries from the official repositories:


 * boost-libs
 * curl
 * hicolor-icon-theme
 * libspnav
 * opencascade
 * python2-pivy
 * python2-matplotlib
 * python2-pyside
 * python2-shiboken
 * qtwebkit
 * shared-mime-info
 * xerces-c
 * boost
 * cmake
 * coin
 * desktop-file-utils
 * eigen
 * gcc-fortran
 * swig
 * xerces-c

Also, make sure to check the AUR for any missing packages that are not on the repositories, currently:
 * python2-pyside-tools

Older and non-conventional distributions
On other distributions, we have very few feedback from users, so it might be harder to find the required packages. Try first locating the required libraries mentioned in Third Party Libraries. Beware that some of them might have a slightly different package name in your distribution (such as name, libname, name-dev, name-devel, etc...).

You also need the GNU gcc compiler version equal or above 3.0.0. g++ is also needed because FreeCAD is completely written in C++. During the compilation some Python scripts get executed. So the Python interpreter has to work properly. To avoid any linker problems during the build process it is also a good idea to have the library paths either in your LD_LIBRARY_PATH variable or in your ld.so.conf file. This is normally already the case in recent distributions.

For more details have also a look to README.Linux in your sources. Below is additional help for a couple of libraries that might not be present in your distribution repositories

Eigen 3
La librería Eigen3 es requerida por el módulo Sketcher. Esta librería está disponible únicamente a partir de los repositorios de Ubuntu 11.10. Para versiones anteriores de Ubuntu, puedes ya sea descargarlo de aquí e instalarlo manualmente, o agregar el PPA de Construcciones Diarias de FreeCAD a tus fuentes de software antes de instalarlo a través de alguno de los medios listado abajo.

OpenCASCADE community edition (OCE)
Recientemente OpenCasCade ha sido bifurcado (le han hecho fork) en Community edition, que es mucho más fácil de construir. FreeCAD puede utilizar cualquier versión instalada en tu sistema, ya sea la edición "oficial" o la edición de comunidad. El sitio web de OCE contiene instrucciones detalladas de como construirlo.

OpenCASCADE official version
Note: You are advised to use the OpenCasCade community edition above, which is easier to build, but this one works too. Not all Linux distributions have an official OpenCASCADE package in their repositories. You have to check for yourself if one is available for your distribution. At least from Debian Lenny and Ubuntu Intrepid an official .deb package is provided. For older Debian or Ubuntu releases you may get unofficial packages from here. To build your own private .deb packages follow these steps:

Alternativamente, puedes descargar y compilar la versión más reciente desde opencascade.org:

Instala los paquetes normalmente, ten en cuenta que el instalador es un programa java que requiere el java official runtime edition de Sun (nombre del paquete: sun-java6-jre), no la versión open-source (gij) que viene incluída en Ubuntu. Instálalo si lo requieres.

Ten cuidado, si utiilzas gij java con alguna otra cosa como un plugin, ya no funcionarán. Si el instalador no funciona, intenta:

Una vez instalado el paquete, dirígete al directiorio "ros" dentro de opencascade dir, y ejecuta:

Ahora puedes construirlo. Regresa a la carpeta ros y haz:

Tomará mucho tiempo, inclusive varias horas.

Cuando terminae, instálalo haciendo: sudo make install Las librerías serán copiadas a /usr/local/lib, lo cúal está bien, ya que serán encontradas automáticamente por cualquier programa. Alternativamente, también puedes hacer:

que hará lo mismo que make install, pero creará una entrada en tu administrador de paquetes para que puedes desinstalarlo fácilmente. Ahora elimina la enorme cantidad de archivos temporales de compilación mediante:

Posible error 1: Si está utilizando OCC versión 6.2, es probable que el compilador se detenda justo después de iniciar la operación "make". Si esto sucede, edita el script "configure", ubica la indicación CXXFLAGS="$CXXFLAGS " y reemplázala con CXXFLAGS="$CXXFLAGS -ffriend-injection -fpermissive". Después, intenta de nuevo.

Possible error 2: Posiblemente, varios módulos (WOKSH, WOKLibs, TKWOKTcl, TKViewerTest and TKDraw) se quejarán de que no pueden encontrar los headers tcl/tk, En ese caso, ya que la opción no se ofrece en el script de configuración, deberas editar manualmente el makefile de cada módulo: Dirígete a adm/make y dentro de cada módulo edita el Makefile. Localiza las líneas CSF_TclLibs_INCLUDES = -I/usr/include y CSF_TclTkLibs_INCLUDES = -I/usr/include y agrega /tcl8.4 y /tk8.4 para que lea: CSF_TclLibs_INCLUDES = -I/usr/include/tcl8.4 y CSF_TclTkLibs_INCLUDES = -I/usr/include/tk8.4

SoQt
La librería SoQt debe ser compilada con Qt4, lo que es el caso en las distribuciones más recientes. Al momento de escribir esto, solamente existen paquetes SoQt4 para Debian. Para obtener los paquetes sigue los siguientes pasos:

Si estás en un sistema de 64 bits, necesitarás reemplazar i386 por amd64.

Pivy
Pivy no es necesario para construir FreeCAD o ejecutarlo, pero es requerido para que el módulo 2D Drafting funcione. Si no planeas utilizar este módulo, no necesitas pivy. En e momento de escribir esto, Pivy es muy reciente y puede que no esté en los repositorios de tu distribución. Si no puedes encontrarlos, puedes descargar los paquetes debian/ubuntu en la página de descargas de FreeCAD:

Pivy instrucciones de compilación

Using cMake
cMake is a newer build system which has the big advantage of being common for different target systems (Linux, Windows, MacOSX, etc). FreeCAD is now using the cMake system as its main building system. Compiling with cMake is usually very simple and happens in 2 steps. In the first step, cMake checks that every needed programs and libraries are present on your system and sets up all that's necessary for the subsequent compilation. You are given a few alternatives detailed below, but FreeCAD comes with sensible defaults. The second step is the compiling itself, which produces the FreeCAD executable. Changing any options for cmake away from their default values, is much easier with cmake-gui or other graphical cmake applications than with cmake on the command line, as the graphical applications will give you interactive feed back.

Since FreeCAD is a heavy application, compiling can take a bit of time (about 10 minutes on a fast machine, 30 minutes (or more) on a slow one)

In-source building
If you are unsure then, due to its limitations, do not make an in-source build, create an out-of-source build as explained in the next section. However FreeCAD can be built in-source, which means that all the files resulting from the compilation stay in the same folder as the source code. This is fine if you are just looking at FreeCAD, and want to be able to remove it easily by just deleting that folder. But in case you are planning to compile it often, you are advised to make an out-of-source build, which offers many more advantages. The following commands will compile FreeCAD:

If you want to use your system's copy of Pivy, which you most commonly will, then if not on Linux, set the compiler flag to use the correct pivy (via FREECAD_USE_EXTERNAL_PIVY=1). Using external Pivy became the default for Linux, during development of FreeCAD 0.16, so it does not need to be manually set when compiling this version onwards, on Linux. Also, set the build type to Debug if you want a debug build or Release if not. A Release build will run much faster than a Debug build. Sketcher becomes very slow with complex sketches if your FreeCAD is a Debug build. (NOTE: the space and "." after the cmake flags are CRITICAL!):

For a Debug build

Or for a Release build

Your FreeCAD executable will then reside in the "bin" folder, and you can launch it with:

How to repair your source code directory after accidentally running an in-source build.
This is a method, using Git, to repair your source code directory after accidentally running an in-source build.

Construir fuera de la fuente
Si pretendes seguir la ráida evolución de FreeCAD, construir en una carpeta separada es mucho más conveniente. Cada vez que actualices el código fuente, cMake distinguirá inteligentemente que archivos han cambiado y recompilará solamente aquello que sea necesario. Construcciones fuera de la fuente son especialmente útiles al utilizar el sistema Git, ya que puedes probar fácilmente otras ramas sin confundir el sistema de construcción. Para construir fuera de la fuente, simplemente crea un directorio de construcción, distinto a tu carpeta fuente de freecad, y, desde la carpeta de construccion, indícale a cMake la carpeta fuente:

El ejecutable FreeCAD residirá en el directorio "bin" (dentro de tu directorio de construcción).

Configuration options
There are a number of experimental or unfinished modules you may have to build if you want to work on them. To do so, you need to set the proper options for the configuration phase. Do it either on the command line, passing -D : = options to cMake or using one of the availables gui-frontends (eg for Debian, packages cmake-qt-gui or cmake-curses-gui). Changing any options for cmake away from their default values, is much easier with cmake-gui or other graphical cmake applications than with cmake on the command line, as they will give you interactive feed back.

As an example, to configure FreeCAD with the Assembly module built just tick the box in a cmake gui application (e.g. cmake-gui) or on the command line issue:

Possible options are listed in FreeCAD's root CmakeLists.txt file.

Qt designer plugin
If you want to develop Qt stuff for FreeCAD, you'll need the Qt Designer plugin that provides all custom widgets of FreeCAD. Go to

So far we don't provide a makefile -- but calling

creates it. Once that's done, calling

will create the library libFreeCAD_widgets.so. To make this library known to Qt Designer you have to copy the file to $QTDIR/plugin/designer

Doxygen
If you feel bold enough to dive in the code, you could take advantage to build and consult Doxygen generated FreeCAD's Source documentation

Making a debian package
If you plan to build a Debian package out of the sources you need to install those packages first:

To build a package open a console, simply go to the FreeCAD directory and call

Once the package is built, you can use lintian to check if the package contains errors

Note for 64bit systems
When building FreeCAD for 64-bit there is a known issue with the OpenCASCADE 64-bit package. To get FreeCAD running properly you might need to run the ./configure script with the additional define _OCC64 set:

For Debian based systems this workaround is not needed when using the prebuilt package because there the OpenCASCADE package is built to set internally this define. Now you just need to compile FreeCAD the same way as described above.

Automatic build scripts
Here is all what you need for a complete build of FreeCAD. It's a one-script-approach and works on a fresh installed distro. The commands will ask for root password (for installation of packages) and sometime to acknowledge a fingerprint for an external repository server or https-subversion repository. These scripts should run on 32 and 64 bit versions. They are written for different versions, but are also likely to run on a later version with or without major changes.

If you have such a script for your preferred distro, please send it! We will incorporate it into this article.

Ubuntu 13.x
Note that this script starts by adding the FreeCAD Daily Builds PPA repository so it can proceed with the Eigen3 library (libeigen3-dev) installation. If you already have this library installed on your system, you can remove the first line.

Ubuntu 14.x
This script prepairs your system to build freecad, and builds it for the first time. For subsiquent builds, it sufices to type make in the root freecad directory.

NOTE: When the cmake-gui window comes up, check the "use external PIVY" check-box and close it:

Note that this script starts by adding the FreeCAD Daily Builds PPA repository so it can proceed with the Eigen3 library (libeigen3-dev) installation. If you already have this library installed on your system, you can remove the first line.

OpenSUSE 12.2
No external Repositories are needed to compile FreeCAD 0.13 with this release. However, there is an imcompatability with python3-devel which needs to be removed. FreeCAD can be compiled from GIT similar to in OpenSUSE 12.2

Since you are using git, next time you wish to compile you do not have to clone everything, just pull from git and compile once more

Fedora 21
Posted by user [PrzemoF] in the forum. { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }

cd $MAIN_DIR

git clone https://github.com/FreeCAD/FreeCAD_sf_master.git

mkdir $BUILD_DIR

Updating the source code
FreeCAD development happens fast, everyday or so there are bug fixes or new features. The cmake systems allows you to intelligently update the source code, and only recompile what has changed, making subsequent compilations very fast. Updating the source code with git or subversion is very easy:

Move into the appropriate build directory and run cmake again (as cmake updates the version number data for the Help menu, ...about FreeCAD), however you do not need to add the path to source code after "cmake", just a space and a dot: