Compile on Docker/de: Difference between revisions

From FreeCAD Documentation
(Created page with "* 10GB freier Speicherplatz * Docker")
(Created page with "===Herunterladen der Quelle===")
Line 32: Line 32:
==Installation==
==Installation==


===Download the source===
===Herunterladen der Quelle===


The best way to get FreeCAD's source code is to clone the [https://github.com/FreeCAD/FreeCAD Git repository]. For this you need the {{incode|git}} program which can be easily installed in most Linux and Mac OS distributions, and it can also be obtained from the [http://git-scm.com/ official website].
The best way to get FreeCAD's source code is to clone the [https://github.com/FreeCAD/FreeCAD Git repository]. For this you need the {{incode|git}} program which can be easily installed in most Linux and Mac OS distributions, and it can also be obtained from the [http://git-scm.com/ official website].

Revision as of 20:14, 10 March 2020

This documentation is not finished. Please help and contribute documentation.

GuiCommand model explains how commands should be documented. Browse Category:UnfinishedDocu to see more incomplete pages like this one. See Category:Command Reference for all commands.

See WikiPages to learn about editing the wiki pages, and go to Help FreeCAD to learn about other ways in which you can contribute.

Überblick

Unter den Möglichkeiten, FreeCAD zu bauen und zu installieren, gibt es die Möglichkeit, Docker zu verwenden. Diese Methode ist vor allem für FreeCAD Entwickler nützlich, die Linux oder Mac OS Rechner verwenden.

Vorteile

Alle Abhängigkeiten von FreeCAD sind bereits installiert, miteinander kompatibel und entsprechend konfiguriert, so dass Du sehr schnell mit der Entwicklung beginnen kannst.

  • Die Abhängigkeiten sind im Docker Container enthalten, wodurch verhindert wird, dass unerwünschte Pakete Ihre Arbeitsstation verunreinigen und dass es zu Kollisionen von Versionen kommt.
  • Der Quellcode und die Bauverzeichnisse befinden sich außerhalb des Docker Containers. Dies erlaubt es Dir, deine bevorzugten Bearbeitungsprogramme, Versionierungssysteme, Entwicklungswerkzeuge usw. zu verwenden, ohne sie im Docker Container einrichten zu müssen. Du kannst sie einfach wie gewohnt direkt von deinem Arbeitsplatzrechner aus benutzen. (Außerdem bedeutet es, dass du den Docker Container nicht jedes Mal neu aufbauen musst, wenn du FreeCAD bauen willst).
  • Für diejenigen, die obskure *nix Distributionen und Gebrauchsanweisungen sind nicht verfügbar für das Holen von Abhängigkeiten verwenden, ist alles, was du auf deinem Arbeitsplatzrechner installieren musst, ein Docker, der in vielen Distributionen recht häufig verfügbar ist.
  • Er bietet eine statische, unveränderliche Entwicklungsumgebung. Ich persönlich finde das nützlich, wenn ich bei der Entwicklung die Anzahl der potentiellen Variablen, die ein Problem verursachen könnten, reduzieren möchte. Du weist, dass du zwischen den Builds nichts Esoterisches in der Umgebung verändert hast. Für Entwickler, die zusammenarbeiten und beide den gleichen Docker Container verwenden, kannst du sicher sein, dass ihr beide von der gleichen Umgebung aus arbeitet, was Kommunikationsfehler aufgrund von Unterschieden in der Umgebung reduziert.

Docker Repositorien

Vorbedingungen

  • 10GB freier Speicherplatz
  • Docker

Installation

Herunterladen der Quelle

The best way to get FreeCAD's source code is to clone the Git repository. For this you need the git program which can be easily installed in most Linux and Mac OS distributions, and it can also be obtained from the official website.

This will place a copy of the latest version of the FreeCAD source code in a new directory called freecad_source.

git clone https://github.com/FreeCAD/FreeCAD.git ~/my_code/freecad_source

For more information on using Git, and contributing code to the project, see Source code management.

Source archive

Alternatively you can download the source as an archive, a .zip or .tar.gz file, and unpack it in the desired directory.

Create build directory

Create a directory to hold your compiled FreeCAD source.

mkdir ~/my_code/freecad_build

Pull Docker image

Pull the Docker image. (Official image coming soon.)

docker pull registry.gitlab.com/daviddaish/freecad_docker_env:latest

Allow access to your window manager

In order for FreeCAD to launch it's GUI from within the Docker container, you need to give Docker access permissions to your window manager. In most Linux distributions, this is the X window system. You can use the below command to allow blanket access to X, until you reboot or logoff your computer.

xhost +

If you're connected to any untrusted systems, such as via ssh, this will make you vulnerable to malicious code. Either close any ssh connections, or look into more secure xhost permissions, which is outside the scope of this tutorial.

Mac OS users

For those using Mac OS, the X window system may not be installed. The XQuartz project is a long running open source project that will allow you to add it to your computer. You can find it here.

Launch the docker image

Assign environment variables so the Docker container will mount FreeCAD's source code, and build directory. In addition, you can mount an extra directory to contain any files you'd like to use for testing purposes. In the below snippet, we've left it as your home directory as a simple default.

fc_source=~/my_code/freecad_source
fc_build=~/my_code/freecad_build
other_files=~/

Launch the Docker image.

docker run -it --rm \
-v $fc_source:/mnt/source \
-v $fc_build:/mnt/build \
-v $other_files:/mnt/files \
-e "DISPLAY" -e "QT_X11_NO_MITSHM=1" -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
registry.gitlab.com/daviddaish/freecad_docker_env:latest

Build FreeCAD

You can build FreeCAD using the installed build script, or using your preferred method.

/root/build_script.sh

Run FreeCAD

Once FreeCAD has been built, it can be run as normal.

/mnt/build/bin/FreeCAD

You can find the attached directories in the /mnt directory.

Discussion

FreeCAD forum thread: https://forum.freecadweb.org/viewtopic.php?f=4&t=42954

Related