CompileOnUnix/es

En distribuciones recientes de linux, FreeCAD es sencillo de construir, ya que todas las dependencias usualmente las provee el administrador de paquetes. Básicamente involucra 3 pasos:


 * 1) Conseguir el código fuente de FreeCAD
 * 2) Conseguir as dependencias (paquetes en los que FreeCAD depende)
 * 3) Compilar con "cmake . && 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
La mejor y más rápida manera de conseguir el código es clonando el repositorio Git de sólo-lectura (necesitas el instaler el paquetegit): Esto colocará una copia de la versión más reciente del código fuente FreeCAD en un nuevo directorio llamado "free-cad-code". La primera vez que intentes conectarte al host free-cad.git.sourceforge.net recibirás un mensaje solicitando que autentifiques la clave SSH de sourceforge, la cual es normalmente segura de aceptar (puedes checar sus claves SSH en la página web de sourceforge si no estás seguro)

Github
Siempre hay un repositorio actualizado de FreeCAD en Github: github.com/FreeCAD/FreeCAD_sf_master

Paquete fuente
De manera alternativa, puedes descargar un paquete fuente, pero podrían ser bastante viejos por lo que es mejor conseguir las fuentes más recientes vía git o github. Dependiendo de tu distribución, hay diversas maneras de obtener un paquete fuente:


 * Paquetes oficiales de FreeCAD (independientes de distribución): https://sourceforge.net/projects/free-cad/files/FreeCAD%20Source/
 * Debian: http://packages.debian.org/source/sid/freecad
 * Ubuntu: http://packages.ubuntu.com/source/precise/freecad

Obteniendo las dependencias
Para compilar FreeCAD en Linux tienes que instalar todas las librerías mencionadas en Third Party Libraries primero. En distribuciones recientes, generalmente es cuestión de instalar unos cuantos paquetes:

Debian y Ubuntu
En sistemas basados en Debian (Debian, Ubuntu, Mint, etc...) es muy fácil instalar todas las dependencias requeridas. La mayoría de las librería están disonibles vía apt-get o synaptic package manager. Debajo están listados todos los paquetes que necesitas instalar. Observa que si no utilizas la versión más reciente de tu distribución, algunos de los paquetes debajo pueden estar ausentes de tus repositorios. En ese caso ve la sección de Distribuciones antiguas y no convencionales debajo. Instrucciones adicionales para libcoin80-dev Debian wheezy-backports, unstable, testing, Ubuntu 13.10 en adelante

Opcionalmente también puedes instalar estos paquetes:

Fedora
Necestias los siguientes paquetes: Y opcionalmente: Contruir FreeCAD con coin3 aún es tardado en Fedora, pues solamente coin2 está disponible en los reositorios oficiales, pero si aún lo deseas, puedes evitar reconstruir toda la suite de coin3 / soqt / pivy instalando los paquetes coin3-ready desde http://www.zultron.com/rpm-repo/

Fedora 20
Instala los repositorios Fedora "free" y "nonfree":

Ahora, instala los paquetes requeridos:

Crea un enlace simbólico para que cmake pueda encontrar los archivos de Coin/Inventor:

Descarga la tarball para SoQt-1.5.0-10:

Compila SoQt:

Descarga, construye e instala pivy:

Ir a Compilar FreeCAD

Gentoo
Necesitas los siguientes paquetes para contruir FreeCAD: Ya que el opencascade más reciente no está disponible, quizás quieras compilar opencascade también, para ello las siguientes librerías son requeridas:

OpenSUSE
Necesitas los siguientes paquetes: For FreeCAD 0.13 unstable you need to add Eigen3 and swig libraries, that don't seem to be in standard repos. You can get them with one-click install here: También, ten en cuenta que la librería Eigen3 de Factory Education estaba ocasionando problemas a veces, así que utiliza aquella del repositorio KDE 4.8 Extra

