Compilation sous Unix

From FreeCAD Documentation
Jump to: navigation, search
This page is a translated version of the page CompileOnUnix and the translation is 45% complete.

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. Compiling with "cmake . && make"

Below, you'll find detailed explanations of the whole process and particularities you might encounter. If you find anything wrong or out-of-date in the text below (Linux distributions change often), or if you use a distribution which is not listed, please help us correcting it.

Getting the source

Before you can compile FreeCAD, you need the source code. There are 3 ways to get it:

Git

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

git clone git://git.code.sf.net/p/free-cad/code free-cad-code

This will place a copy of the latest version of the FreeCAD source code in a new directory called "free-cad-code". The first time you try connecting to the free-cad.git.sourceforge.net host, you will receive a message asking to authenticate the sourceforge SSH key, which is normally safe to accept (you can check their SSH keys on the sourceforge website if you are not sure)

Github

There is an always up to date FreeCAD repository on Github: github.com/FreeCAD/FreeCAD_sf_master

Source package

Alternatively you can download a source package, but they could be already quite old so it's always better to get the latest sources via git or github.

Getting the dependencies

To compile FreeCAD under Linux you have to install all libraries mentioned in Third Party Libraries first. Please note that the names and availability of the libraries will depend on your distribution. Note that if you don't use the most recent version of your distribution, some of the packages below might be missing from your repositories. In that case, look in the Older and non-conventional distributions section below.

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.

  • build-essential
  • cmake
  • python
  • python-matplotlib
  • libtool

either:

  • libcoin60-dev (Debian Wheezy, Wheezy-backports, Ubuntu 13.04 and before)

or:

  • libcoin80-dev (Debian unstable(Jesse), testing, Ubuntu 13.10 and forward)
  • libsoqt4-dev
  • libxerces-c-dev
  • libboost-dev
  • libboost-filesystem-dev
  • libboost-regex-dev
  • libboost-program-options-dev
  • libboost-signals-dev
  • libboost-thread-dev
  • libqt4-dev
  • libqt4-opengl-dev
  • qt4-dev-tools
  • python-dev
  • python-pyside
  • pyside-tools

either:

  • 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:

  • liboce-foundation-dev
  • liboce-modeling-dev
  • liboce-ocaf-dev
  • liboce-visualization-dev
  • liboce-ocaf-lite-dev

You may have to install these packages by individual name.

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:

Gentoo

You need the following packages to build FreeCAD:

  • dev-cpp/eigen
  • dev-games/ode
  • dev-libs/boost
  • dev-libs/xerces-c
  • dev-python/pivy
  • dev-python/PyQt4
  • media-libs/coin
  • media-libs/SoQt
  • sci-libs/opencascade-6.5
  • sys-libs/zlib
  • virtual/fortran
  • x11-libs/qt-gui
  • x11-libs/qt-opengl
  • x11-libs/qt-svg
  • x11-libs/qt-webkit
  • x11-libs/qt-xmlpatterns
  • dev-lang/swig-2.0.4-r1
  • app-admin/eselect-python-20091230
  • dev-lang/python-2.7.2-r3
  • dev-util/cmake-2.8.4
  • sys-apps/findutils-4.4.0
  • freetype

Since the latest opencascade version is not available, you might want to compile opencascade too, hence the following additional libraries are needed:

  • media-libs/ftgl
  • virtual/opengl
  • x11-libs/libXmu
  • dev-lang/tcl-8.5.9
  • dev-lang/tk-8.5.9-r1
  • dev-tcltk/itcl-3.4_beta1
  • dev-tcltk/itk-3.4_pre20090417
  • dev-tcltk/tix-8.4.3
  • x11-libs/gl2ps
  • sys-devel/automake-1.11
  • sys-devel/autoconf-2.68
  • sys-devel/libtool
  • dev-java/java-config-2.1.11-r3

OpenSUSE

