Compile on MacOS/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
Line 1: Line 1:
This page explains how to compile the latest FreeCAD source code on Mac OS X.
Comme Mac OS X est basé sur la distribution''' BSD (UNIX)''', la compilation de FreeCAD sur '''Mac''' n'est pas très différente de [[CompileOnUnix/fr|CompileOnUnix]], mais il existe cependant un certain nombre de détails très importants, spécifiques au Mac, pour que tout fonctionne correctement. Ces instructions ont été testées sur '''Lion (10.7)''', mais ''devrait fonctionner'' sur les '''Macs Intel''' qui utilisent '''(Snow) Leopard'''.


== Obtenir le code source ==
== Prerequisites ==
First of all, you will need to install the following software.


=== Xcode Development Tools ===
Avant de compiler FreeCAD, vous avez besoin du code source. Il y a trois moyens de l'obtenir :
Unless you want to use the Xcode IDE for FreeCAD development, you will only need to install the Command Line Tools. To do this on 10.9 and later, open Terminal, run the following command, and then click Install in the dialog that comes up.

=== Git ===

La méthode la meilleure et la plus rapide d'obtenir le code est de « cloner » le dépôt Git en lecture seule (il vous faut le paquet [http://git-scm.com/ git] installé):
<pre>
<pre>
xcode-select --install
git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad freecad
</pre>
</pre>
For other versions of OS X, you can get the package from the Apple developer [https://developer.apple.com/downloads/index.action?q=xcode downloads page] (sign in with the same Apple ID you use for other Apple services). Specifically, you will need to download Development Tools 3.2 for OS X 10.6, and Command Line Tools 4.8 for OS X 10.8.
Ceci place une copie de la plus récente version du code source de FreeCAD dans un nouveau répertoire nommé « freecad ». La première fois que vous vous connectez à l'hôte free-cad.git.sourceforge.net, vous obtiendrez un message vous demandant d'authentifier la clé SSH de Sourceforge. Celle-ci peut normalement être acceptée sans danger (vous pouvez vérifier les clés SSH de Sourceforge sur leur site Web si vous voulez vous en assurer)


=== Gihub ===
=== CMake ===
Install the latest version of CMake from http://www.cmake.org/download. Although Homebrew will also install CMake, it only installs the command line executable.


=== Homebrew ===
Il y a également une copie synchronisée régulièrement du dépôt FreeCAD sur GitHub :
To install Homebrew, enter the following in Terminal:
[https://github.com/FreeCAD/FreeCAD_sf_master github.com/FreeCAD/FreeCAD_sf_master]
=== Paquet source ===

Vous pouvez également télécharger un paquet source, mais celui-ci pourrait être assez vieux ; il est donc préférable de télécharger les sources les plus récentes via git ou github. Dépendant de votre distribution, il y a plusieurs façons d'obtenir un paquet source :

Paquets source FreeCAD officiels (indépendants des distributions):
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

=== Dépendances de l'installation ===

Sur '''Mac OS X 10.7''', les dépendances suivantes ne sont pas fournies avec le système, et '''doivent''' donc être installées '''avant''' la compilation de FreeCAD :
*sip
*fortran
*xerces-c
*boost
*eigen
*ftgl
*coin3d
*OpenCASCADE
*Qt
*pyqt
*soqt

==== Option 1: Homebrew ====

'''PS :''' cette section est toujours en cours d'élaboration ! Lisez le post sur ​​le forum d'aide pour plus d'informations.
:https://forum.freecadweb.org/viewtopic.php?f=4&t=2064&p=15405
Téléchargement et installation des gestionnaires de paquets '''Homebrew''' :
:http://mxcl.github.com/homebrew/
Puis, compilez et installez la plupart des dépendances de FreeCAD :
<pre>
<pre>
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install sip gfortran xerces-c boost eigen coin qt pyqt soqt ftgl
</pre>
</pre>
== Getting the source ==
Lisez le paragraphe [[CompileOnMac/fr#Compiler OpenCASCADE]].
In this guide, the source and build folders are created in '''/Users/username/FreeCAD''', but you can of course use whatever folder you want.

==== Option 2: MacPorts/Fink ====

'''PS : cette section a besoin d'être documentée !'''