Distribuciones antiguas y no convencionales
En otras distribuciones, tenemos muy poca retroalimentación de los usuarios, así que podría ser más difícil encontrar los paquetes requeridos. Intenta primero encontrar las librería mencionadas en Third Party Libraries. Considera que algunas de ellas pueden tener un nombre ligeramente diferente en tu dsitribución (tal como name, libname, name-dev, etc...)

Necesitas también el compilador GNU gcc de versión 3.0.0 o superior. g++ también es requerido porque FreeCAD está escrito completamente en C++. Durante la instalación algunos scripts de Python son ejecutados. Por lo que el interretador de Python debe funcionar apropiadamente. Para evitar problemas durante el proceso de construcción, es una buena idea tener las ubicaciones de las librerías en tu variable "LD_LIBRARY_PATH" o en tu archivo "ld.so.conf". Normalmente esto ya es el caso en las distribuciones recientes.

Para más detalles echa un vistazo a "README.Linux" en tus fuentes.

Debajo hay información adicional para algunas librería que podrían no estar presentes en los repositorios de tu distribución.

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 oversion oficial
Nota: Se te recomienda que uses la edición community de OpenCasCade, que es mucho más fácil de construir, pero ésta también sirve.

No todas las distribuciones de Linux tienen un paquete oficial de OpenCASCADE en sus repositorios. Debes de checar tú mismo si hay uno disponible para tu distribución. A partir de Debian Lenny y Ubuntu Intrepid se provee un paquete .deb oficial. Para versiones de Debian y Ubuntu anteriores, podrías obtener paquetes no oficiales de aquí. Para construir tu propio paquete .deb privado sigue estos pasos: 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: 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: Possible error 1: If you are using OCC version 6.2, it is likely that the compiler will stop right after the beginning of the "make" operation. If it happens, edit the "configure" script, locate the CXXFLAGS="$CXXFLAGS " statement, and replace it by CXXFLAGS="$CXXFLAGS -ffriend-injection -fpermissive". Then do the configure step again.

Possible error 2: Possibly several modules (WOKSH, WOKLibs, TKWOKTcl, TKViewerTest and TKDraw) will complain that they couldn't find the tcl/tk headers. In that case, since the option is not offered in the configure script, you will have to edit manually the makefile of each of those modules: Go into adm/make and into each of the bad modules folders. Edit the Makefile, and locate the lines CSF_TclLibs_INCLUDES = -I/usr/include and CSF_TclTkLibs_INCLUDES = -I/usr/include and add /tcl8.4 and /tk8.4 to it so they read: CSF_TclLibs_INCLUDES = -I/usr/include/tcl8.4 and CSF_TclTkLibs_INCLUDES = -I/usr/include/tk8.4

SoQt
The SoQt library must be compiled against Qt4, which is the case in most recent distributions. But at the time of writing this article there were only SoQt4 packages for Debian itself available but not for all Ubuntu versions. To get the packages built do the following steps: If you are on a 64bit system, you will probably need to change i386 by amd64.

Pivy
Pivy is not needed to build FreeCAD or to run it, but it is needed for the 2D Drafting module to work. If you are not going to use that module, you won't need pivy. At the time of writing, Pivy is very new and might not have made its way into your distribution repository. If you cannot find Pivy in your distribution's packages repository, you can grab debian/ubuntu packages on the FreeCAD download page:

http://sourceforge.net/projects/free-cad/files/FreeCAD%20Linux/

or compile pivy yourself:

Pivy compilation instructions

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.

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

In-souce building
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 installed pivy from source, set the compiler flag to use the correct pivy (via FREECAD_USE_EXTERNAL_PIVY=1). Also, set the build type to debug. (NOTE: the "." and space after the cmake flags are CRITICAL!):

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