You need the following packages:

  • gcc
  • cmake
  • OpenCASCADE-devel
  • libXerces-c-devel
  • python-devel
  • libqt4-devel
  • python-qt4
  • Coin-devel
  • SoQt-devel
  • boost-devel
  • libode-devel
  • libQtWebKit-devel
  • libeigen3-devel
  • gcc-fortran
  • freetype2
  • freetype2-devel

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:

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 bibliothèque Eigen3 est maintenant requise par le module Sketcher. Sous Ubuntu, cette bibliothèque n'est disponible dans les dépôts qu'à partir d'Ubuntu 11.10. Pour les versions antérieures d'Ubuntu, vous pouvez soit la télécharger ici et l'installer manuellement, ou ajouter le dépôt FreeCAD Daily Builds PPA à vos sources de logiciels avant de l'installer par l'un des moyens listés ci-dessous.

OpenCASCADE community edition (OCE)

Un fork tiré d'OpenCasCade, OpenCASCADE Community edition est beaucoup plus facile à compiler. FreeCAD peut utiliser l'une ou l'autre des versions installées sur votre système, soit la version « officielle » ou la community edition. Le site Web du projet OCE contient des instructions de compilation détaillées.

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:

wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0.orig.tar.gz
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.dsc
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.diff.gz

dpkg-source -x opencascade_6.2.0-7.dsc

# Install OCC build-deps
sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev

#Build Opencascade packages. This takes hours and requires
# at least 8 GB of free disk space
cd opencascade-6.2.0 ; debuild

# Install the resulting library debs
sudo dpkg -i libopencascade6.2-0_6.2.0-7_i386.deb
libopencascade6.2-dev_6.2.0-7_i386.deb

En outre, vous pouvez télécharger et compiler la dernière version disponible de opencascade.org:

Installez le paquet normalement, mais sachez que l'installateur est un programme java qui nécessite l'édition officielle java runtime de Sun (nom du paquet : sun-java6-jre), pas le paquet java open-source (gij) distribué avec Ubuntu. Installez-le au besoin :

sudo apt-get remove gij
sudo apt-get install sun-java6-jre

Prenez garde, si vous utilisez gij java à d'autres applications telles qu'une extension de navigateur, elles ne fonctionneront plus. Si l'installateur ne fonctionne pas, essayez :

java -cp path_to_file_setup.jar <-Dtemp.dir=path_to_tmp_directory> run

Une fois le paquet installé, allez dans le répertoire "ros" à l'intérieur du répertoire opencascade, et faites

./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4

Maintenant vous pouvez compiler. Retournez au dossier ros et faites :

make

Cela prendra beaucoup de temps, peut-être plusieurs heures.

Quand c'est terminé, installez en faisant simplement

sudo make install

Les fichiers de bibliothèque seront copiés dans /usr/local/lib ce qui est normal, puisqu'ils seront trouvés automatiquement par n'importe quel programme. En outre, vous pouvez aussi faire

sudo checkinstall

Ce qui fera la même chose que make install, mais créera une entrée dans votre système de gestion de paquets afin de le désinstaller plus facilement éventuellement. Maintenant nettoyez les considérable fichiers de compilation temporaires en faisant

make clean

Erreur possible Nº 1 : Si vous utilisez OCC version 6.2, il est fort possible que le compilateur stoppera tout juste après le début de l'opération "make". Si cela survient, éditez le script "configure", retracez la déclaration CXXFLAGS="$CXXFLAGS ", et remplacez-la par CXXFLAGS="$CXXFLAGS -ffriend-injection -fpermissive". Puis recommencez l'étape configure.

Erreur possible Nº 2 : Il est possible que plusieurs modules (WOKSH, WOKLibs, TKWOKTcl, TKViewerTest et TKDraw) se complaignent qu'ils ne trouvent pas les entêtes tcl/tk. Dans ce cas, puisque l'option n'est pas offerte par le script configure, vous devrez éditer nauellement le makefile de chacun de ces modules : Allez dans adm/make et dans chacun des dossiers des modules fautifs. Éditez le Makefile, et retracez les lignes CSF_TclLibs_INCLUDES = -I/usr/include et CSF_TclTkLibs_INCLUDES = -I/usr/include et ajoutez /tcl8.4 et /tk8.4 afin qu'elles se lisent comme suit : CSF_TclLibs_INCLUDES = -I/usr/include/tcl8.4 et CSF_TclTkLibs_INCLUDES = -I/usr/include/tk8.4

SoQt

La bibliothèque SoQt doit être compilée par rapport à Qt4, ce qui est le cas de la plupart des distributions récentes. Mais lors de l'écriture de cet article, il n'y avait des paquets SoQt4 disponibles que pour Debian, mais pas pour toutes les versions d'Ubuntu. Pour compiler les paquets, suivez les étapes suivantes :

wget http://ftp.de.debian.org/debian/pool/main/s/soqt/soqt_1.4.1.orig.tar.gz
wget http://ftp.de.debian.org/debian/pool/main/s/soqt/soqt_1.4.1-6.dsc
wget http://ftp.de.debian.org/debian/pool/main/s/soqt/soqt_1.4.1-6.diff.gz
dpkg-source -x soqt_1.4.1-6.dsc
sudo apt-get install doxygen devscripts fakeroot debhelper libqt3-mt-dev qt3-dev-tools libqt4-opengl-dev
cd soqt-1.4.1
debuild
sudo dpkg -i libsoqt4-20_1.4.1-6_i386.deb libsoqt4-dev_1.4.1-6_i386.deb libsoqt-dev-common_1.4.1-6_i386.deb

Si votre système est en 64 bits, vous devrez probablement changer i386 par amd64.

Pivy

Pivy n'est pas nécessaire pour compiler FreeCAD ou l'exécuter, mais il est requis par le module 2D Drafting qui ne fonctionnera pas autrement. Si vous ne comptez pas utiliser ce module, vous n'avez pas besoin de pivy. Au moment d'écrire ces lignes, Pivy est très jeune et ne se trouve possiblement pas encore dans les dépôts de votre distribution. Si vous ne trouvez pas Pivy dans les dépôts de paquets de votre distribution, vous pouvez prendre des paquets debian/ubuntu sur la page de téléchargement de FreeCAD :

http://sourceforge.net/projects/free-cad/files/FreeCAD%20Linux/ or compile pivy yourself:

Pivy compilation instructions

Compiler FreeCAD

Utiliser cMake

cMake est un nouveau système de compilation dont l'avantage est d'être commun à plusieurs systèmes d'exploitation (Linux, Windows, MacOSX, etc). FreeCAD utilise désormais cMake comme système de compilation principal. La compilation avec cMake est généralement très simple et se déroule en deux étapes. À la première étape, cMake vérifie que tous les programmes et bibliothèques nécessaires sont présents sur votre système, et configure tout ce qui est nécessaire pour la compilation subséquente. Quelques alternatives vous sont détaillées ci-dessous, mais FreeCAD est livré avec des options par défaut sensées. La seconde étape est la compilation proprement dite, qui produit l'exécutable FreeCAD.

Puisque FreeCAD est une application lourde, la compilation peut prendre un certain temps (environ 10 minutes sur un PC rapide, 30 minutes sur un PC lent).

In-source 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:

$ cd freecad (the folder where you cloned the freecad source)

If you want to use your system's copy of Pivy, which you most commonly will, then set the compiler flag to use the correct pivy (via FREECAD_USE_EXTERNAL_PIVY=1) As of 0.15.xxxx this flag is set by default on Linux so it does not need to be manually set. 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 "." and space after the cmake flags are CRITICAL!):

For a Debug build

$ cmake -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Debug .
$ make

Or for a Release build

$ cmake -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Release .
$ make

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

$ ./bin/FreeCAD

Compilation hors-source

Si vous comptez suivre l'évolution rapide de FreeCAD, il est beaucoup plus pratique de le compiler dans un dossier séparé de la source. Chaque fois que vous mettez à jour le code source, cMake distinguera intelligemment quels fichiers ont changé, et ne compilera que ce qui est requis. Les compilation hors-source sont particulièrement pratiques avec le système Git, puisque vous pouvez facilement essayer d'autres branches sans embrouiller le système de compilation. Pour compiler hors-source, créez un dossier de compilation distinct du dossier source freecad, et depuis le dossier de compilation, pointez cMake vers le dossier source :

mkdir freecad-build
cd freecad-build
cmake ../freecad (or whatever the path is to your FreeCAD source folder)
make

Votre exécutable résidera dans le dossier "bin".

Options de configuration

Il existe un certain nombre de modules expérimentaux ou inachevés que vous pourriez vouloir compiler afin de travailler sur ceux-ci. Pour ce faire, vous devez régler les options appropriées lors de l'étape de configuration. Faites-le soit en ligne de commande, en passant les options -D <var>:<type>=<value> à cMake ou en utilisant une des interfaces graphiques disponibles pour cMake (par ex. pour Debian, les paquets cmake-qt-gui ou cmake-curses-gui).

À titre d'exemple, pour configurer en ligne de commande la compilation du module Assembly, faites :

cmake -D FREECAD_BUILD_ASSEMBLY:BOOL=ON ''path-to-freecad-root''

Les options possibles sont listées dans le fichier CmakeLists.txt situé à la racine du dossier source FreeCAD.

Greffon Qt designer

Si vous voulez faire du développement Qt pour FreeCAD, vous aurez besoin du greffon Qt designer qui fournit tous les widgets personnalisés de FreeCAD. Allez dans

freecad/src/Tools/plugins/widget

Pour l'instant nous ne fournissons pas de makefile -- mais appeler

qmake plugin.pro

le génère. Une fois que c'est fait,

make

créera la bibliothèque libFreeCAD_widgets.so. Pour faire en sorte que cette bibliothèque soit reconnue par Qt Designer, vous devez copier le fichier vers $QTDIR/plugin/designer

Doxygen

Si vous vous sentez assez audacieux pour vous plonger dans le code, vous pourriez tirer avantage à construire et consulter la documentation source de FreeCAD générée par Doxygen.

Construire un paquet Debian

Si vous envisagez de construire un paquet Debian voici les sources que vous devez installer en premier :

dh-make
devscripts

#optional, used for checking if packages are standard-compliant
lintian

Pour construire un paquet ouvrez une console, puis il suffit d'aller dans le répertoire FreeCAD et l’appeler

debuild

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

#replace by the name of the package you just created
lintian your-fresh-new-freecad-package.deb

Dépannage

Note sur les systèmes 64 bits

Pour la compilation de FreeCAD pour 64 bits, il y a un problème connu avec le paquet OpenCASCADE 64 bits. Afin que FreeCAD s'exécute correctement, vous pourriez devoir exécuter le script ./configure avec le réglage additionnel define _OCC64 :

./configure CXXFLAGS="-D_OCC64"

Sous les systèmes basés sur Debian, cette solution n'est pas requise avec l'utilisation du paquet précompilé OpenCASCADE, puisque celui-ci est déja compilé avec ce réglage. Maintenant il ne reste plus qu'à compiler FreeCAD tel que décrit ci-dessus.

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

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.

sudo add-apt-repository ppa:freecad-maintainers/freecad-daily && sudo apt-get update
sudo apt-get install build-essential python libcoin60-dev libsoqt4-dev \
libxerces-c2-dev libboost-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev \
libboost-serialization-dev libboost-signals-dev libboost-regex-dev libboost-thread-dev \
libqt4-dev qt4-dev-tools python2.7-dev libopencascade-dev libsoqt4-dev \
libode-dev subversion cmake libeigen2-dev libsimage-dev python-qt4 \
libtool autotools-dev automake bison flex gfortran libeigen3-dev libqtwebkit-dev git
 
# checkout the latest source
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad freecad
 
# go to source dir
cd freecad
 
# build configuration
cmake .
 
# build FreeCAD
make
 
# test FreeCAD
cd bin
./FreeCAD -t 0

# use FreeCAD
./FreeCAD<

# Update latest version

# go to source dir
cd freecad
 
# Update source
git pull
 
# build configuration
cmake .
 
# build FreeCAD
make

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:
ExtPivy.png


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.

#!/bin/sh
sudo add-apt-repository ppa:freecad-maintainers/
freecad-daily && sudo apt-get update
sudo apt-get install build-essential python libc
oin80-dev libsoqt4-dev \  
libxerces-c2-dev libboost-dev libboost-date-time
-dev libboost-filesystem-dev \
libboost-graph-dev libboost-iostreams-dev libboo
st-program-options-dev \  
libboost-serialization-dev libboost-signals-dev
libboost-regex-dev libboost-thread-dev \
libqt4-dev qt4-dev-tools python2.7-dev liboce-fo
undation-dev liboce-modeling-dev liboce-ocaf-dev
 liboce-visualization-dev oce-draw libsoqt4-dev
\
libode-dev subversion cmake libeigen2-dev libsim
age-dev python-qt4 \
libtool autotools-dev automake bison flex gfortr
an libeigen3-dev libqtwebkit-dev git libpyside-d
ev pyside-tools libshiboken-dev

# checkout the latest source
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad freecad

# go to source dir
cd freecad

# open cmake-gui window
cmake-gui .

# build configuration
cmake .

# build FreeCAD
make

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

# install needed packages for development
sudo zypper install gcc cmake OpenCASCADE-devel libXerces-c-devel \
python-devel libqt4-devel python-qt4 Coin-devel SoQt-devel boost-devel \
libode-devel libQtWebKit-devel libeigen3-devel gcc-fortran git swig
 
# create new dir, and go into it
mkdir FreeCAD-Compiled
cd FreeCAD-Compiled
 
# get the source
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
 
# Now you will have subfolder in this location called free-cad. It contains the source
 
# make another dir for compilation, and go into it
mkdir FreeCAD-Build1
cd FreeCAD-Build1
 
# build configuration
cmake ../free-cad
 
# build FreeCAD
make
 
# test FreeCAD
cd bin
./FreeCAD -t 0

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

# go into free-cad dir created earlier
cd free-cad
 
# pull
git pull
 
# get back to previous dir
cd ..
 
# Now repeat last few steps from before.
 
# make another dir for compilation, and go into it
mkdir FreeCAD-Build2
cd FreeCAD-Build2
 
# build configuration
cmake ../free-cad
 
# build FreeCAD
make
 
# test FreeCAD
cd bin
./FreeCAD -t 0

Debian Squeeze

# get the needed tools and libs
sudo apt-get install build-essential python libcoin60-dev libsoqt4-dev \
libxerces-c2-dev libboost-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev \
libboost-serialization-dev libboost-signals-dev libboost-regex-dev \
libqt4-dev qt4-dev-tools python2.5-dev \
libsimage-dev libopencascade-dev \
libsoqt4-dev libode-dev subversion cmake libeigen2-dev python-pivy \
libtool autotools-dev automake gfortran
 
# checkout the latest source
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad freecad
 
# go to source dir
cd freecad
 
# build configuration
cmake .
 
# build FreeCAD
make
 
# test FreeCAD
cd bin
./FreeCAD -t 0

Fedora 21

Posted by user [PrzemoF] in the forum.

#!/bin/bash

ARCH=x86_64
#ARCH=i686

MAIN_DIR=FreeCAD
BUILD_DIR=build

#FEDORA_VERSION=20
FEDORA_VERSION=21
#FEDORA_VERSION=22

echo "Installing packages required to build FreeCAD"
sudo yum -y install gcc cmake gcc-c++ boost-devel zlib-devel swig eigen3 qt-devel \
   shiboken shiboken-devel pyside-tools python-pyside python-pyside-devel xerces-c \
   xerces-c-devel OCE-devel smesh graphviz python-pivy python-matplotlib tbb-devel \
   freeimage-devel Coin3 Coin3-devel

cd ~

mkdir $MAIN_DIR || { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }

cd $MAIN_DIR

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

mkdir $BUILD_DIR || { echo "~/$BUILD_DIR already exist. Quitting.."; exit; }

cd $BUILD_DIR

cmake ../FreeCAD_sf_master && make

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:

#Replace with the location where you cloned the source code the first time
cd freecad
#If you are using git
git pull

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:

#Replace with the location of the build directory
cd ../freecad-build
cmake .
make
< précédent: CompileOnWindows
suivant: CompileOnMac >
Index
Other languages:
čeština • ‎Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎русский • ‎sámegiella • ‎svenska • ‎Türkçe