Installez''' MacPorts''', si vous ne l'avez pas déjà fait. '''MacPorts''' est un système qui vous permet de télécharger, compiler et installer de nombreuses applications open-source en une seule commande. Des applications similaires issues du monde '''Unix/Linux''' sont, '''[http://netbsd-france.org/docs/software/packages.html PKGSRC]''' et '''[http://fr.wikipedia.org/wiki/Advanced_Packaging_Tool APT]'''. Pour l'installer, il suffit de télécharger l'image disque à partir du site '''MacPorts''', et suivez les instructions :
:http://www.macports.org/install.php
Que vous ayez ou non installé '''[http://www.macports.org/ MacPorts]''', vous voudrez probablement vérifier s'il est à jour.
Exécutez :
<pre>
<pre>
mkdir ~/FreeCAD
sudo port selfupdate
cd ~/FreeCAD
</pre>
</pre>
To get the FreeCAD source code, run:
Maintenant que '''[http://www.macports.org/ MacPorts]''' est installé, et à jour, vous pouvez commencer l'installation de certains des paquets nécessaires à FreeCAD :
*xercesc
*boost
*py-sip
*ftlg
*f2c
*eigen3
*py-pyqt4
*Coin
La commande suivante compile/installe les bibliothèques ci-dessus. Si '''MacPorts''' produit des erreurs, vous pouvez essayer d'installer ceci, '''un à la fois'''.
<pre>
<pre>
git clone git://git.code.sf.net/p/free-cad/code FreeCAD-git
sudo port install xercesc boost ftgl f2c eigen3 py-sip py-pyqt4 Coin
</pre>
</pre>
Alternatively, you can use the github mirror: https://github.com/FreeCAD/FreeCAD_sf_master.git
Notez, que pour les paquets Python comme '''[http://www.riverbankcomputing.com/software/sip/download py-sip]''' et '''[http://guide.macports.org/ py-pyqt4]''', il ya plusieurs packages, une pour chaque version de '''Python MacPorts'''.


== Installing the Dependencies ==
Notez que '''[http://www.boost.org/ boost]''' est un gros paquet, et '''[http://guide.macports.org/ py-pyqt4]''' dépend '''[http://www.qtcentre.org/wiki/index.php?title=Installing_Qt4_on_Mac_OS_X qt4-mac]''', qui est aussi un gros paquet. Vous pouvez exécuter '''run port -v''' de manière à avoir une idée de ce qui se passe au cours de ces longues compilations.
All of the needed libraries can be installed using Homebrew.

[http://qt.nokia.com/downloads/ Qt4] est également disponible pour Mac comme un installateur binaire à partir du site Web de [http://qt.nokia.com/downloads/ Qt].

Je ne suis pas sûr, de savoir comment ce passe cette approche avec la compilation de FreeCAD.

Il est également possible de choisir la version du compilateur '''gcc''' à utiliser, certaines versions récentes peuvent parfois provoquer des problèmes :
<pre>
<pre>
brew tap homebrew/science
sudo port -v install gcc_select
brew tap sanelson/freecad
sudo port select --list gcc
brew install boost eigen freetype oce python qt pyside pyside-tools xerces-c
sudo port select --set gcc mp-gcc46
brew install --without-framework --without-soqt sanelson/freecad/coin
brew install --HEAD pivy
</pre>
</pre>
== Compiling FreeCAD ==
'''Installer le Compilateur Fortran'''
First, create a new folder for the build:

Vous avez également besoin d'un compilateur [http://fr.wikipedia.org/wiki/Fortran FORTRAN]. Le fork '''[http://fr.wikipedia.org/wiki/GNU_Compiler_Collection gcc]''' d'Apple sur '''[http://fr.wikipedia.org/wiki/OS_X OSX]''' ne convient pas à FORTRAN.

Un installateur pour '''GFortran''' peut se trouver ici, et fera l'affaire :
http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
Si vous utilisez '''fink''', une autre méthode consiste à utiliser les commandes suivantes (tenté par Shaneyfelt 2100.Nov.14)
<pre>
<pre>
mkdir ~/FreeCAD/build
sudo fink selfupdate
sudo fink install gcc46
</pre>
</pre>
Now you will need to run CMake to generate the build files. Open the CMake app, and fill in the source and build folder fields. In this case, it would be '''/Users/username/FreeCAD/FreeCAD-git''' for the source, and '''/Users/username/FreeCAD/build''' for the build folder.
''Cela installe une autre collection de compilateurs '''gcc''' avec comme nom, '''gcc-4''' afin d'éviter un conflit de nom avec l''''Apple one'''.''


Next, click the '''Configure''' button. This will display a dialog asking you to specify what generator to use. Leave it at the default '''Unix Makefiles.''' Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the '''Advanced''' checkbox to get all of the options.
Les paquets '''MacPorts gcc4x''', également incluent les compilateurs de '''Fortran''', et il faudrait également faire :
<pre>
sudo port install gcc46
</pre>
Un autre paquet possible pour '''MacPorts''' est '''[http://www.g95.org/ g95]'''.


{| class="wikitable" style="text-align:left"
Cela semble être valable pour le compilateur [http://en.wikipedia.org/wiki/Fortran#Fortran_90 FORTRAN90] et passer des tests de configuration cmake de FreeCAD, mais la version actuelle semble demander des options spécifiques pour '''gcc''', il est sans doute plus facile de s'en tenir à '''[https://trac.macports.org/ticket/33963 gcc4x]'''.
|-
! Option name !! Value !! Notes
|-
| BUILD_ROBOT || OFF (unchecked) || As of 12/19/2014, the robot module fails to build using newer versions of clang (OS X 10.9 and later)
|-
| CMAKE_BUILD_TYPE || Release ||
|-
| FREECAD_USE_EXTERNAL_PIVY || ON (checked) ||
|-
| FREETYPE_INCLUDE_DIR_freetype2 || /usr/local/include/freetype2 || You will only need to set this if you are using a CMake version older than 3.1.0
|-
| OCE_DIR || /usr/local/Cellar/oce/0.16.1/OCE.framework/Versions/0.16/Resources ||
|-
| PYSIDERCC4BINARY || /usr/local/bin/pyside-rcc ||
|-
| PYSIDEUIC4BINARY || /usr/local/bin/pyside-uic ||
|-
| PYTHON_EXECUTABLE || /usr/local/bin/python ||
|-
| PYTHON_INCLUDE_DIR || /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 ||
|-
| PYTHON_LIBRARY || /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib ||
|-
|}
Note: The above paths for OCE and Python are for versions 0.16.1 and 2.7.9, respectively -- change as needed.


Now click '''Configure''' again and then '''Generate'''.
'''Installer Eigen3'''


Finally, run '''make''' to compile FreeCAD.
Téléchargez et décompressez la dernière bibliothèque '''eigen3''' ici :
http://eigen.tuxfamily.org/index.php?title=Main_Page
Ces mesures sont nécessaires pour la fonctionnalité du solveur. Une fois décompressé, le dossier nommé '''Eigen''' peut être déposé dans :

'''/usr/local/include/eigen3/'''

=== Compiler OpenCASCADE ===

Actuellement, la meilleure façon de compiler '''OpenCASCADE''' sur '''OS X''' est, l'édition communautaire ('''OCE''').

Téléchargez le code source ou, consultez le dépôt [http://fr.wikipedia.org/wiki/Git Git] à partir de :
:https://github.com/tpaviot/oce
Alors, tapez dans le terminal :
<pre>
<pre>
mkdir build
cd ~/FreeCAD/build
make –j3
cd build
cmake ..
cd ..
make
make install/strip
</pre>
</pre>
The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.
Vous devrez peut-être faire cmake :
<pre>
sudo port install cmake
</pre>
=== Télécharger et installer le modèle FreeCAD.app ===


If make finishes without any errors, you can now launch FreeCAD, either from Terminal with '''./bin/FreeCAD''', or by double clicking the executable in Finder.
L'archive suivante contient un modèle d'application pour FreeCAD. Ce n'est pas réellement nécessaire, mais il rend le travail de configuration de l'installation par défaut de FreeCAD plus pratique. L'emplacement recommandé de l'installation pour le bundle, est le dossier d'applications, mais vous devriez être en mesure de l'installer où vous voulez. Rrappelez-vous juste que, le faisceau (bundle) '''ne peut pas être déplacé ou modifié''' après que FreeCAD soit installé.
== Creating an application bundle ==

TODO
Lancer '''make install''' dans l'étape suivante en utilisant cette configuration, l'installera dans cet ensemble (bundle).
== Updating ==
:http://dl.getdropbox.com/u/103808/FreeCAD/FreeCAD_bundle_template_20091128.tar.gz
FreeCAD development happens fast; everyday or so there are bug fixes or new features. To get these changes, run:
=== Compilation ===

Configurez, compilez et installez FreeCAD, en utilisant les commandes suivantes à partir du dossier racine de FreeCAD.

Si vous mettez votre paquet '''FreeCAD.app''' ailleurs que dans Application (ou, n'utilise pas le bundle), changer la valeur de '''PREFIX''' en conséquence.
<pre>
<pre>
cd ~/FreeCAD/FreeCAD-git
./autogen.sh
git pull
PREFIX=/Applications/FreeCAD.app/Contents
</pre>
</pre>
And then repeat the compile step above.
Si vous avez installé les dépendances en utilisant l'option '''1 (Homebrew)''' :
== Troubleshooting ==

TODO
'''PS : cette ligne de configuration n'a pas été vérifiée et peut contenir des erreurs !'''
{{docnav|CompileOnUnix|Third Party Libraries}}
<pre>
./configure --with-xercesc-lib=/usr/local/lib --with-xercesc-include=/usr/local/include \
--with-boost-lib=/usr/local/lib --with-boost-include=/usr/local/include \
--with-qt4-dir=/usr/local--with-qt4-lib=/usr/local/lib --with-qt4-include=/usr/local/include \
--with-qt4-framework=/usr/local/lib --with-qt4-bin=/usr/local/bin --with-occ-lib=/usr/local/lib \
--with-occ-include=/usr/local/include/oce --with-coin=/usr/local/lib --with-soqt=/usr/local/lib \
--prefix=/Applications/FreeCAD.app/Contents --bindir=/Applications/FreeCAD.app/Contents/MacOS \
--libdir=/Applications/FreeCAD.app/Contents/Frameworks/FreeCAD \
--includedir=/Applications/FreeCAD.app/Contents/Resources/include \
--datarootdir=/Applications/FreeCAD.app/Contents/Resources/share --enable-debug=no \
--with-python-include=/System/Library/Frameworks/Python.framework/Versions/2.5/Headers
</pre>
ou, si vous avez installé les dépendances en utilisant l'option '''2 (MacPorts/Fink)''' :
<pre>
./configure --with-xercesc-lib=/opt/local/lib --with-xercesc-include=/opt/local/include \
--with-boost-lib=/opt/local/lib --with-boost-include=/opt/local/include \
--with-qt4-dir=/usr/local/Trolltech/Qt-4.8.0 --with-qt4-lib=/usr/local/Trolltech/Qt-4.8.0/lib \
--with-qt4-include=/usr/local/Trolltech/Qt-4.8.0/include --with-qt4-framework=/Library/Frameworks \
--with-qt4-bin=/usr/local/Trolltech/Qt-4.8.0/bin --with-occ-lib=/usr/local/lib \
--with-occ-include=/usr/local/include/oce --with-coin=/Library/Frameworks \
--with-soqt=/Library/Frameworks --prefix=/Applications/FreeCAD.app/Contents \
--bindir=/Applications/FreeCAD.app/Contents/MacOS --libdir=/Applications/FreeCAD.app/Contents/Frameworks/FreeCAD \
--includedir=/Applications/FreeCAD.app/Contents/Resources/include \
--datarootdir=/Applications/FreeCAD.app/Contents/Resources/share --enable-debug=no \
--with-python-include=/System/Library/Frameworks/Python.framework/Versions/2.5/Headers
</pre>
alors :
<pre>
make
make install
</pre>
Selon la puissance de votre machine, l'étape '''make''' peut prendre plus ou moins de temps.

=== Exécution ===

Si tout s'est bien passé, double-cliquez sur ​​le paquet '''.app''' pour démarrer FreeCAD.

Si vous avez des questions, postez les sur le [http://forum.freecadweb.org/viewforum.php?f=4 forum d'aide] (Anglais).

Une discussion a été ouverte en Français [https://forum.freecadweb.org/viewtopic.php?f=12&t=3538 Freecad sur Mac]

=== PyQt4 ===

Certains utilisateurs ont signalés un message '''"No module named PyQt4"''' au démarrage de FreeCAD.
Il y, a une solution de contournement pour le corriger :
<pre>
cd /Library/Python/2.6/site-packages
sudo ln -s /contrib/lib/python2.6/site-packages/PyQt4 .
sudo ln -s /contrib/lib/python2.6/site-packages/sip* .
cd /volatile/FreeCAD-r5443-ser/bin/pivy
cp _coin.dylib _coin.so
cd /volatile/FreeCAD-r5443-ser/lib
for i in *.dylib; do j=`basename $i .dylib`; cp $i $j.so; done
</pre>
=== Pivy ===

Certains composants de FreeCAD ne fonctionneront pas sans pivy. Allez voir [[Extra_python_modules/fr#Pivy|sur cette page]] pour les instructions de compilations partielles.


{{docnav/fr|[[CompileOnUnix/fr|CompileOnUnix]]|[[Third Party Libraries/fr|Third Party Libraries]]}}


[[Category:Developer Documentation/fr]]
[[Category:Developer Documentation]]


{{clear}}
{{clear}}

Revision as of 11:33, 20 December 2014

This page explains how to compile the latest FreeCAD source code on Mac OS X.

Prerequisites

First of all, you will need to install the following software.

Xcode Development Tools

Unless you want to use the Xcode IDE for FreeCAD development, you will only need to install the Command Line Tools. To do this on 10.9 and later, open Terminal, run the following command, and then click Install in the dialog that comes up.

xcode-select --install

For other versions of OS X, you can get the package from the Apple developer downloads page (sign in with the same Apple ID you use for other Apple services). Specifically, you will need to download Development Tools 3.2 for OS X 10.6, and Command Line Tools 4.8 for OS X 10.8.

CMake

Install the latest version of CMake from http://www.cmake.org/download. Although Homebrew will also install CMake, it only installs the command line executable.

Homebrew

To install Homebrew, enter the following in Terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Getting the source

In this guide, the source and build folders are created in /Users/username/FreeCAD, but you can of course use whatever folder you want.

mkdir ~/FreeCAD
cd ~/FreeCAD

To get the FreeCAD source code, run:

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

Alternatively, you can use the github mirror: https://github.com/FreeCAD/FreeCAD_sf_master.git

Installing the Dependencies

All of the needed libraries can be installed using Homebrew.

brew tap homebrew/science
brew tap sanelson/freecad
brew install boost eigen freetype oce python qt pyside pyside-tools xerces-c
brew install --without-framework --without-soqt sanelson/freecad/coin
brew install --HEAD pivy

Compiling FreeCAD

First, create a new folder for the build:

mkdir ~/FreeCAD/build

Now you will need to run CMake to generate the build files. Open the CMake app, and fill in the source and build folder fields. In this case, it would be /Users/username/FreeCAD/FreeCAD-git for the source, and /Users/username/FreeCAD/build for the build folder.

Next, click the Configure button. This will display a dialog asking you to specify what generator to use. Leave it at the default Unix Makefiles. Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the Advanced checkbox to get all of the options.

Option name Value Notes
BUILD_ROBOT OFF (unchecked) As of 12/19/2014, the robot module fails to build using newer versions of clang (OS X 10.9 and later)
CMAKE_BUILD_TYPE Release
FREECAD_USE_EXTERNAL_PIVY ON (checked)
FREETYPE_INCLUDE_DIR_freetype2 /usr/local/include/freetype2 You will only need to set this if you are using a CMake version older than 3.1.0
OCE_DIR /usr/local/Cellar/oce/0.16.1/OCE.framework/Versions/0.16/Resources
PYSIDERCC4BINARY /usr/local/bin/pyside-rcc
PYSIDEUIC4BINARY /usr/local/bin/pyside-uic
PYTHON_EXECUTABLE /usr/local/bin/python
PYTHON_INCLUDE_DIR /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7
PYTHON_LIBRARY /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib

Note: The above paths for OCE and Python are for versions 0.16.1 and 2.7.9, respectively -- change as needed.

Now click Configure again and then Generate.

Finally, run make to compile FreeCAD.

cd ~/FreeCAD/build
make –j3

The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.

If make finishes without any errors, you can now launch FreeCAD, either from Terminal with ./bin/FreeCAD, or by double clicking the executable in Finder.

Creating an application bundle

TODO

Updating

FreeCAD development happens fast; everyday or so there are bug fixes or new features. To get these changes, run:

cd ~/FreeCAD/FreeCAD-git
git pull

And then repeat the compile step above.

Troubleshooting

TODO

CompileOnUnix
Third Party Libraries