Out-of-source build
If you intend to follow the fast evolution of FreeCAD, building in a separate folder is much more convenient. Everytime you update the source code, cMake will then intelligently distinguish which files have changed, and recompile only what is needed. Out-of-source builds are specially handy when using the Git system, because you can easily try other branches without confusing the build system. To build out-of-source, simply create a build directory, distinct from your freecad source folder, and, from the build folder, point cMake to the source folder: The FreeCAD executable will then reside in the "bin" directory (within your freecad-build directory).

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).

As an example, to configure on the command line with the Assembly module built, issue: Possible options are listed in FreeCAD's root CmakeLists.txt file.

Using autotools
Autotools is in the process of being deprecated in favor of cMake, but at the moment it is still available to build FreeCAD. You must have automake and libtool installed on your system; on Debian/Ubuntu: If you got the sources with git or subversion, then the very first step must be that creates the configure script and more. For the build process itself we provide a configure script. Just type To get everything configured. If you want an overview of all options you can specify, you can type Normally you need none of them - unless you have one of your libraries installed in a really uncommon directory. After configuration has finished, compiling FreeCAD is as simple as If any error occurs while building from sources, please double-check this page and README.Linux file, then you could jump to the Bug Tracker on SourceForge, choose Any for status and click the Browse button to see previous reports on compile problems. After having built FreeCAD successfully, do to install it onto your machine. The default install directory is It will be installed in a FreeCAD folder in your home folder, so you don't need root privileges. Instead of make install, you can also do In this way FreeCAD will be installed by your package management system, so you can uninstall it easily later. But since all of FreeCAD installation resides into one single directory, just removing the FreeCAD directory is a valid way to uninstall too.

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 lintian your-fresh-new-freecad-package.deb (replace by the name of the package you just created)

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.

Automake macros
The configure script of FreeCAD makes use of several automake macros that are sometimes not installed with their packages: bnv_have_qt.m4, coin.m4, and soqt.m4. If needed (error while configuring), google for them and you will find them easily. They are just simple scripts that you need to put in your /usr/share/aclocal folder.

Fedora 13
To build & install FreeCAD on Fedora 13, a few tips and tricks are needed:
 * Install a bunch of required packages, most are available from the Fedora 13 repositories
 * Download and build xerces
 * Download and build OpenCascade. Need to point it to xmu: ./configure --with-xmu-include=/usr/include/X11/Xmu --with-xmu-library=/usr/lib
 * Download and build Pivy. You have to remove 2 references to non existent "SoQtSpaceball.h" from pivy/interfaces/soqt.i Commenting out those two lines allow the build & install to work.
 * Configure Freecad. You will need to point it to a few things: ./configure --with-qt4-include=/usr/include --with-qt4-bin=/usr/lib/qt4/bin --with-occ-lib=/usr/local/lib --with-occ-include=/usr/local/inc --with-xercesc-lib=/usr/local/lib
 * make - hits a problem where the build is breaking because the ldflags for soqt are set to "-LNONE" which made libtool barf. My hackish workaround was to modify /usr/lib/Coin2/conf/soqt-default.cfg so that the ldflags are "" instead of "-LNONE". After this -> success !
 * make install

Ubuntu Lucid
In Ubuntu Lucid, you don't need the qtwebkit-dev, since it is included into qt4-dev.

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. This scripts should run on 32 and 64 bit versions. They are written for distinct version, but are also likely to run on a later version with or without minor changes.

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

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

OpenSUSE 12.1
For FreeCAD 0.13 unstable you need to add Eigen3 and swig libraries, that don't seem to be in standard repos. You can get them with one-click install here:

Eigen3: http://software.opensuse.org/search?q=eigen3&baseproject=openSUSE%3A12.1&lang=en&exclude_debug=true

swig: http://software.opensuse.org/search?q=swig&baseproject=openSUSE%3A12.1&lang=en&exclude_debug=true 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

OpenSuse 11.2
This script is not working at the moment because:
 * libXerces-c-devel seams to be disappeared ....

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: