Kompilierung (Beschleunigung)

From FreeCAD Documentation
Revision as of 20:25, 19 November 2019 by Maker (talk | contribs)

FreeCAD ist eine große Anwendung, die zwischen 10 Minuten und einer Stunde dauern kann, um vollständig aus dem Quellcode kompiliert zu werden. Dies hängt in erster Linie von der CPU ab, die Du hast, und der Anzahl der Kerne, die für den Kompilierungsprozess verwendet werden. Hier sind einige Tipps, um diesen Prozess zu verkürzen und die Erstellungszeiten zu verkürzen.

CCache

Installiere ccache um die Erstellung zwischenzuspeichern.

Module deaktivieren

Wenn Du cmake zur Konfiguration des Build verwendest, kannst Du die Kompilierung bestimmter Arbeitsbereiche deaktivieren, die Du im Moment vielleicht nicht brauchst. Dies ist nützlich, wenn du nur ein paar Arbeitsbereiche testen musst.

Zum Beispiel, um den Aufbau der FEM- und Mesh-Arbeitsplätze zu vermeiden:

cmake -DBUILD_FEM=OFF -DBUILD_MESH=OFF ../freecad-source

Verwende cmake-gui, cmake-curses-gui, oder cmake-qt-gui, um alle möglichen Variablen anzuzeigen, die in der Konfiguration bearbeitet werden können; über diese Schnittstellen kannst du verschiedene Arbeitsbereiche leicht ein- oder ausschalten.

Number of jobs in parallel

After configuring with cmake, the make program launches the actual C++ compiler to work on the source code files. You can speed up compilation by working on various files at the same time. This is achieved with the -j option of make, which denotes the number of "jobs" or compilation commands that are run simultaneously. This option is an integer number.

Run four compilation commands in parallel:

make -j4

Compile as many files in parallel as the number of CPU cores in your system. This is useful if you have many cores and want to use them all to compile the software.

make -j$(nproc)

Compile as many files in parallel as the number of CPU cores in your system, minus two. Use this so that your system is still responsive to do some other task; for example, two cores will allow you to use a browser, while the rest of the cores keep compiling the software on the background.

make -j$(nproc --ignore=2)

distcc

The distcc program can be used to perform distributed compilation of C and C++ code across several machines in a network.