Compile on Linux/es: Difference between revisions

From FreeCAD Documentation
(Created page with "Compile on Linux/es")
 
(Updating to match new version of source page)
 
(232 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav
{{Docnav/es
|[[Compile_on_Windows|Compile on Windows]]
|[[Compile_on_Windows/es|Compilar en Windows]]
|[[Compile_on_MacOS|Compile on MacOS]]
|[[Compile_on_MacOS/es|Compilar en MacOS]]
}}
}}


{{VeryImportantMessage|There is an experimental FreeCAD Docker container that is being tested for FreeCAD development. Read more about it at [[Compile on Docker]]}}
{{VeryImportantMessage|Hay un contenedor experimental FreeCAD Docker que se está probando para el desarrollo de FreeCAD. Lea más sobre ello en [[Compile on Docker/es|Compilar en Docker]]}}

{{TOCright}}
{{TOCright}}
==Overview==
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:
# Getting the FreeCAD source code
# Getting the dependencies or packages that FreeCAD depends on
# Configure with {{incode|cmake}} and compile with {{incode|make}}


<span id="Overview"></span>
Below, you'll find detailed explanations of the whole process, some [[#Automatic build scripts|build scripts]], 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, discuss the issue in the [https://forum.freecadweb.org/index.php forum], and help us correct it.
== Vista general ==

En las distribuciones recientes de Linux, FreeCAD es generalmente fácil de construir, ya que todas las dependencias suelen ser proporcionadas por el administrador de paquetes. Básicamente implica 3 pasos:
# Obtener el código fuente de FreeCAD
# Obtener las dependencias o paquetes de los que depende FreeCAD
# Configurar con {{incode|cmake}} y compilar con {{incode|make}}

A continuación, encontrará explicaciones detalladas de todo el proceso, algunos [[#Automatic build scripts|build scripts]], y las particularidades que puede encontrar. Si encuentras algo incorrecto o desactualizado en el texto de abajo (las distribuciones de Linux cambian a menudo), o si usas una distribución que no está en la lista, discute el tema en el [https://forum.freecadweb.org/index.php forum], y ayúdanos a corregirlo.


[[File:FreeCAD_source_compilation_workflow.svg|800px]]
[[File:FreeCAD_source_compilation_workflow.svg|800px]]


{{Caption|General workflow to compile FreeCAD from source. The third party dependencies must be in the system, as well as the FreeCAD source code itself. CMake configures the system so that with a single make instruction the entire project is compiled.}}
{{Caption|Flujo de trabajo general para compilar FreeCAD desde la fuente. Las dependencias de terceros deben estar en el sistema, así como el propio código fuente de FreeCAD. CMake configura el sistema de manera que con una sola instrucción de creación se compila todo el proyecto.}}


<span id="Getting_the_source"></span>
== Getting the source ==
== Obtener la fuente ==


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


La mejor manera de obtener el código es clonar el repositorio Git de sólo lectura [https://github.com/FreeCAD/FreeCAD]. Para ello se necesita el programa {{incode|git}} que se puede instalar fácilmente en la mayoría de las distribuciones de Linux. También puede obtenerse en el [http://git-scm.com/ sitio web oficial].
This will place a copy of the latest version of the FreeCAD source code in a new directory called {{incode|freecad-source}}.

Git se puede instalar mediante el siguiente comando:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
sudo apt install git
sudo apt install git
git clone https://github.com/FreeCAD/FreeCAD.git freecad-source
}}
}}


El siguiente comando colocará una copia de la última versión del código fuente de FreeCAD en un nuevo directorio llamado {{incode|freecad-source}}.
For more information on using Git, and contributing code to the project, see [[Source code management|Source code management]].


{{Code|lang=bash|code=
=== Source archive ===
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source
Alternatively you can download the source as an [https://github.com/FreeCAD/FreeCAD/releases/latest archive], a {{incode|.zip}} or {{incode|.tar.gz}} file, and unpack it in the desired directory.
}}

Para más información sobre el uso de Git y la contribución de código al proyecto, véase [[Source code management/rs|Gestión del código fuente]].

<span id="Source_archive"></span>
=== Archivo Fuente ===

También puede descargar el código fuente como un archivo [https://github.com/FreeCAD/FreeCAD/releases/latest], un archivo {{incode|.zip}} o {{incode|.tar.gz}}, y descomprimirlo en el directorio deseado.

<span id="Getting_the_dependencies"></span>
== Obtener las dependencias ==


Para compilar FreeCAD tienes que instalar las dependencias necesarias mencionadas en [[Third Party Libraries/es|Bibliotecas de terceros]]; los paquetes que contienen estas dependencias están listados abajo para diferentes distribuciones de Linux. Tenga en cuenta que los nombres y la disponibilidad de las bibliotecas dependerán de su distribución particular; si su distribución es antigua, algunos paquetes pueden no estar disponibles o tener un nombre diferente. En este caso, busque en la sección [[#Older and non-conventional distributions|Distribuciones antiguas y no convencionales]] más abajo.
== Getting the dependencies ==
To compile FreeCAD you have to install the requisite dependencies mentioned in [[Third Party Libraries|Third Party Libraries]]; the packages that contain these dependencies are listed below for different Linux distributions. Please note that the names and availability of the libraries will depend on your particular distribution; if your distribution is old, some packages may be unavailable of have a different name. In this case, look in the [[#Older and non-conventional distributions|older and non-conventional distributions]] section below.


Once you have all the dependencies installed proceed to [[#Compile_FreeCAD|compile FreeCAD]].
Una vez que tengas todas las dependencias instaladas, procede a [[#Compilar_FreeCAD|compilar FreeCAD]].


Ten en cuenta que el código fuente de FreeCAD tiene un tamaño de unos 500 MB; puede ser tres veces mayor si clonas el repositorio Git con todo su historial de modificaciones. Obtener todas las dependencias puede requerir la descarga de 500 MB o más de nuevos archivos; cuando estos archivos se descomprimen pueden requerir 1500 MB o más de espacio. También ten en cuenta que el proceso de compilación puede generar hasta 1500 MB de archivos adicionales ya que el sistema copia y modifica todo el código fuente. Por lo tanto, asegúrese de tener suficiente espacio libre en su disco duro, al menos 4 GB, cuando intente la compilación.
Please note that FreeCAD's source code is around 500 MB in size; it may be three times as big if you clone the Git repository with its entire modification history. Getting all dependencies may require downloading 500 MB or more of new files; when these files are unpacked they may require 1500 MB or more in space. Also beware that the compilation process may generate up to 1500 MB of additional files as the system copies and modifies the entire source code. Therefore, be sure you have enough free space in your hard drive, at least 4 GB, when attempting compilation.


<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">


<span id="Debian_and_Ubuntu"></span>
=== Debian and Ubuntu ===
=== Debian y Ubuntu ===


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


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 {{incode|apt}} or the Synaptic package manager.
En los sistemas basados en Debian (Debian, Ubuntu, Mint, etc.) es bastante fácil conseguir instalar todas las dependencias necesarias. La mayoría de las bibliotecas están disponibles a través de {{incode|apt}} o del gestor de paquetes Synaptic.


If you already installed FreeCAD from the official repositories, you can install its build dependencies with this single line of code in a terminal:
Si ya has instalado FreeCAD desde los repositorios oficiales, puedes instalar sus dependencias de construcción con esta única línea de código en un terminal:


{{Code|code=
{{Code|code=
Line 57: Line 74:
}}
}}


Alternatively, replace {{incode|freecad}} with {{incode|freecad-daily}} to install the build dependencies for the main development branch. You'll need to have the [[Installing_on_Linux#Development_PPA_(Daily)|freecad-stable/freecad-daily PPAs]] added to your software sources.
However, if the version of FreeCAD in the repositories is old, the dependencies may be the wrong ones to compile a recent version of FreeCAD. Therefore, please verify that you have installed the following packages.


Sin embargo, si la versión de FreeCAD en los repositorios es antigua, las dependencias pueden ser las incorrectas para compilar una versión reciente de FreeCAD. Por lo tanto, comprueba que tienes instalados los siguientes paquetes.
These packages are essential for any sort of compilation to succeed:
*{{incode|build-essential}}, installs the C and C++ compilers, the C development libraries, and the {{incode|make}} program.
*{{incode|cmake}}, essential tool to configure the source of FreeCAD. You may also wish to install {{incode|cmake-gui}} and {{incode|cmake-curses-gui}} for a graphical option.
*{{incode|libtool}}, essential tools to produce shared libraries.
*{{incode|lsb-release}}, the standard base reporting utility is normally already installed in a Debian system, and allows you to programmatically distinguish between a pure Debian installation or a variant, such as Ubuntu or Linux Mint. Do not remove this package, as many other system packages may depend on it.


Estos paquetes son esenciales para que cualquier tipo de compilación tenga éxito:
Compilation of FreeCAD uses the Python language, and it's also used at runtime as a scripting language. If you are using a Debian based distribution the Python interpreter is normally already installed.
*{{incode|build-essential}}, instala los compiladores C y C++, las librerías de desarrollo C y el programa {{incode|make}}.
*{{incode|cmake}}, herramienta esencial para configurar el código fuente de FreeCAD. También puedes querer instalar {{incode|cmake-gui}} y {{incode|cmake-curses-gui}} para una opción gráfica.
*{{incode|libtool}}, herramientas esenciales para producir bibliotecas compartidas.
*{{incode|lsb-release}}, la utilidad estándar de informes de base normalmente ya está instalada en un sistema Debian, y le permite distinguir mediante programación entre una instalación Debian pura o una variante, como Ubuntu o Linux Mint. No elimine este paquete, ya que muchos otros paquetes del sistema pueden depender de él.

La compilación de FreeCAD utiliza el lenguaje Python, y también se utiliza en tiempo de ejecución como lenguaje de scripting. Si estás usando una distribución basada en Debian el intérprete de Python normalmente ya está instalado.
*{{incode|python3}}
*{{incode|python3}}
*{{incode|swig}}, the tool that creates interfaces between C++ code and Python.
*{{incode|swig}}, la herramienta que crea interfaces entre el código C++ y Python.


Please check that you have Python 3 installed. Python 2 was obsoleted in 2019, so new development in FreeCAD is not tested with this version of the language.
Por favor, comprueba que tienes instalado Python 3. Python 2 quedó obsoleto en 2019, por lo que los nuevos desarrollos en FreeCAD no se prueban con esta versión del lenguaje.


Es necesario instalar las bibliotecas Boost:
The Boost libraries need to be installed:


*{{incode|libboost-dev}}
*{{incode|libboost-dev}}
Line 82: Line 101:
*{{incode|libboost-regex-dev}}
*{{incode|libboost-regex-dev}}
*{{incode|libboost-serialization-dev}}
*{{incode|libboost-serialization-dev}}
*{{incode|libboost-signals-dev}}
*{{incode|libboost-thread-dev}}
*{{incode|libboost-thread-dev}}


<div class="mw-translate-fuzzy">
The Coin libraries need to be installed:
Es necesario instalar las bibliotecas de Coin:
*{{incode|libcoin80-dev}}, for Debian Jessie, Stretch, Ubuntu 16.04 to 18.10, or
*{{incode|libcoin80-dev}}, para Debian Jessie, Stretch, Ubuntu 16.04 a 18.10, o
*{{incode|libcoin-dev}}, for Debian Buster, Ubuntu 19.04 and newer, as well as for Ubuntu 18.04/18.10 with the [[Install_on_Linux#Official_Ubuntu_repository|freecad-stable/freecad-daily PPAs]] added to your software sources.
*{{incode|libcoin-dev}}, para Debian Buster, Ubuntu 19.04 y más recientes, así como para Ubuntu 18.04/18.10 con los PPAs [[Installing_on_Linux#Official_Ubuntu_repository|freecad-stable/freecad-daily]] añadidos a sus fuentes de software.
</div>


Varias bibliotecas que se ocupan de las matemáticas, las superficies trianguladas, la ordenación, las mallas, la visión por ordenador, las proyecciones cartográficas, la visualización 3D, el sistema de ventanas X11, el análisis sintáctico de XML y la lectura de archivos Zip:
Several libraries that deal with mathematics, triangulated surfaces, sorting, meshes, computer vision, cartographic projections, 3D visualization, the X11 Window system, XML parsing, and Zip file reading:


*{{incode|libeigen3-dev}}
*{{incode|libeigen3-dev}}
Line 101: Line 121:
*{{incode|libx11-dev}}
*{{incode|libx11-dev}}
*{{incode|libxerces-c-dev}}
*{{incode|libxerces-c-dev}}
*{{incode|libyaml-cpp-dev}}
*{{incode|libzipios++-dev}}
*{{incode|libzipios++-dev}}


<div class="mw-collapsible mw-collapsed" style="background-color:#e0e0e0">
<div class="mw-collapsible mw-collapsed" style="background-color:#e0e0e0">


<span id="Python_2_and_Qt4"></span>
==== Python 2 and Qt4 ====
==== Python 2 y Qt4 ====
This is not recommended for newer installations as both Python 2 and Qt4 are obsolete.

Esto no se recomienda para las instalaciones más recientes, ya que tanto Python 2 como Qt4 están obsoletos. A partir de la versión 0.20, FreeCAD ya no los soporta.


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


To compile FreeCAD for Debian Jessie, Stretch, Ubuntu 16.04, using Python 2 and Qt4, install the following dependencies.
Para compilar FreeCAD para Debian Jessie, Stretch, Ubuntu 16.04, usando Python 2 y Qt4, instala las siguientes dependencias.


*{{incode|qt4-dev-tools}}
*{{incode|qt4-dev-tools}}
Line 128: Line 151:
</div>
</div>


<span id="Python_3_and_Qt5"></span>
==== Python 3 and Qt5 ====
==== Python 3 y Qt5 ====


<div class="mw-translate-fuzzy">
To compile FreeCAD for Debian Buster, Ubuntu 19.04 and newer, as well as Ubuntu 18.04/18.10 with the [[Install_on_Linux#Official_Ubuntu_repository|freecad-stable/freecad-daily PPAs]] added to your software sources, install the following dependencies.
Para compilar FreeCAD para Debian Buster, Ubuntu 19.04 y posteriores, así como Ubuntu 18.04/18.10 con el [[Installing_on_Linux/es#Repositorio_Oficial_Ubuntu|freecad-stable/freecad-daily PPAs]] añadido a sus fuentes de software, instale las siguientes dependencias.
</div>


*{{incode|qtbase5-dev}}
*{{incode|qtbase5-dev}}
*{{incode|qttools5-dev}}
*{{incode|qttools5-dev}}
*{{incode|qt5-default}} (if compiling 0.20 on a machine that still has Qt4)
*{{incode|libqt5opengl5-dev}}
*{{incode|libqt5opengl5-dev}}
*{{incode|libqt5svg5-dev}}
*{{incode|libqt5svg5-dev}}
*{{incode|libqt5webkit5-dev}} or {{incode|qtwebengine5-dev}}
*{{incode|qtwebengine5-dev}}
*{{incode|libqt5xmlpatterns5-dev}}
*{{incode|libqt5xmlpatterns5-dev}}
*{{incode|libqt5x11extras5-dev}}
*{{incode|libqt5x11extras5-dev}}
Line 142: Line 169:
*{{incode|libshiboken2-dev}}
*{{incode|libshiboken2-dev}}
*{{incode|pyside2-tools}}
*{{incode|pyside2-tools}}
*{{incode|pyqt5-dev-tools}}
*{{incode|python3-dev}}
*{{incode|python3-dev}}
*{{incode|python3-matplotlib}}
*{{incode|python3-matplotlib}}
*{{incode|python3-packaging}}
*{{incode|python3-pivy}}
*{{incode|python3-pivy}}
*{{incode|python3-ply}}
*{{incode|python3-ply}}
Line 150: Line 179:
*{{incode|python3-pyside2.qtsvg}}
*{{incode|python3-pyside2.qtsvg}}
*{{incode|python3-pyside2.qtwidgets}}
*{{incode|python3-pyside2.qtwidgets}}
*{{incode|python3-pyside2.qtnetwork}}
*{{incode|python3-pyside2.qtwebengine}}
*{{incode|python3-pyside2.qtwebenginecore}}
*{{incode|python3-pyside2.qtwebenginewidgets}}
*{{incode|python3-pyside2.qtwebchannel}}
*{{incode|python3-pyside2uic}}
*{{incode|python3-pyside2uic}}


<span id="OpenCascade_kernel"></span>
==== OpenCascade kernel ====
==== Núcleo OpenCascade ====


The OpenCascade kernel is the core graphics library to create 3D shapes. It exists in an official version OCCT, and a community version OCE. The community version is no longer recommended, as it's outdated.
El núcleo de OpenCascade es el núcleo de la biblioteca de gráficos para crear formas 3D. Existe una versión oficial OCCT, y una versión comunitaria OCE. La versión de la comunidad ya no se recomienda, ya que está obsoleta.


<div class="mw-translate-fuzzy">
For Debian Buster and Ubuntu 18.10 and newer, as well as Ubuntu 18.04 with the [[Install_on_Linux#Official_Ubuntu_repository|freecad-stable/freecad-daily PPAs]] added to your software sources, install the official packages.
Para Debian Buster y Ubuntu 18.10 y posteriores, así como para Ubuntu 18.04 con el [[Installing_on_Linux#Repositorio_Oficial_Ubuntu|freecad-stable/freecad-daily PPAs]] añadido a sus fuentes de software, instale los paquetes oficiales.
</div>


*{{incode|libocct*-dev}}
*{{incode|libocct*-dev}}
Line 168: Line 205:
*{{incode|occt-draw}}
*{{incode|occt-draw}}


For Debian Jessie, Stretch, Ubuntu 16.04 and newer, install the community edition packages.
Para Debian Jessie, Stretch, Ubuntu 16.04 y posteriores, instale los paquetes de la edición comunitaria.


*{{incode|liboce*-dev}}
*{{incode|liboce*-dev}}
Line 178: Line 215:
*{{incode|oce-draw}}
*{{incode|oce-draw}}


You may install the libraries individually, or using asterisk expansion. Change {{incode|occ}} for {{incode|oce}} if you want to install the community libraries.
Puede instalar las bibliotecas individualmente, o utilizando la expansión de asterisco. Cambie {{incode|occ}} por {{incode|oce}} si desea instalar las bibliotecas comunitarias.


{{Code|code=
{{Code|code=
Line 184: Line 221:
}}
}}


<span id="Optional_packages"></span>
==== Optional packages ====
==== Paquetes opcionales ====
Optionally you can also install these extra packages:
* {{incode|libsimage-dev}}, to make Coin support additional image file formats.
* {{incode|doxygen}} and {{incode|libcoin-doc}} (or {{incode|libcoin80-doc}} for older systems), if you intend to generate source code documentation.
* {{incode|libspnav-dev}}, for [[3D input devices|3D input devices]] support, like the 3Dconnexion "Space Navigator" or "Space Pilot".
* {{incode|checkinstall}}, if you intend to register your installed files into your system's package manager, so you can uninstall it later.


<div class="mw-translate-fuzzy">
==== Single command for Python 3 and Qt5 ====
Opcionalmente, también puede instalar estos paquetes adicionales:
Requires Pyside2 available in Debian buster and the [[Install_on_Linux#Official_Ubuntu_repository|freecad-stable/freecad-daily PPAs]].
* {{incode|libsimage-dev}}, para que Coin soporte formatos de archivo de imagen adicionales.
* {{incode|doxygen}} y {{incode|libcoin-doc}} (o {{incode|libcoin80-doc}} para los sistemas más antiguos), si quieres generar documentación del código fuente.
* {{incode|libspnav-dev}}, para soporte de [[3D input devices/es|Dispositivos de entrada 3D]], como el "Space Navigator" o el "Space Pilot" de 3Dconnexion.
* {{incode|checkinstall}}, si pretende registrar los archivos instalados en el gestor de paquetes de su sistema, para poder desinstalarlo más tarde.
</div>


<span id="Single_command_for_Python_3_and_Qt5"></span>
{{Code|code=
==== Comando único para Python 3 y Qt5 ====
sudo apt install cmake cmake-gui libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-signals-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2uic qtbase5-dev qttools5-dev swig

Requiere Pyside2 disponible en Debian buster y el [[Installing_on_Linux/es#Repositorio_Oficial_Ubuntu|freecad-stable/freecad-daily PPAs]].

{{Code|lang=bash|code=
sudo apt install cmake cmake-gui libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev qtwebengine5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-packaging python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2.qtnetwork python3-pyside2.qtwebengine python3-pyside2.qtwebenginecore python3-pyside2.qtwebenginewidgets python3-pyside2.qtwebchannel python3-markdown python3-git python3-pyside2uic qtbase5-dev qttools5-dev swig libyaml-cpp-dev
}}
}}

NOTA: En algunas versiones de Ubuntu y algunas versiones de Qt, obtendrá un error de que no se puede encontrar python3-pyside2uic - en esos sistemas puede omitirlo con seguridad. En Ubuntu 20.04 tendrá que añadir {{incode|pyqt5-dev-tools}}. Puede encontrar más información en [https://forum.freecadweb.org/viewtopic.php?t=51324 esta discusión del foro].


<div class="mw-collapsible mw-collapsed" style="background-color:#e0e0e0">
<div class="mw-collapsible mw-collapsed" style="background-color:#e0e0e0">


<span id="Single_command_for_Python_2_and_Qt4"></span>
==== Single command for Python 2 and Qt4 ====
==== Comando único para Python 2 y Qt4 ====
This is not recommended for newer installations as both Python 2 and Qt4 are obsolete.

Esto no se recomienda para las instalaciones más recientes, ya que tanto Python 2 como Qt4 están obsoletos.


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


{{Code|code=
{{Code|lang=bash|code=
sudo apt install cmake debhelper dh-exec dh-python libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-signals-dev libboost-thread-dev libcoin80-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libspnav-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev lsb-release occt-draw pyside-tools python-dev python-matplotlib python-pivy python-ply swig
sudo apt install cmake debhelper dh-exec dh-python libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin80-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libspnav-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev lsb-release occt-draw pyside-tools python-dev python-matplotlib python-pivy python-ply swig
}}
}}


Ubuntu 16.04 users please see also the compilation discussion in the forum: [http://forum.freecadweb.org/viewtopic.php?f=4&t=16292 Compile on Linux (Kubuntu): CMake can't find VTK].
Los usuarios de Ubuntu 16.04 por favor vean también la discusión de compilación en el foro: [http://forum.freecadweb.org/viewtopic.php?f=4&t=16292 Compilación en Linux (Kubuntu): CMake no puede encontrar VTK].


</div>
</div>
Line 221: Line 268:


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Follow the same steps as in Debian and Ubuntu.
Siga los mismos pasos que en Debian y Ubuntu.


<div class="mw-translate-fuzzy">
There are problems reported when trying to compile in Raspbian with Python 3 and Qt5, but the combination Python 3 and Qt4 seems to work for older versions of FreeCAD.
Hay problemas reportados cuando se intenta compilar en Raspbian con Python 3 y Qt5, pero la combinación Python 3 y Qt4 parece funcionar para versiones antiguas de FreeCAD.
</div>


<div class="mw-translate-fuzzy">
For newer versions of FreeCAD the compilation with Py3/Qt5 is successful if the operating system installed is Ubuntu 20.04.
Para las nuevas versiones de FreeCAD la compilación con Py3/Qt5 tiene éxito si el sistema operativo instalado es Ubuntu 20.04.
</div>


<div class="mw-translate-fuzzy">
Due to different issues with Qt, in this version the normal PySide tools won't be found.
Debido a diferentes problemas con Qt, en esta versión no se encontrarán las herramientas normales de PySide.
</div>
{{Code|lang=bash|code=
{{Code|lang=bash|code=
E: Unable to locate package python3-pyside2uic
E: Unable to locate package python3-pyside2uic
}}
}}


En este caso, podemos instalar los paquetes desde PyQt y crear enlaces simbólicos a las herramientas necesarias.
In this case, we can install the packages from PyQt and create symbolic links to the needed tools.
{{Code|lang=bash|code=
{{Code|lang=bash|code=
sudo apt-get install pyqt5-dev
sudo apt-get install pyqt5-dev
Line 241: Line 294:
}}
}}


Ahora la compilación puede continuar.
Now compilation may proceed.
{{Code|lang=bash|code=
{{Code|lang=bash|code=
cd freecad-build/
cd freecad-build/
Line 248: Line 301:
}}
}}


The {{incode|-j}} option to {{incode|make}} should not be more than 3 because the Raspberry Pi has limited memory. It will take several hours to compile, so it is better to do it overnight.
La opción {{incode|-j}} de {{incode|make}} no debe ser más de 3 porque la Raspberry Pi tiene memoria limitada. Tardará varias horas en compilar, por lo que es mejor hacerlo durante la noche.


More information, [https://forum.freecadweb.org/viewtopic.php?f=42&t=37458&start=160#p396652 FreeCAD and Raspberry Pi 4].
Más información, [https://forum.freecadweb.org/viewtopic.php?f=42&t=37458&start=160#p396652 FreeCAD y Raspberry Pi 4].
</div>
</div>
</div>
</div>
Line 259: Line 312:


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
There is a bug in cmake distributed by Fedora 34/35 which results in cmake failing to find the opencascade libraries. This can easily be fixed by making one minor change to the top level cmake file of opencascade installed on Fedora. Details here:
https://bugzilla.redhat.com/show_bug.cgi?id=2083568.


Near the top of the file {{FileName|OpenCASCADEConfig.cmake}}, change the following line to use {{Incode|REAL_PATH()}}. This fixes a bug introduced by the use of a symlink from {{Incode|/lib}} to {{Incode|/usr/lib}} of Fedora, which causes cmake to fail.
You need the following packages :


This file is usually installed in {{FileName|/usr/lib64/cmake/opencascade/OpenCASCADEConfig.cmake}}.
<!--<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">-->
*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


{{Code|lang=bash|code=
(if coin2 is the latest available for your version of Fedora, use packages from http://www.zultron.com/rpm-repo/)
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
}}


change this to:
*soqt-devel

*freetype
{{Code|lang=bash|code=
*freetype-devel
file (REAL_PATH ${OpenCASCADE_INSTALL_PREFIX} OpenCASCADE_INSTALL_PREFIX)
*vtk
}}
*med
*med-devel
<!--</div>-->


This trivial change needs to be made inside the build directory once cmake has been run and failed. Re-running cmake will then correctly detect the OCCT libraries in the normal way.
And optionally :


==== Fedora38/39 ====
<!--<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">-->


Now install Python 3.11. This includes a notable change in how Python initializes when running a program. As a result FreeCAD fails to find OpenCamLib, meaning [[CAM_Surface|3D Surface]] and [[CAM_Waterline|Waterline]] are not available in the [[CAM_Workbench|CAM Workbench]]. This was fixed in the master branch on 20th Mar 2024 ([https://github.com/FreeCAD/FreeCAD/pull/13059 Pull request #13059]).
*libspnav-devel (for 3Dconnexion devices support like the Space Navigator or Space Pilot)

*pivy ( https://bugzilla.redhat.com/show_bug.cgi?id=458975 Pivy is not mandatory but needed for the Draft module)
<div class="mw-translate-fuzzy">
Necesita los siguientes paquetes :
</div>

*{{Incode|gcc-c++}} (or possibly another C++ compiler?)
*{{Incode|cmake}}
*{{Incode|doxygen}}
*{{Incode|swig}}
*{{Incode|gettext}}
*{{Incode|dos2unix}}
*{{Incode|desktop-file-utils}}
*{{Incode|libXmu-devel}}
*{{Incode|freeimage-devel}}
*{{Incode|mesa-libGLU-devel}}
*{{Incode|opencascade-devel}}
*{{Incode|openmpi-devel}}
*{{Incode|python3}}
*{{Incode|python3-devel}}
*{{Incode|python3-pyside2}}
*{{Incode|python3-pyside2-devel}}
*{{Incode|pyside2-tools}}
*{{Incode|boost-devel}}
*{{Incode|tbb-devel}}
*{{Incode|eigen3-devel}}
*{{Incode|qt-devel}}
*{{Incode|qt5-qtwebengine-devel}}
*{{Incode|qt5-qtxmlpatterns}}
*{{Incode|qt5-qtxmlpatterns-devel}}
*{{Incode|qt5-qtsvg-devel}}
*{{Incode|qt5-qttools-static}}
*{{Incode|ode-devel}}
*{{Incode|xerces-c}}
*{{Incode|xerces-c-devel}}
*{{Incode|opencv-devel}}
*{{Incode|smesh-devel}}
*{{Incode|Coin3}}
*{{Incode|Coin3-devel}}
*{{Incode|yaml-cpp}}

(Abril 2021, Coin4 y Coin4-devel están disponibles )
(si coin2 es el último disponible para su versión de Fedora, utilice los paquetes de http://www.zultron.com/rpm-repo/)

*{{Incode|SoQt-devel}}
*{{Incode|freetype}}
*{{Incode|freetype-devel}}
*{{Incode|vtk}}
*{{Incode|vtk-devel}}
*{{Incode|med}}
*{{Incode|med-devel}}

<div class="mw-translate-fuzzy">
Y opcionalmente:
</div>

<div class="mw-translate-fuzzy">
*libspnav-devel (para el soporte de dispositivos 3Dconnexion como el Space Navigator o el Space Pilot)
*python3-pivy ( https://bugzilla.redhat.com/show_bug.cgi?id=458975 Pivy no es obligatorio pero es necesario para el módulo Borrador)
</div>

To install all dependencies at once (tested on fedora 36 and 37):

{{Code|lang=bash|code=
sudo dnf install gcc-c++ cmake doxygen swig gettext dos2unix desktop-file-utils libXmu-devel freeimage-devel mesa-libGLU-devel opencascade-devel openmpi-devel python3 python3-devel python3-pyside2 python3-pyside2-devel pyside2-tools boost-devel tbb-devel eigen3-devel qt-devel qt5-qtwebengine-devel qt5-qtxmlpatterns qt5-qtxmlpatterns-devel qt5-qtsvg-devel qt5-qttools-static ode-devel xerces-c xerces-c-devel opencv-devel smesh-devel Coin3 Coin3-devel SoQt-devel freetype freetype-devel vtk vtk-devel med med-devel libspnav-devel python3-pivy python3-markdown python3-GitPython yaml-cpp
}}


</div>
</div>
Line 315: Line 408:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


Easiest way to check which packages are needed to compile FreeCAD is to check via portage:
La forma más fácil de comprobar qué paquetes son necesarios para compilar FreeCAD es comprobarlo a través de portage:


<tt>emerge -pv freecad</tt>
<tt>emerge -pv freecad</tt>


Esto debería dar una buena lista de paquetes adicionales que necesitas instalar en tu sistema.
This should give a nice list of extra packages that you need installed on your system.


If FreeCAD is not available on portage, it is available on the [https://github.com/waebbl/waebbl-gentoo waebbl overlay]. The issue tracker on the waebbl overlay Github may help guide through some issues you may come across. The overlay provides <tt>freecad-9999</tt>, which you can choose to compile, or simply use to get the dependencies.
Si FreeCAD no está disponible en Portage, está disponible en [https://github.com/waebbl/waebbl-gentoo waebbl overlay]. El rastreador de problemas en el Github de la superposición waebbl puede ayudar a guiar a través de algunos problemas que puede encontrar. El overlay proporciona <tt>freecad-9999</tt>, que puedes elegir para compilar, o simplemente usar para obtener las dependencias.


<tt>layman -a waebbl</tt>
<tt>layman -a waebbl</tt>
Line 335: Line 428:
==== Tumbleweed ====
==== Tumbleweed ====


The following commands will install the packages required for building FreeCAD with Qt5 and Python 3.
Los siguientes comandos instalarán los paquetes necesarios para construir FreeCAD con Qt5 y Python 3.


{{Code|code=
{{Code|code=
zypper in --no-recommends -t pattern devel_C_C++ devel_qt5
zypper in --no-recommends -t pattern devel_C_C++ devel_qt5


zypper in libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel boost-devel swig libboost_program_options-devel libboost_mpi_python3-devel libboost_system-devel libboost_program_options-devel libboost_regex-devel libboost_python3-devel libboost_thread-devel libboost_system-devel libboost_headers-devel libboost_graph-devel python3 python3-devel python3-matplotlib python3-matplotlib-qt5 python3-pyside2 python3-pyside2-devel python3-pivy gcc gcc-fortran cmake occt-devel libXi-devel opencv-devel libxerces-c-devel Coin-devel SoQt-devel freetype2-devel eigen3-devel libode6 vtk-devel libmed-devel hdf5-openmpi-devel openmpi2-devel netgen-devel freeglut-devel libspnav-devel f2c doxygen dos2unix glew-devel
zypper in libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel boost-devel swig libboost_program_options-devel libboost_mpi_python3-devel libboost_system-devel libboost_program_options-devel libboost_regex-devel libboost_python3-devel libboost_thread-devel libboost_system-devel libboost_headers-devel libboost_graph-devel python3 python3-devel python3-matplotlib python3-matplotlib-qt5 python3-pyside2 python3-pyside2-devel python3-pivy gcc gcc-fortran cmake occt-devel libXi-devel opencv-devel libxerces-c-devel Coin-devel SoQt-devel freetype2-devel eigen3-devel libode6 vtk-devel libmed-devel hdf5-openmpi-devel openmpi2-devel netgen-devel freeglut-devel libspnav-devel f2c doxygen dos2unix glew-devel yaml-cpp
}}
}}


The following command will install Qt Creator and the GNU Project Debugger.
El siguiente comando instalará Qt Creator y el depurador de proyectos GNU.


{{Code|code=zypper in libqt5-creator gdb}}
{{Code|code=zypper in libqt5-creator gdb}}


If any packages are missing, then you can check the Tumbleweed [https://build.opensuse.org/package/view_file/openSUSE:Factory/FreeCAD/FreeCAD.spec "FreeCAD.spec"] file on the [https://build.opensuse.org/package/show/openSUSE:Factory/FreeCAD Open Build Service].
Si falta algún paquete, puedes comprobar el archivo Tumbleweed [https://build.opensuse.org/package/view_file/openSUSE:Factory/FreeCAD/FreeCAD.spec "FreeCAD.spec"] en el [https://build.opensuse.org/package/show/openSUSE:Factory/FreeCAD Open Build Service].


Also, check to see if there are any patches you need to apply (such as [https://build.opensuse.org/package/view_file/openSUSE:Factory/FreeCAD/0001-find-openmpi2-include-files.patch 0001-find-openmpi2-include-files.patch]).
Además, compruebe si hay algún parche que deba aplicar (como [https://build.opensuse.org/package/view_file/openSUSE:Factory/FreeCAD/0001-find-openmpi2-include-files.patch 0001-find-openmpi2-include-files.patch]).


==== Leap ====
==== Leap ====


If there is a difference between the available packages on Tumbleweed and Leap, then you can read the Leap [https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0/FreeCAD/FreeCAD.spec "FreeCAD.spec"] file on the [https://build.opensuse.org/ Open Build Service] to determine the required packages.
Si hay una diferencia entre los paquetes disponibles en Tumbleweed y Leap, entonces puedes leer el archivo Leap [https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0/FreeCAD/FreeCAD.spec "FreeCAD.spec"] en el [https://build.opensuse.org/ Open Build Service] para determinar los paquetes necesarios.

Ver [https://forum.freecadweb.org/viewtopic.php?f=4&t=49726 piano_jonas guía no oficial "Compilar en openSUSE"].


</div>
</div>
Line 363: Line 458:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


Necesitará las siguientes bibliotecas de los depósitos oficiales:
You will need the following libraries from the official repositories:
<!--<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">-->
*boost
*curl
*desktop-file-utils
*glew
*hicolor-icon-theme
*jsoncpp
*libspnav
*opencascade
*shiboken2
*xerces-c
*pyside2
*python-matplotlib
*python-netcdf4
*qt5-svg
*qt5-webkit
*qt5-webengine
*boost
*cmake
*eigen
*git
*gcc-fortran
*pyside2-tools
*swig
*qt5-tools
*shared-mime-info
<!--</div>-->


*{{incode|boost}}
Also, make sure to check the AUR for any missing packages that are not on the repositories, currently:
*{{incode|cmake}}

*coin
*{{incode|coin}}
*{{incode|curl}}
*python-pivy
*{{incode|desktop-file-utils}}
*med
*{{incode|eigen}}
*{{incode|gcc-fortran}}
*{{incode|git}}
*{{incode|glew}}
*{{incode|hicolor-icon-theme}}
*{{incode|jsoncpp}}
*{{incode|libspnav}}
*{{incode|med}}
*{{incode|nlohmann-json}}
*{{incode|opencascade}}
*{{incode|pyside2-tools}}
*{{incode|pyside2}}
*{{incode|python-matplotlib}}
*{{incode|python-netcdf4}}
*{{incode|python-packaging}}
*{{incode|python-pivy}}
*{{incode|qt5-svg}}
*{{incode|qt5-tools}}
*{{incode|qt5-webengine}}
*{{incode|shared-mime-info}}
*{{incode|shiboken2}}
*{{incode|swig}}
*{{incode|utf8cpp}}
*{{incode|verdict}}
*{{incode|xerces-c}}
*{{incode|yaml-cpp}}


{{Code|code=
{{Code|code=
sudo pacman -S boost curl desktop-file-utils glew hicolor-icon-theme jsoncpp libspnav opencascade shiboken2 xerces-c pyside2 python-matplotlib python-netcdf4 qt5-svg qt5-webkit qt5-webengine cmake eigen git gcc-fortran pyside2-tools swig qt5-tools shared-mime-info coin python-pivy med
sudo pacman -S --needed boost cmake coin curl desktop-file-utils eigen gcc-fortran git glew hicolor-icon-theme jsoncpp libspnav med nlohmann-json opencascade pyside2-tools pyside2 python-matplotlib python-netcdf4 python-packaging python-pivy qt5-svg qt5-tools qt5-webengine shared-mime-info shiboken2 swig utf8cpp xerces-c yaml-cpp
}}
}}

Note: Since version 5.0.1 of the {{incode|openmpi}} package the binary {{incode|libmpi_cxx.so}} stopped being shipped, this breaks the compilation with the current CMake process. To fix this you need to downgrade the package, see [https://forum.freecad.org/viewtopic.php?t=85207 this forum post].

<!--T:139-->
<!--T:139-->
</div>
</div>
Line 407: Line 504:
<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">


<span id="Older_and_non-conventional_distributions"></span>
=== Older and non-conventional distributions ===
=== Distribuciones antiguas y no convencionales ===


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


En otras distribuciones, tenemos muy pocos comentarios de los usuarios, por lo que podría ser más difícil encontrar los paquetes necesarios.
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|third party libraries]] in your package manager. Beware that some of them might have a slightly different package name; search for {{incode|name}}, but also {{incode|libname}}, {{incode|name-dev}}, {{incode|name-devel}}, and similar. If that is not possible try compiling those libraries yourself.
Intente primero localizar las bibliotecas necesarias mencionadas en [[Third Party Libraries/es|bibliotecas de terceros]] en su gestor de paquetes. Tenga en cuenta que algunas de ellas pueden tener un nombre de paquete ligeramente diferente; busque {{incode|nombre}}, pero también {{incode|libname}}, {{incode|nombre-dev}}, {{incode|nombre-devel}}, y similares. Si no es posible, intente compilar esas bibliotecas usted mismo.


FreeCAD requires the GNU g++ compiler version equal or above 3.0.0, as FreeCAD is mostly written in C++. During the compilation some Python scripts are executed, so the Python interpreter has to work properly. To avoid any linker problems it is also a good idea to have the library paths in the {{incode|LD_LIBRARY_PATH}} variable or in the {{incode|ld.so.conf}} file. This is already done in modern Linux distributions, but may need to be set in older ones.
FreeCAD requiere una versión del compilador GNU g++ igual o superior a la 3.0.0, ya que FreeCAD está escrito principalmente en C++. Durante la compilación se ejecutan algunos scripts de Python, por lo que el intérprete de Python tiene que funcionar correctamente. Para evitar cualquier problema con el enlazador también es una buena idea tener las rutas de las bibliotecas en la variable {{incode|LD_LIBRARY_PATH}} o en el archivo {{incode|ld.so.conf}}. Esto ya se hace en las distribuciones modernas de Linux, pero puede ser necesario configurarlo en las más antiguas.


</div>
</div>
Line 422: Line 520:
=== Pivy ===
=== Pivy ===


<div class="mw-translate-fuzzy">
[[Pivy|Pivy]] (Python wrappers to Coin3d) is not needed to build FreeCAD or to start it, but it is needed as a runtime dependency by the [[Draft Module|Draft Workbench]]. If you are not going to use this workbench, you won't need Pivy. However, do notice that the Draft Workbench is used internally by other workbenches, like [[Arch Workbench|Arch]] and [[BIM Workbench|BIM]], so Pivy needs to be installed to use these workbenches as well.
[[Pivy/es|Pivy]] (envoltorios de Python para Coin3d) no es necesario para construir FreeCAD o para iniciarlo, pero es necesario como una dependencia en tiempo de ejecución por el [[Draft_Workbench/es|Ambiente de Trabajo Borrador]]. Si no vas a utilizar este ambiente de trabajo, no necesitarás Pivy. Sin embargo, ten en cuenta que el Ambiente de Trabajo Borrador es utilizado internamente por otros ambientes de trabajo, como [[Arch_Workbench/es|Arquitectura]] y [[BIM_Workbench/es|BIM]], por lo que Pivy necesita ser instalado para utilizar estos ambientes de trabajo también.
</div>


By November 2015 the obsolete version of Pivy included with the FreeCAD source code will no longer compile on many systems. This isn't a big problem as normally you should get Pivy from your distribution's package manager; if you cannot find Pivy, you may have to compile it yourself, see [[Extra_python_modules#Pivy|Pivy compilation instructions]].
En noviembre de 2015 la versión obsoleta de Pivy incluida con el código fuente de FreeCAD ya no compilará en muchos sistemas. Esto no es un gran problema ya que normalmente deberías obtener Pivy desde el gestor de paquetes de tu distribución; si no puedes encontrar Pivy, puede que tengas que compilarlo mismo, ver [[Extra_python_modules/es#Pivy|Instrucciones de compilación de Pivy]].


<span id="Debug_symbols"></span>
=== Debug symbols ===
=== Símbolos de depuración ===


In order to troubleshoot crashes in FreeCAD, it is useful to have the debug symbols of important dependency libraries such as Qt. For this, try installing the dependency packages that end with {{incode|-dbg}}, {{incode|-dbgsym}}, {{incode|-debuginfo}} or similar, depending on your Linux distribution.
Para solucionar los fallos en FreeCAD, es útil tener los símbolos de depuración de las bibliotecas de dependencia importantes como Qt. Para ello, intenta instalar los paquetes de dependencia que terminan con {{incode|-dbg}}, {{incode|-dbgsym}}, {{incode|-debuginfo}} o similares, dependiendo de tu distribución de Linux.


For Ubuntu, you may have to enable especial repositories to be able to see and install these debug packages with the package manager. See [https://wiki.ubuntu.com/Debug_Symbol_Packages Debug Symbol Packages] for more information.
Para Ubuntu, es posible que tenga que habilitar repositorios especiales para poder ver e instalar estos paquetes de depuración con el gestor de paquetes. Consulte [https://wiki.ubuntu.com/Debug_Symbol_Packages Debug Symbol Packages] para obtener más información.


<span id="Compile_FreeCAD"></span>
== Compile FreeCAD ==
== Compila FreeCAD ==


<div class="mw-translate-fuzzy">
{{VeryImportantMessage|Compiling against Python 2 and Qt4 is no longer well supported. You should compile against Python 3 and Qt5.}}
{{VeryImportantMessage|Compilación contra Python 2 y Qt4 ya no está bien soportada, y a partir de la versión 0.20 ya no está soportada en absoluto. Debería compilar contra Python 3 y Qt5. 0.20 requiere al menos Python3.6 y Qt 5.9.}}
</div>


FreeCAD uses CMake as its main build system, as it's available on all major operating systems. Compiling with CMake is usually very simple and happens in two steps.
FreeCAD utiliza CMake como su principal sistema de compilación, ya que está disponible en los principales sistemas operativos. La compilación con CMake es normalmente muy simple y ocurre en dos pasos.


# CMake checks that every needed program and library is present on your system, and generates a {{incode|Makefile}} that is configured for the second step. FreeCAD has several configuration options to choose from, but it comes with sensible defaults. Some alternatives are detailed below.
# CMake comprueba que todos los programas y bibliotecas necesarios están presentes en tu sistema, y genera un {{incode|Makefile}} que se configura para el segundo paso. FreeCAD tiene varias opciones de configuración entre las que elegir, pero viene con unos valores por defecto razonables. Algunas alternativas se detallan a continuación.
# The compilation itself, which is done with the program {{incode|make}}, which generates the FreeCAD executables.
# La compilación propiamente dicha, que se realiza con el programa {{incode|make}}, que genera los ejecutables de FreeCAD.


Dado que FreeCAD es una aplicación de gran tamaño, la compilación de todo el código fuente puede tardar entre 10 minutos y una hora, dependiendo de tu CPU y del número de núcleos de la CPU utilizados para la compilación.
Since FreeCAD is a large application, compiling the entire source code can take anywhere from 10 minutes to one hour, depending on your CPU and the number of CPU cores used for compilation.


<span id="Building"></span>
You can build the code either in or out of the source directory. Out-of-source building is generally the best option.
<div class="mw-translate-fuzzy">
=== Creación fuera-fuente ===
</div>


<div class="mw-translate-fuzzy">
=== Out-of-source build ===
Para construir fuera-fuente, simplemente crea un directorio de construcción, {{incode|freecad-build}}, distinto de tu carpeta de fuentes de FreeCAD, {{incode|freecad-source}}; entonces desde este directorio de construcción apunta {{incode|cmake}} a la carpeta de fuentes correcta. Puedes usar {{incode|cmake-gui}} o {{incode|ccmake}} en lugar de {{incode|cmake}} en las instrucciones de abajo también. Una vez que {{incode|cmake}} termine de configurar el entorno, utilice {{incode|make}} para iniciar la compilación real.
Building in a separate folder is more convenient than building in the same directory where the source code is located as every time you update the source code CMake can intelligently determine which files have changed, and recompile only what is needed. This is very useful when testing different Git branches as you don't confuse the build system.
</div>

To build out-of-source, simply create a build directory, {{incode|freecad-build}}, distinct from your FreeCAD source folder, {{incode|freecad-source}}; then from this build directory point {{incode|cmake}} to the right source folder. You can use {{incode|cmake-gui}} or {{incode|ccmake}} instead of {{incode|cmake}} in the instructions below as well. Once {{incode|cmake}} finishes configuring the environment, use {{incode|make}} to start the actual compilation.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
mkdir freecad-build
# from your freecad source folder:
cd freecad-build
mkdir build
cd build
cmake ../freecad-source -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3
cmake ../
make -j$(nproc --ignore=2)
make -j$(nproc --ignore=2)
}}
}}


<div class="mw-translate-fuzzy">
The {{incode|-j}} option of {{incode|make}} controls how many jobs (files) are compiled in parallel. The {{incode|nproc}} program prints the number of CPU cores in your system; by using it together with the {{incode|-j}} option you can choose to process as many files as you have cores, in order to speed up overall compilation of the program. In the example above, it will use all cores in your system except two; this will keep your computer responsive for other uses while compilation proceeds in the background. The FreeCAD executable will eventually appear in the {{incode|freecad-build/bin}} directory. See also [[Compiling_(Speeding_up)|Compiling (speeding up)]] to improve compilation speed.
La opción {{incode|-j}} de {{incode|make}} controla cuántos trabajos (archivos) se compilan en paralelo. El programa {{incode|nproc}} imprime el número de núcleos de la CPU en su sistema; usándolo junto con la opción {{incode|-j}} puede elegir procesar tantos archivos como núcleos tenga, para acelerar la compilación general del programa. En el ejemplo anterior, utilizará todos los núcleos de tu sistema excepto dos; esto mantendrá a tu ordenador respondiendo para otros usos mientras la compilación se realiza en segundo plano. El ejecutable de FreeCAD aparecerá finalmente en el directorio {{incode|freecad-build/bin}}. Ver también [[Compiling_(Speeding_up)/es|Compilación (aceleración)]] para mejorar la velocidad de compilación.
</div>


=== In-source building ===
=== Resolving cmake issues ===


If you have done a build before and get stuck on a dependency that is not recognized or can't seem to be resolved, try the following:
In-source builds are fine if you want to compile a version of FreeCAD quickly, and don't intend to update the source code often. In this case, you can remove the compiled program and the source just by deleting a single folder.


* Delete the contents of the build directory before running cmake again. FreeCAD is a rapidly moving target, you may be tripping over cached cmake information that points at an older version than the new repository head can use. Clearing the cache may allow cmake to recover and recognize the version you actually need.
Change to the source directory, and point {{incode|cmake}} to the present directory (denoted by a single point):

* If cmake complains about missing a specific file, use a tool such as "apt-file search", or its equivalent in other package systems, to discover what package that file belongs to and install it. Bear in mind that you are likely to need the -dev version of the package that carries header or config files files required for FreeCAD to use the package.

=== Compiling against GNU libc 2.34 and later ===

GNU libc 2.34 introduces a change to the library that can cause builds on some Linux systems to fail with an error like:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
No rule to make target '/usr/lib/x86_64-linux-gnu/libdl.so
cd freecad-source
}}
cmake . -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3

make -j$(nproc --ignore=2)
To resolve this, a symbolic link must be manually created from the (now empty) system-installed libdl.so.* to the location your compiler says it is looking for the file. For example (if the actual installed copy of libdl.so on your system is /usr/lib/x86_64-linux-gnu/libdl.so.2):

{{Code|lang=bash|code=
sudo ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so
}}
}}


Adapt the command for the structure of your system by searching for libdl.so* and linking it to the appropriate location.
The FreeCAD executable will then reside in the {{incode|freecad-source/bin}} directory.


<span id="How_to_repair_your_source_code_directory"></span>
=== How to repair your source code directory ===
=== Cómo reparar su directorio de código fuente ===


Si accidentalmente realizaste una compilación dentro del directorio de código fuente, o agregaste archivos extraños, y quisieras restaurar el contenido a sólo el código fuente original, puedes realizar los siguientes pasos.
If you accidentally performed a compilation inside the source code directory, or added strange files, and would like to restore the contents to only the original source code, you can perform the following steps.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 483: Line 603:
}}
}}


The first line clears the {{incode|.gitignore}} file. This ensures that the following clean and reset commands will affect everything in the directory and will not ignore items matching the expressions in {{incode|.gitignore}}. The second line deletes all files and directories that are not tracked by the git repository; then the last command will reset any changes to tracked files, including the first command which cleared the {{incode|.gitignore}} file.
La primera línea borra el archivo {{incode|.gitignore}}. Esto asegura que los siguientes comandos de limpieza y reinicio afectarán a todo el directorio y no ignorarán los elementos que coincidan con las expresiones en {{incode|.gitignore}}. La segunda línea borra todos los archivos y directorios que no son rastreados por el repositorio git; luego el último comando restablecerá cualquier cambio en los archivos rastreados, incluyendo el primer comando que borró el archivo {{incode|.gitignore}}.


If you do not clear the source directory, subsequent runs of {{incode|cmake}} may not capture new options to the system if the code changes.
Si no borra el directorio de fuentes, las siguientes ejecuciones de {{incode|cmake}} pueden no capturar las nuevas opciones del sistema si el código cambia.


=== Configuration ===
<span id="Configuration"></span>
=== Configuración ===


By passing different options to {{incode|cmake}}, you can change how FreeCAD is compiled. The syntax is as follows.
Pasando diferentes opciones a {{incode|cmake}}, puedes cambiar cómo se compila FreeCAD. La sintaxis es la siguiente.


{{Code|code=
{{Code|code=
Line 495: Line 616:
}}
}}


Where {{incode|$SOURCE_DIR}} is the directory that contains the source code. The {{incode|<type>}} may be omitted in most cases. The space after the {{incode|-D}} option may also be omitted.
Donde {{incode|$SOURCE_DIR}} es el directorio que contiene el código fuente. El {{incode|<tipo>}} puede omitirse en la mayoría de los casos. El espacio después de la opción {{incode|-D}} también puede omitirse.


For example, to avoid building the [[FEM Workbench|FEM Workbench]]:
Por ejemplo, para evitar construir el [[FEM Workbench/es|Ambiente de trabajo MEF]]:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 504: Line 625:
}}
}}


All possible variables are listed in the {{incode|InitializeFreeCADBuildOptions.cmake}} file, located in the {{incode|cMake/FreeCAD_Helpers}} directory. In this file, search for the word {{incode|option}} to get to the variables that can be set, and see their default values.
Todas las variables posibles están listadas en el archivo {{incode|InitializeFreeCADBuildOptions.cmake}}, ubicado en el directorio {{incode|cMake/FreeCAD_Helpers}}. En este archivo, busque la palabra {{incode|option}} para llegar a las variables que se pueden establecer, y ver sus valores por defecto.


<!--Do not remove the <pre> </pre> tags-->
<!--Do not remove the <pre> </pre> tags-->
Line 520: Line 641:
<!--Do not remove the <pre> </pre> tags-->
<!--Do not remove the <pre> </pre> tags-->


Alternatively, use the command {{incode|cmake -LH}} to list the current configuration, and thus all variables that can be changed. You may also install and use {{incode|cmake-gui}} to launch a graphical interface showing all the variables that can be modified. In the next sections we list some of the more relevant options that you may want to use.
Alternativamente, utilice el comando {{incode|cmake -LH}} para listar la configuración actual, y por tanto todas las variables que pueden ser modificadas. También puede instalar y utilizar {{incode|cmake-gui}} para lanzar una interfaz gráfica que muestra todas las variables que pueden ser modificadas. En las siguientes secciones enumeramos algunas de las opciones más relevantes que puede querer utilizar.


<span id="For_a_Debug_build"></span>
==== For a Debug build ====
==== Para una creación de depuración ====


Create a {{incode|Debug}} build to troubleshoot crashes in FreeCAD. Beware that with this build the [[Sketcher_Workbench|Sketcher]] becomes very slow with complex sketches.
Crea una compilación {{incode|Debug}} para solucionar fallos en FreeCAD. Ten en cuenta que con esta compilación el [[Sketcher_Workbench/es|Croquizador]] se vuelve muy lento con croquis complejos.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source
}}
}}


<span id="For_a_Release_build"></span>
==== For a Release build ====
==== Para una creación de versión ====


Create a {{incode|Release}} build to test code that doesn't crash. A {{incode|Release}} build will run much faster than a {{incode|Debug}} build.
Crea una compilación {{incode|Release}} para probar el código que no se bloquea. Una compilación {{incode|Release}} se ejecutará mucho más rápido que una compilación {{incode|Debug}}.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Release ../freecad-source
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Release ../freecad-source
}}
}}


<span id="Building_against_Python_3_and_Qt5"></span>
==== Building against Python 3 and Qt5 ====
==== Creación contra Python 3 y Qt5 ====


<div class="mw-translate-fuzzy">
By default, FreeCAD builds for Python 2 and Qt4. Since these two packages are obsolete, it is better to build for Python 3 and Qt5.
Por defecto, FreeCAD 0.19 y anteriores construyen para Python 2 y Qt4. Dado que estos dos paquetes son obsoletos, es mejor construir para Python 3 y Qt5. El soporte para Python 2 y Qt4 se ha eliminado en FreeCAD 0.20 y no es necesario activar explícitamente Qt5 y Python 3 si se compilan las últimas versiones de desarrollo.

</div>
In a modern Linux distribution you only need to provide two variables specifying the use of Qt5, and the path to the Python interpreter.


<div class="mw-translate-fuzzy">
Por 0.20_dev:
</div>
{{Code|lang=bash|code=
{{Code|lang=bash|code=
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source
cmake ../freecad-source
}}
}}


<div class="mw-translate-fuzzy">
==== Building for a specific Python version ====
Tenga en cuenta que al cambiar entre las compilaciones 0.19 y 0.20, puede ser necesario borrar CMakeCache.txt antes de ejecutar cmake.
</div>


<span id="Building_for_a_specific_Python_version"></span>
If the default {{incode|python}} executable in your system is a symbolic link to Python 2, {{incode|cmake}} will try to configure FreeCAD for this version. You can choose another version of Python by giving the path to a specific executable:
==== Creación para una versión específica de Python ====

<div class="mw-translate-fuzzy">
Si el ejecutable {{incode|python}} por defecto en tu sistema es un enlace simbólico a Python 2, {{incode|cmake}} intentará configurar FreeCAD para esta versión. Puedes elegir otra versión de Python dando la ruta a un ejecutable específico:
</div>


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 556: Line 690:
}}
}}


If that doesn't work, you may have to define additional variables pointing to the desired Python libraries and include directories:
Si eso no funciona, es posible que tenga que definir variables adicionales que apunten a las bibliotecas de Python deseadas y a los directorios de inclusión:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 566: Line 700:
}}
}}


It is possible to have several independent versions of Python in the same system, so the locations and version numbers of your Python files will depend on your particular Linux distribution. Use {{incode|python3 -V}} to display the version of Python that you are using currently; only the first two numbers are necessary; for example, if the result is {{incode|Python 3.6.8}}, you need to specify the directories that relate to the 3.6 version. If you don't know the right directories, try searching for them with the {{incode|locate}} command.
Es posible tener varias versiones independientes de Python en el mismo sistema, por lo que las ubicaciones y números de versión de sus archivos de Python dependerán de su distribución particular de Linux. Utilice {{incode|python3 -V}} para mostrar la versión de Python que está utilizando actualmente; sólo son necesarios los dos primeros números; por ejemplo, si el resultado es {{incode|Python 3.6.8}}, necesita especificar los directorios que se refieren a la versión 3.6. Si no conoce los directorios correctos, intente buscarlos con el comando {{incode|locate}}.


{{Code|code=
{{Code|code=
Line 572: Line 706:
}}
}}


You may use {{incode|python3 -m site}} in a terminal to determine the {{incode|site-packages}} directory, or {{incode|dist-packages}} for Debian systems.
Puede utilizar {{incode|python3 -m site}} en un terminal para determinar el directorio {{incode|site-packages}}, o {{incode|dist-packages}} para los sistemas Debian.


Some components of FreeCAD, such as PySide, try to autodetect the most recent Python version installed on your system, which might fail if it is different from what you entered above. Adding the following cMake option might solve the issue:
==== Building with Qt Creator against Python 3 and Qt5 ====


{{Code|lang=bash|code=
1. Launch Qt Creator.
-DPython3_FIND_STRATEGY=LOCATION
}}


<span id="Building_with_Qt_Creator_against_Python_3_and_Qt5"></span>
2. Click on {{MenuCommand|Open Project}}.
==== Creación con Qt Creator contra Python 3 y Qt5 ====


1. Inicie Qt Creator.
3. Navigate to the directory where the source code is, {{incode|freecad-source/}}, and choose the topmost {{incode|CMakeLists.txt}} file.


2. Haga clic en {{MenuCommand|Abierto Proyecto}}.
4. By selecting the file, it will automatically run {{incode|cmake}} on it, but it may fail if the appropriate options aren't correctly set.


3. Navega hasta el directorio donde está el código fuente, {{incode|freecad-source/}}, y elige el archivo {{incode|CMakeLists.txt}} más alto.
5. Go to {{MenuCommand|Projects → Build & Run → Imported Kit → Build → Build Settings → CMake}}. Set the appropriate build directory, {{incode|freecad-build/}}.


4. Al seleccionar el archivo, se ejecutará automáticamente {{incode|cmake}} en él, pero puede fallar si las opciones apropiadas no están correctamente configuradas.
6. Set the appropriate variables in the Key-Value dialog, of types {{incode|String}} and {{incode|Bool}}.

<div class="mw-translate-fuzzy">
5. Vaya a {{MenuCommand|Projects → Build & Run → Imported Kit → Build → Build Settings → CMake}}. Establezca el directorio de compilación adecuado, {{incode|freecad-build/}}.
</div>

6. Establezca las variables apropiadas en el diálogo Clave-Valor, de tipos {{incode|String}} y {{incode|Bool}}.
{{Code|code=
{{Code|code=
PYTHON_EXECUTABLE=/usr/bin/python3
PYTHON_EXECUTABLE=/usr/bin/python3
BUILD_QT5=ON
}}
}}


7. If the variables do not load the project correctly, you may have to go to {{MenuCommand|Projects → Manage Kits → Kits → Default (or Imported Kit or similar) → CMake Configuration}}.
7. Si las variables no cargan el proyecto correctamente, puede que tenga que ir a {{MenuCommand|Projects → Manage Kits → Kits → Default (o Kit importado o similar) → CMake Configuration}}.
Then press {{Button|Change}}, and add the appropriate configuration as described above. You may have to add more variables about the Python paths, if the system Python is not found.
A continuación, pulse {{Button|Cambiar}}, y añada la configuración adecuada como se ha descrito anteriormente. Puede que tenga que añadir más variables sobre las rutas de Python, si no se encuentra el Python del sistema.
{{Code|code=
{{Code|code=
PYTHON_EXECUTABLE:STRING=/usr/bin/python3.7
PYTHON_EXECUTABLE:STRING=/usr/bin/python3.7
Line 599: Line 741:
PYTHON_LIBRARY:STRING=/usr/lib/x86_64-linux-gnu/libpython3.7m.so
PYTHON_LIBRARY:STRING=/usr/lib/x86_64-linux-gnu/libpython3.7m.so
PYTHON_PACKAGES_PATH:STRING=/usr/lib/python3.7/site-packages
PYTHON_PACKAGES_PATH:STRING=/usr/lib/python3.7/site-packages
BUILD_QT5:BOOL=ON
}}
}}


7.1. Press {{Button|Apply}}, then {{Button|OK}}.
7.1. Pulse {{Button|Aplicar}} y luego {{Button|Aceptar}}.

7.2. Asegúrese de que el resto de las opciones están correctamente configuradas, por ejemplo, {{MenuCommand|Versión de Qt}} debe ser una versión presente instalada en el sistema, como {{incode|Qt 5.9.5 en PATH (qt5)}}.


Pulse {{Button|Aplicar}} y luego {{Button|Aceptar}} para cerrar la configuración.
7.2. Make sure the rest of the options are correctly set, for example, {{MenuCommand|Qt version}} should be a present version installed in the system, like {{incode|Qt 5.9.5 in PATH (qt5)}}.


El programa {{incode|cmake}} debería ejecutarse automáticamente de nuevo, y debería rellenar todo el diálogo Clave-Valor con todas las variables configurables.
Press {{Button|Apply}}, then {{Button|OK}} to close the configuration.


8. Vaya a {{MenuCommand|Projects → Build & Run → Imported Kit → Run → Run Settings → Run Configuration}} y elija {{incode|FreeCADMain}} para compilar la versión gráfica de FreeCAD, o {{incode|FreeCADMainCMD}} para compilar sólo la versión de línea de comandos.
The {{incode|cmake}} program should run automatically again, and it should fill the entire Key-Value dialog with all the variables that can be configured.


9. Finalmente, vaya al menú {{MenuCommand|Build → Build Project "FreeCAD"}}. Si se trata de una nueva compilación, debería tardar varios minutos, incluso horas, dependiendo del número de procesadores que tengas disponibles.
8. Go to {{MenuCommand|Projects → Build & Run → Imported Kit → Run → Run Settings → Run → Run Configuration}} and choose {{incode|FreeCADMain}} to compile the graphical version of FreeCAD, or {{incode|FreeCADMainCMD}} to compile only the command line version.


<span id="Qt_designer_plugin"></span>
9. Finally, go to the menu {{MenuCommand|Build → Build Project "FreeCAD"}}. If this is a new compilation, it should take several minutes, inclusive hours, depending on the number of processors that you have available.
==== Qt designer complemento ====


Si quieres desarrollar código Qt para FreeCAD, necesitarás el plugin Qt Designer que proporciona todos los widgets personalizados de FreeCAD.
==== Qt designer plugin ====
If you want to develop Qt code for FreeCAD, you'll need the Qt Designer plugin that provides all custom widgets of FreeCAD.


Go into an auxiliary directory of the source code, the run {{incode|qmake}} with the indicated project file to create a {{incode|Makefile}}; then run {{incode|make}} to compile the plugin.
Entra en un directorio auxiliar del código fuente, ejecuta {{incode|qmake}} con el archivo de proyecto indicado para crear un {{incode|Makefile}}; luego ejecuta {{incode|make}} para compilar el plugin.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 625: Line 768:
}}
}}


If you are compiling for Qt5, make sure the {{incode|qmake}} binary is the one for this version, so that the resulting {{incode|Makefile}} contains the necessary information for Qt5.
Si estás compilando para Qt5, asegúrate de que el binario {{incode|qmake}} es el correspondiente a esta versión, para que el {{incode|Makefile}} resultante contenga la información necesaria para Qt5.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 633: Line 776:
}}
}}


where {{incode|$QT_DIR}} is the directory that stores Qt binary libraries, for example, {{incode|/usr/lib/x86_64-linux-gnu/qt5}}.
donde {{incode|$QT_DIR}} es el directorio que almacena las bibliotecas binarias de Qt, por ejemplo, {{incode|/usr/lib/x86_64-linux-gnu/qt5}}.


The library created is {{incode|libFreeCAD_widgets.so}}, which needs to be copied to {{incode|$QT_DIR/plugins/designer}}.
La biblioteca creada es {{incode|libFreeCAD_widgets.so}}, que debe copiarse en {{incode|$QT_DIR/plugins/designer}}.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 641: Line 784:
}}
}}


<span id="External_or_internal_Pivy"></span>
==== External or internal Pivy ====
==== Pivy externo o interno ====


Previously, a version of Pivy was included in the source code of FreeCAD (internal). If you wanted to use your system's copy of Pivy (external), you needed to use <code>-DFREECAD_USE_EXTERNAL_PIVY=1</code>.
Anteriormente, una versión de Pivy estaba incluida en el código fuente de FreeCAD (interno). Si querías usar la copia de Pivy de tu sistema (externo), necesitabas usar <código>-DFREECAD_USE_EXTERNAL_PIVY=1</código>.


El uso de Pivy externo se convirtió en el valor por defecto durante el desarrollo de FreeCAD 0.16, por lo que ya no es necesario configurar esta opción manualmente.
Using external Pivy became the default during development of FreeCAD 0.16, therefore this option does not need to be set manually anymore.


<span id="Doxygen_documentation"></span>
==== Doxygen documentation ====
==== Documentación de Doxygen ====
If you have Doxygen installed you can build the source code documentation. See [[source documentation]] for instructions.


Si tienes Doxygen instalado puedes construir la documentación del código fuente. Consulte [[source documentation/es|documentación de origen]] para obtener instrucciones.
=== Additional documentation ===


<span id="Additional_documentation"></span>
The source code of FreeCAD is very extensive, and with CMake it's possible to configure many options. Learning to use CMake fully may be useful to choose the right options for your particular needs.
=== Documentación adicional ===
* [https://cmake.org/documentation/ CMake Reference Documentation] by Kitware.
* [https://preshing.com/20170511/how-to-build-a-cmake-based-project/ How to Build a CMake-Based Project] (blog) by Preshing on programming.
* [https://preshing.com/20170522/learn-cmakes-scripting-language-in-15-minutes/ Learn CMake's Scripting Language in 15 Minutes] (blog) by Preshing on programming.


El código fuente de FreeCAD es muy extenso, y con CMake es posible configurar muchas opciones. Aprender a usar CMake completamente puede ser útil para elegir las opciones adecuadas para tus necesidades particulares.
=== Making a debian package ===
* [https://cmake.org/documentation/ CMake Documentación de referencia] de Kitware.
If you plan to build a Debian package out of the sources you need to install certain packages first:
* [https://preshing.com/20170511/how-to-build-a-cmake-based-project/ Cómo construir un proyecto basado en CMake] (blog) por Preshing sobre programación.
* [https://preshing.com/20170522/learn-cmakes-scripting-language-in-15-minutes/ Aprende el lenguaje de scripting de CMake en 15 minutos] (blog) por Preshing sobre programación.

<span id="Making_a_debian_package"></span>
=== Hacer un paquete debian ===

Si planea construir un paquete Debian a partir de las fuentes, necesita instalar primero ciertos paquetes:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 664: Line 813:
}}
}}


Go to the FreeCAD directory and call
Vaya al directorio de FreeCAD y llame a


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 670: Line 819:
}}
}}


Once the package is built, you can use {{incode|lintian}} to check if the package contains errors
Una vez construido el paquete, puede utilizar {{incode|lintian}} para comprobar si el paquete contiene errores


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 676: Line 825:
}}
}}


==== *.deb package with checkinstall ====
== Updating the source code ==


The Debian script {{incode|checkinstall}} allows to create a *.deb package that can be installed and removed with the standard {{incode|dpkg}} commands. It may need to be installed first (on Ubuntu use {{incode|sudo apt install checkinstall}}). It's interactive and asks for the required information providing helpful defaults. During the process the package is installed and a *.deb file and a backup archive are created.
The CMake system allows you to intelligently update the source code, and only recompile what has changed, making subsequent compilations faster.


It's a good idea to define a name and a short description for the package. The name must be entered to uninstall it again and the desription will be listed by {{incode|dpkg -l}}. The default name "build" is not very informative.
Move to the location where the FreeCAD source code was first downloaded, and pull the new code:

Example:

{{Code|lang=bash|code=
cd freecad-source/build
cmake ..
make
sudo checkinstall # e.g. name=freecad-test1
}}

The result is a *.deb file in the build folder. {{incode|checkinstall}} will install the build by default. This is how you can install or uninstall it:

{{Code|lang=bash|code=
cd freecad-source/build
ls <nowiki>|</nowiki> grep freecad
freecad-test1_20220814-1_amd64.deb
sudo dpkg -i freecad-test1_20220814-1_amd64.deb # install
dkpg -l <nowiki>|</nowiki> grep freecad # find by name
sudo dpkg -r freecad-test1 # uninstall by name
}}

<span id="Updating_the_source_code"></span>
== Actualización del código fuente ==

El sistema CMake permite actualizar de forma inteligente el código fuente, y sólo recompilar lo que ha cambiado, haciendo que las compilaciones posteriores sean más rápidas.

Muévete a la ubicación donde el código fuente de FreeCAD fue descargado por primera vez, y saca el nuevo código:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 687: Line 863:
}}
}}


Then move into the build directory where the code was compiled initially, and run {{incode|cmake}} specifying the present directory (denoted by a dot); then trigger the re-compilation with {{incode|make}}.
A continuación, muévete al directorio de compilación donde el código fue compilado inicialmente, y ejecuta {{incode|cmake}} especificando el directorio actual (denotado por un punto); luego activa la re-compilación con {{incode|make}}.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 695: Line 871:
}}
}}


== Uninstalling the source code ==
== Troubleshooting ==


In case the compiled source code was installed with {{incode|sudo make install}} (for Debian) the files were copied to the {{FileName|/usr/local}} folder into several subfolders. For uninstallation the file {{FileName|install_manifest.txt}} can be used. It has been created into the build folder during compilation and contains all installed files. As long as this file exists, the installation can be uninstalled.
=== For 64 bit systems ===

When building FreeCAD for 64-bit there is a known issue with the OpenCASCADE (OCCT) 64-bit package. To get FreeCAD running properly you might need to run the {{incode|configure}} script and set additional {{incode|CXXFLAGS}}:
{{Code|lang=bash|code=
cd freecad-source/freecad-build
xargs sudo rm < install_manifest.txt
}}

<span id="Troubleshooting"></span>
== Solución de problemas ==

<span id="For_64_bit_systems"></span>
=== Para sistemas de 64 bits ===

Cuando se compone FreeCAD para 64 bits hay un problema conocido con el paquete OpenCASCADE (OCCT) de 64 bits. Para que FreeCAD funcione correctamente puede ser necesario ejecutar el script {{incode|configure}} y establecer {{incode|CXXFLAGS}} adicionales:


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 704: Line 892:
}}
}}


Para los sistemas basados en Debian, esta opción no es necesaria cuando se utilizan los paquetes precompilados de OpenCASCADE porque éstos establecen el {{incode|CXXFLAGS}} adecuado internamente.
For Debian based systems this option is not needed when using the pre-built OpenCASCADE packages because these ones set the proper {{incode|CXXFLAGS}} internally.

<span id="Automatic_build_scripts"></span>
== Scripts de creación automática ==


Aquí está todo lo que necesitas para una construcción completa de FreeCAD. Es un enfoque de un solo script y funciona en una distribución de Linux recién instalada. Los comandos pedirán la contraseña de root para la instalación de paquetes y nuevos repositorios online. Estos scripts deberían funcionar en versiones de 32 y 64 bits. Están escritos para diferentes versiones, pero también es probable que funcionen en una versión posterior con o sin cambios importantes.
== 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 freshly installed Linux distribution. The commands will ask for the root password for installation of packages and new online repositories. 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 distribution, please discuss it on the [https://forum.freecadweb.org/viewforum.php?f=21&sid=e3c22dca9da076fefb56b1d5c5fb3134 FreeCAD forum] so we can incorporate it.
Si tienes un script de este tipo para tu distribución preferida, por favor discútelo en el [https://forum.freecadweb.org/viewforum.php?f=21&sid=e3c22dca9da076fefb56b1d5c5fb3134 foro de FreeCAD] para que podamos incorporarlo.


<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">
Line 717: Line 907:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


These scripts provide a reliable way to install the correct set of dependencies required to build and run FreeCAD on Ubuntu. They make use of the Ubuntu personal package archives (PPA), and should work on any version of Ubuntu targeted by the PPA. The [https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily freecad-daily] PPA targets recent versions of Ubuntu, while the [https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable freecad-stable] PPA targets officially supported versions of Ubuntu.
Estos scripts proporcionan una forma fiable de instalar el conjunto correcto de dependencias necesarias para construir y ejecutar FreeCAD en Ubuntu. Hacen uso de los archivos de paquetes personales de Ubuntu (PPA), y deberían funcionar en cualquier versión de Ubuntu a la que se dirija el PPA. El [https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily freecad-daily] PPA se dirige a versiones recientes de Ubuntu, mientras que el [https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable freecad-stable] PPA se dirige a las versiones oficialmente soportadas de Ubuntu.


This script installs the daily compiled snapshot of FreeCAD and its dependencies. It adds the daily repository, gets the dependencies to build this version, and installs the required packages. Afterwards it proceeds to pull the source code into a particular directory, creates a build directory and changes into it, configures the compilation environment with {{incode|cmake}}, and finally builds the entire program with {{incode|make}}. Save the script to a file, make it executable, and run it, but don't use {{incode|sudo}}; superuser privileges will be asked only for selected commands.
Este script instala la instantánea diaria compilada de FreeCAD y sus dependencias. Añade el repositorio diario, obtiene las dependencias para construir esta versión, e instala los paquetes necesarios. Después procede a sacar el código fuente en un directorio particular, crea un directorio de compilación y cambia en él, configura el entorno de compilación con {{incode|cmake}}, y finalmente construye el programa completo con {{incode|make}}. Guarda el script en un archivo, hazlo ejecutable y ejecútalo, pero no utilices {{incode|sudo}}; se pedirán privilegios de superusuario sólo para los comandos seleccionados.
Pulsa "CTRL-ENTER" para cambiar de canal, "ALT-SHIFT-D" para subir, "ALT-SHIFT-B" para hacer un resumen, o pulsa "ALT" para hacer otros comandos.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 727: Line 918:
sudo apt-get install freecad-daily
sudo apt-get install freecad-daily


git clone https://github.com/FreeCAD/FreeCAD.git freecad-source
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source
mkdir freecad-build
mkdir freecad-build
cd freecad-build
cd freecad-build
cmake -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DFREECAD_USE_PYBIND11=ON ../freecad-source
make -j$(nproc --ignore=2)
make -j$(nproc --ignore=2)
}}
}}


If you wish, you can uninstall the pre-compiled version of FreeCAD ({{incode|freecad-daily}}) while leaving the dependencies in place, however, leaving this package installed will allow the package manager to keep its dependencies up to date as well; this is mostly useful if you intend to follow the development of FreeCAD, and constantly update and compile the sources from the Git repository.
Si lo deseas, puedes desinstalar la versión precompilada de FreeCAD ({{incode|freecad-daily}}) dejando las dependencias en su lugar, sin embargo, dejar este paquete instalado permitirá al gestor de paquetes mantener sus dependencias actualizadas también; esto es sobre todo útil si tienes la intención de seguir el desarrollo de FreeCAD, y actualizar y compilar constantemente las fuentes desde el repositorio Git.


The previous script assumes that you want to compile the latest version of FreeCAD, so you are using the "daily" repository to get the dependencies. However, you can instead get the build dependencies of the "stable" version for your current Ubuntu release. If this is the case, replace the top part of the previous script with the following instructions. For Ubuntu 12.04, omit {{incode|--enable-source}} from the command.
El script anterior asume que quieres compilar la última versión de FreeCAD, por lo que estás usando el repositorio "diario" para obtener las dependencias. Sin embargo, puedes obtener las dependencias de la versión "estable" de tu versión actual de Ubuntu. Si este es el caso, reemplace la parte superior del script anterior con las siguientes instrucciones. Para Ubuntu 12.04, omita {{incode|--enable-source}} del comando.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 742: Line 933:
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-stable && sudo apt-get update
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-stable && sudo apt-get update
sudo apt-get build-dep freecad
sudo apt-get build-dep freecad
sudo apt-get install libqt5xmlpatterns5-dev # Needed for 0.20; should go away on next packaging update
sudo apt-get install freecad
sudo apt-get install freecad
}}
}}


Once you install the {{incode|freecad}} package from the {{incode|freecad-stable}} repository, it will supersede the FreeCAD executable that is available from the Universe Ubuntu repository. The executable will be named simply {{incode|freecad}}, and not {{incode|freecad-stable}}.
Una vez que instales el paquete {{incode|freecad}} desde el repositorio {{incode|freecad-stable}}, sustituirá al ejecutable de FreeCAD que está disponible en el repositorio de Universe Ubuntu. El ejecutable se llamará simplemente {{incode|freecad}}, y no {{incode|freecad-stable}}.


</div>
</div>
Line 751: Line 943:
<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">


=== OpenSUSE 12.2 = deprecated !!!===
=== openSUSE ===


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


<div class="mw-translate-fuzzy">
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
No se necesitan repositorios externos para compilar FreeCAD. Sin embargo, hay una incompatibilidad con python3-devel que debe ser eliminada. FreeCAD puede ser compilado desde GIT
</div>


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 768: Line 962:
# get the source
# get the source
git clone https://github.com/FreeCAD/FreeCAD.git free-cad
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git free-cad
# Now you will have subfolder in this location called free-cad. It contains the source
# Now you will have a subfolder in this location called free-cad. It contains the source
# make another dir for compilation, and go into it
# make another dir for compilation, and go into it
Line 787: Line 981:
}}
}}


Como estás usando git, la próxima vez que desees compilar no tienes que clonar todo, simplemente tira de git y compila una vez más
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


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 836: Line 1,030:
# checkout the latest source
# checkout the latest source
git clone https://github.com/FreeCAD/FreeCAD.git freecad
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad
# go to source dir
# go to source dir
Line 860: Line 1,054:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


Posted by user [[http://forum.freecadweb.org/memberlist.php?mode=viewprofile&u=3666 PrzemoF]] in the forum.
Enviado por el usuario [[http://forum.freecadweb.org/memberlist.php?mode=viewprofile&u=3666 PrzemoF]] en el foro.


{{Code|lang=bash|code=
{{Code|lang=bash|code=
Line 890: Line 1,084:
mkdir $MAIN_DIR <nowiki>||</nowiki> { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }
mkdir $MAIN_DIR <nowiki>||</nowiki> { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }
cd $MAIN_DIR
cd $MAIN_DIR
git clone https://github.com/FreeCAD/FreeCAD.git
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git
mkdir $BUILD_DIR <nowiki>||</nowiki> { echo "~/$BUILD_DIR already exist. Quitting.."; exit; }
mkdir $BUILD_DIR <nowiki>||</nowiki> { echo "~/$BUILD_DIR already exist. Quitting.."; exit; }
cd $BUILD_DIR
cd $BUILD_DIR
Line 901: Line 1,095:
<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">


<span id="Arch_using_AUR"></span>
=== Arch using AUR ===
=== Arch usando AUR ===


<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


[https://aur.archlinux.org/ Repositorio de usuarios Arch (AUR)] es una colección de recetas hechas por el usuario para construir paquetes que no están oficialmente soportados por los mantenedores de la distribución / comunidad. Por lo general, son seguros. Puedes ver quién mantiene el paquete y durante cuánto tiempo lo ha hecho. Se recomienda comprobar los archivos de construcción. También hay software que no es de código abierto disponible en esta área, incluso si es mantenido por la compañía oficial propietaria.
[https://aur.archlinux.org/ Arch User Repository (AUR)] is a collection user made recipes to build packages which are not officially supported by distribution maintainers / community. They are usually safe. You can see who maintain the package and for how long he did. It is recommended to check construction files. Also non open source software are available in this area even if maintained by the official owning company.


Prerequisite : git
Requisito previo : git


<div class="mw-translate-fuzzy">
Steps :
Pasos :
#Open a terminal. Optionally create a directory eg. {{incode | mkdir git}}. Optionally change directory eg. {{incode|cd git}}.
#Abrir un terminal. Opcionalmente, crear un directorio, por ejemplo, {{incode | mkdir git}}. Opcionalmente, cambiar de directorio, por ejemplo, {{incode|cd git}}.
#Clone the AUR repository : {{incode|git clone http://aur.archlinux.org/packages/freecad-git}}
#Enter AUR repository folder : {{incode|cd freecad-git}}
#Clonar el repositorio AUR : {{incode|git clone http://aur.archlinux.org/packages/freecad-git}}
#Entrar en la carpeta del repositorio AUR : {{incode|cd freecad-git}}
#Compile using [https://wiki.archlinux.org/index.php/Makepkg Arch makepkg] : {{incode|makepkg -s}}. The -s or --syncdeps flag will also install required dependencies.
#Compilar usando [https://wiki.archlinux.org/index.php/Makepkg Arch makepkg] : {{incode|makepkg -s}}. La bandera -s o --syncdeps también instalará las dependencias necesarias.
#Install created package : {{incode|makepkg --install}} or double click on the pkgname-pkgver.pkg.tar.xz inside your file browser.
#Instalar el paquete creado : {{incode|makepkg --install}} o hacer doble clic en el pkgname-pkgver.pkg.tar.xz dentro de su navegador de archivos.

</div>
To update FreeCAD to latest build just repeat from step 3. Update AUR repo when there is some breaking change in the recipe or new features using {{incode|git checkout -f}} inside the folder.


<div class="mw-translate-fuzzy">
Para actualizar FreeCAD a la última compilación simplemente repite el paso 3.Actualiza el repo de AUR cuando haya algún cambio de ruptura en la receta o nuevas características usando {{incode|git checkout -f}} dentro de la carpeta.
</div>
</div>
</div>



{{Docnav
{{Docnav/es
|[[Compile_on_Windows|Compile on Windows]]
|[[Compile_on_Windows/es|Compilar en Windows]]
|[[Compile_on_MacOS|Compile on MacOS]]
|[[Compile_on_MacOS/es|Compilar en MacOS]]
}}
}}



Latest revision as of 10:49, 4 May 2024

Hay un contenedor experimental FreeCAD Docker que se está probando para el desarrollo de FreeCAD. Lea más sobre ello en Compilar en Docker

Vista general

En las distribuciones recientes de Linux, FreeCAD es generalmente fácil de construir, ya que todas las dependencias suelen ser proporcionadas por el administrador de paquetes. Básicamente implica 3 pasos:

  1. Obtener el código fuente de FreeCAD
  2. Obtener las dependencias o paquetes de los que depende FreeCAD
  3. Configurar con cmake y compilar con make

A continuación, encontrará explicaciones detalladas de todo el proceso, algunos build scripts, y las particularidades que puede encontrar. Si encuentras algo incorrecto o desactualizado en el texto de abajo (las distribuciones de Linux cambian a menudo), o si usas una distribución que no está en la lista, discute el tema en el forum, y ayúdanos a corregirlo.

Flujo de trabajo general para compilar FreeCAD desde la fuente. Las dependencias de terceros deben estar en el sistema, así como el propio código fuente de FreeCAD. CMake configura el sistema de manera que con una sola instrucción de creación se compila todo el proyecto.

Obtener la fuente

Git

La mejor manera de obtener el código es clonar el repositorio Git de sólo lectura [1]. Para ello se necesita el programa git que se puede instalar fácilmente en la mayoría de las distribuciones de Linux. También puede obtenerse en el sitio web oficial.

Git se puede instalar mediante el siguiente comando:

sudo apt install git

El siguiente comando colocará una copia de la última versión del código fuente de FreeCAD en un nuevo directorio llamado freecad-source.

git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source

Para más información sobre el uso de Git y la contribución de código al proyecto, véase Gestión del código fuente.

Archivo Fuente

También puede descargar el código fuente como un archivo [2], un archivo .zip o .tar.gz, y descomprimirlo en el directorio deseado.

Obtener las dependencias

Para compilar FreeCAD tienes que instalar las dependencias necesarias mencionadas en Bibliotecas de terceros; los paquetes que contienen estas dependencias están listados abajo para diferentes distribuciones de Linux. Tenga en cuenta que los nombres y la disponibilidad de las bibliotecas dependerán de su distribución particular; si su distribución es antigua, algunos paquetes pueden no estar disponibles o tener un nombre diferente. En este caso, busque en la sección Distribuciones antiguas y no convencionales más abajo.

Una vez que tengas todas las dependencias instaladas, procede a compilar FreeCAD.

Ten en cuenta que el código fuente de FreeCAD tiene un tamaño de unos 500 MB; puede ser tres veces mayor si clonas el repositorio Git con todo su historial de modificaciones. Obtener todas las dependencias puede requerir la descarga de 500 MB o más de nuevos archivos; cuando estos archivos se descomprimen pueden requerir 1500 MB o más de espacio. También ten en cuenta que el proceso de compilación puede generar hasta 1500 MB de archivos adicionales ya que el sistema copia y modifica todo el código fuente. Por lo tanto, asegúrese de tener suficiente espacio libre en su disco duro, al menos 4 GB, cuando intente la compilación.

Debian y Ubuntu

En los sistemas basados en Debian (Debian, Ubuntu, Mint, etc.) es bastante fácil conseguir instalar todas las dependencias necesarias. La mayoría de las bibliotecas están disponibles a través de apt o del gestor de paquetes Synaptic.

Si ya has instalado FreeCAD desde los repositorios oficiales, puedes instalar sus dependencias de construcción con esta única línea de código en un terminal:

sudo apt build-dep freecad

Alternatively, replace freecad with freecad-daily to install the build dependencies for the main development branch. You'll need to have the freecad-stable/freecad-daily PPAs added to your software sources.

Sin embargo, si la versión de FreeCAD en los repositorios es antigua, las dependencias pueden ser las incorrectas para compilar una versión reciente de FreeCAD. Por lo tanto, comprueba que tienes instalados los siguientes paquetes.

Estos paquetes son esenciales para que cualquier tipo de compilación tenga éxito:

  • build-essential, instala los compiladores C y C++, las librerías de desarrollo C y el programa make.
  • cmake, herramienta esencial para configurar el código fuente de FreeCAD. También puedes querer instalar cmake-gui y cmake-curses-gui para una opción gráfica.
  • libtool, herramientas esenciales para producir bibliotecas compartidas.
  • lsb-release, la utilidad estándar de informes de base normalmente ya está instalada en un sistema Debian, y le permite distinguir mediante programación entre una instalación Debian pura o una variante, como Ubuntu o Linux Mint. No elimine este paquete, ya que muchos otros paquetes del sistema pueden depender de él.

La compilación de FreeCAD utiliza el lenguaje Python, y también se utiliza en tiempo de ejecución como lenguaje de scripting. Si estás usando una distribución basada en Debian el intérprete de Python normalmente ya está instalado.

  • python3
  • swig, la herramienta que crea interfaces entre el código C++ y Python.

Por favor, comprueba que tienes instalado Python 3. Python 2 quedó obsoleto en 2019, por lo que los nuevos desarrollos en FreeCAD no se prueban con esta versión del lenguaje.

Es necesario instalar las bibliotecas Boost:

  • libboost-dev
  • libboost-date-time-dev
  • libboost-filesystem-dev
  • libboost-graph-dev
  • libboost-iostreams-dev
  • libboost-program-options-dev
  • libboost-python-dev
  • libboost-regex-dev
  • libboost-serialization-dev
  • libboost-thread-dev

Es necesario instalar las bibliotecas de Coin:

  • libcoin80-dev, para Debian Jessie, Stretch, Ubuntu 16.04 a 18.10, o
  • libcoin-dev, para Debian Buster, Ubuntu 19.04 y más recientes, así como para Ubuntu 18.04/18.10 con los PPAs freecad-stable/freecad-daily añadidos a sus fuentes de software.

Varias bibliotecas que se ocupan de las matemáticas, las superficies trianguladas, la ordenación, las mallas, la visión por ordenador, las proyecciones cartográficas, la visualización 3D, el sistema de ventanas X11, el análisis sintáctico de XML y la lectura de archivos Zip:

  • libeigen3-dev
  • libgts-bin
  • libgts-dev
  • libkdtree++-dev
  • libmedc-dev
  • libopencv-dev or libcv-dev
  • libproj-dev
  • libvtk7-dev or libvtk6-dev
  • libx11-dev
  • libxerces-c-dev
  • libyaml-cpp-dev
  • libzipios++-dev

Python 2 y Qt4

Esto no se recomienda para las instalaciones más recientes, ya que tanto Python 2 como Qt4 están obsoletos. A partir de la versión 0.20, FreeCAD ya no los soporta.

Para compilar FreeCAD para Debian Jessie, Stretch, Ubuntu 16.04, usando Python 2 y Qt4, instala las siguientes dependencias.

  • qt4-dev-tools
  • libqt4-dev
  • libqt4-opengl-dev
  • libqtwebkit-dev
  • libshiboken-dev
  • libpyside-dev
  • pyside-tools
  • python-dev
  • python-matplotlib
  • python-pivy
  • python-ply
  • python-pyside

Python 3 y Qt5

Para compilar FreeCAD para Debian Buster, Ubuntu 19.04 y posteriores, así como Ubuntu 18.04/18.10 con el freecad-stable/freecad-daily PPAs añadido a sus fuentes de software, instale las siguientes dependencias.

  • qtbase5-dev
  • qttools5-dev
  • qt5-default (if compiling 0.20 on a machine that still has Qt4)
  • libqt5opengl5-dev
  • libqt5svg5-dev
  • qtwebengine5-dev
  • libqt5xmlpatterns5-dev
  • libqt5x11extras5-dev
  • libpyside2-dev
  • libshiboken2-dev
  • pyside2-tools
  • pyqt5-dev-tools
  • python3-dev
  • python3-matplotlib
  • python3-packaging
  • python3-pivy
  • python3-ply
  • python3-pyside2.qtcore
  • python3-pyside2.qtgui
  • python3-pyside2.qtsvg
  • python3-pyside2.qtwidgets
  • python3-pyside2.qtnetwork
  • python3-pyside2.qtwebengine
  • python3-pyside2.qtwebenginecore
  • python3-pyside2.qtwebenginewidgets
  • python3-pyside2.qtwebchannel
  • python3-pyside2uic

Núcleo OpenCascade

El núcleo de OpenCascade es el núcleo de la biblioteca de gráficos para crear formas 3D. Existe una versión oficial OCCT, y una versión comunitaria OCE. La versión de la comunidad ya no se recomienda, ya que está obsoleta.

Para Debian Buster y Ubuntu 18.10 y posteriores, así como para Ubuntu 18.04 con el freecad-stable/freecad-daily PPAs añadido a sus fuentes de software, instale los paquetes oficiales.

  • libocct*-dev
    • libocct-data-exchange-dev
    • libocct-draw-dev
    • libocct-foundation-dev
    • libocct-modeling-algorithms-dev
    • libocct-modeling-data-dev
    • libocct-ocaf-dev
    • libocct-visualization-dev
  • occt-draw

Para Debian Jessie, Stretch, Ubuntu 16.04 y posteriores, instale los paquetes de la edición comunitaria.

  • liboce*-dev
    • liboce-foundation-dev
    • liboce-modeling-dev
    • liboce-ocaf-dev
    • liboce-ocaf-lite-dev
    • liboce-visualization-dev
  • oce-draw

Puede instalar las bibliotecas individualmente, o utilizando la expansión de asterisco. Cambie occ por oce si desea instalar las bibliotecas comunitarias.

sudo apt install libocct*-dev

Paquetes opcionales

Opcionalmente, también puede instalar estos paquetes adicionales:

  • libsimage-dev, para que Coin soporte formatos de archivo de imagen adicionales.
  • doxygen y libcoin-doc (o libcoin80-doc para los sistemas más antiguos), si quieres generar documentación del código fuente.
  • libspnav-dev, para soporte de Dispositivos de entrada 3D, como el "Space Navigator" o el "Space Pilot" de 3Dconnexion.
  • checkinstall, si pretende registrar los archivos instalados en el gestor de paquetes de su sistema, para poder desinstalarlo más tarde.

Comando único para Python 3 y Qt5

Requiere Pyside2 disponible en Debian buster y el freecad-stable/freecad-daily PPAs.

sudo apt install cmake cmake-gui libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev qtwebengine5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-packaging python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2.qtnetwork python3-pyside2.qtwebengine python3-pyside2.qtwebenginecore python3-pyside2.qtwebenginewidgets python3-pyside2.qtwebchannel python3-markdown python3-git python3-pyside2uic qtbase5-dev qttools5-dev swig libyaml-cpp-dev

NOTA: En algunas versiones de Ubuntu y algunas versiones de Qt, obtendrá un error de que no se puede encontrar python3-pyside2uic - en esos sistemas puede omitirlo con seguridad. En Ubuntu 20.04 tendrá que añadir pyqt5-dev-tools. Puede encontrar más información en esta discusión del foro.

Comando único para Python 2 y Qt4

Esto no se recomienda para las instalaciones más recientes, ya que tanto Python 2 como Qt4 están obsoletos.

sudo apt install cmake debhelper dh-exec dh-python libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-thread-dev libcoin80-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside-dev libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libspnav-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev lsb-release occt-draw pyside-tools python-dev python-matplotlib python-pivy python-ply swig

Los usuarios de Ubuntu 16.04 por favor vean también la discusión de compilación en el foro: Compilación en Linux (Kubuntu): CMake no puede encontrar VTK.

Raspberry Pi

Siga los mismos pasos que en Debian y Ubuntu.

Hay problemas reportados cuando se intenta compilar en Raspbian con Python 3 y Qt5, pero la combinación Python 3 y Qt4 parece funcionar para versiones antiguas de FreeCAD.

Para las nuevas versiones de FreeCAD la compilación con Py3/Qt5 tiene éxito si el sistema operativo instalado es Ubuntu 20.04.

Debido a diferentes problemas con Qt, en esta versión no se encontrarán las herramientas normales de PySide.

E: Unable to locate package python3-pyside2uic

En este caso, podemos instalar los paquetes desde PyQt y crear enlaces simbólicos a las herramientas necesarias.

sudo apt-get install pyqt5-dev
sudo apt-get install pyqt5-dev-tools
cd /usr/bin/
ln -s pyrcc5 pyside2-rcc
ln -s pyuic5 pyside2-uic

Ahora la compilación puede continuar.

cd freecad-build/
cmake ../freecad-source -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DUSE_PYBIND11=ON
make -j2

La opción -j de make no debe ser más de 3 porque la Raspberry Pi tiene memoria limitada. Tardará varias horas en compilar, por lo que es mejor hacerlo durante la noche.

Más información, FreeCAD y Raspberry Pi 4.

Fedora

There is a bug in cmake distributed by Fedora 34/35 which results in cmake failing to find the opencascade libraries. This can easily be fixed by making one minor change to the top level cmake file of opencascade installed on Fedora. Details here: https://bugzilla.redhat.com/show_bug.cgi?id=2083568.

Near the top of the file OpenCASCADEConfig.cmake, change the following line to use REAL_PATH(). This fixes a bug introduced by the use of a symlink from /lib to /usr/lib of Fedora, which causes cmake to fail.

This file is usually installed in /usr/lib64/cmake/opencascade/OpenCASCADEConfig.cmake.

get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)

change this to:

file (REAL_PATH ${OpenCASCADE_INSTALL_PREFIX} OpenCASCADE_INSTALL_PREFIX)

This trivial change needs to be made inside the build directory once cmake has been run and failed. Re-running cmake will then correctly detect the OCCT libraries in the normal way.

Fedora38/39

Now install Python 3.11. This includes a notable change in how Python initializes when running a program. As a result FreeCAD fails to find OpenCamLib, meaning 3D Surface and Waterline are not available in the CAM Workbench. This was fixed in the master branch on 20th Mar 2024 (Pull request #13059).

Necesita los siguientes paquetes :

  • gcc-c++ (or possibly another C++ compiler?)
  • cmake
  • doxygen
  • swig
  • gettext
  • dos2unix
  • desktop-file-utils
  • libXmu-devel
  • freeimage-devel
  • mesa-libGLU-devel
  • opencascade-devel
  • openmpi-devel
  • python3
  • python3-devel
  • python3-pyside2
  • python3-pyside2-devel
  • pyside2-tools
  • boost-devel
  • tbb-devel
  • eigen3-devel
  • qt-devel
  • qt5-qtwebengine-devel
  • qt5-qtxmlpatterns
  • qt5-qtxmlpatterns-devel
  • qt5-qtsvg-devel
  • qt5-qttools-static
  • ode-devel
  • xerces-c
  • xerces-c-devel
  • opencv-devel
  • smesh-devel
  • Coin3
  • Coin3-devel
  • yaml-cpp

(Abril 2021, Coin4 y Coin4-devel están disponibles ) (si coin2 es el último disponible para su versión de Fedora, utilice los paquetes de http://www.zultron.com/rpm-repo/)

  • SoQt-devel
  • freetype
  • freetype-devel
  • vtk
  • vtk-devel
  • med
  • med-devel

Y opcionalmente:

To install all dependencies at once (tested on fedora 36 and 37):

sudo dnf install gcc-c++ cmake doxygen swig gettext dos2unix desktop-file-utils libXmu-devel freeimage-devel mesa-libGLU-devel opencascade-devel openmpi-devel python3 python3-devel python3-pyside2 python3-pyside2-devel pyside2-tools boost-devel tbb-devel eigen3-devel qt-devel qt5-qtwebengine-devel qt5-qtxmlpatterns qt5-qtxmlpatterns-devel qt5-qtsvg-devel qt5-qttools-static ode-devel xerces-c xerces-c-devel opencv-devel smesh-devel Coin3 Coin3-devel SoQt-devel freetype freetype-devel vtk vtk-devel med med-devel libspnav-devel python3-pivy python3-markdown python3-GitPython yaml-cpp

Gentoo

La forma más fácil de comprobar qué paquetes son necesarios para compilar FreeCAD es comprobarlo a través de portage:

emerge -pv freecad

Esto debería dar una buena lista de paquetes adicionales que necesitas instalar en tu sistema.

Si FreeCAD no está disponible en Portage, está disponible en waebbl overlay. El rastreador de problemas en el Github de la superposición waebbl puede ayudar a guiar a través de algunos problemas que puede encontrar. El overlay proporciona freecad-9999, que puedes elegir para compilar, o simplemente usar para obtener las dependencias.

layman -a waebbl

openSUSE

Tumbleweed

Los siguientes comandos instalarán los paquetes necesarios para construir FreeCAD con Qt5 y Python 3.

zypper in --no-recommends -t pattern devel_C_C++ devel_qt5

zypper in libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel boost-devel swig libboost_program_options-devel libboost_mpi_python3-devel libboost_system-devel libboost_program_options-devel libboost_regex-devel libboost_python3-devel libboost_thread-devel libboost_system-devel libboost_headers-devel libboost_graph-devel python3 python3-devel python3-matplotlib python3-matplotlib-qt5 python3-pyside2 python3-pyside2-devel python3-pivy gcc gcc-fortran cmake occt-devel libXi-devel opencv-devel libxerces-c-devel Coin-devel SoQt-devel freetype2-devel eigen3-devel libode6 vtk-devel libmed-devel hdf5-openmpi-devel openmpi2-devel netgen-devel freeglut-devel libspnav-devel f2c doxygen dos2unix glew-devel yaml-cpp

El siguiente comando instalará Qt Creator y el depurador de proyectos GNU.

zypper in libqt5-creator gdb

Si falta algún paquete, puedes comprobar el archivo Tumbleweed "FreeCAD.spec" en el Open Build Service.

Además, compruebe si hay algún parche que deba aplicar (como 0001-find-openmpi2-include-files.patch).

Leap

Si hay una diferencia entre los paquetes disponibles en Tumbleweed y Leap, entonces puedes leer el archivo Leap "FreeCAD.spec" en el Open Build Service para determinar los paquetes necesarios.

Ver piano_jonas guía no oficial "Compilar en openSUSE".

Arch Linux

Necesitará las siguientes bibliotecas de los depósitos oficiales:

  • boost
  • cmake
  • coin
  • curl
  • desktop-file-utils
  • eigen
  • gcc-fortran
  • git
  • glew
  • hicolor-icon-theme
  • jsoncpp
  • libspnav
  • med
  • nlohmann-json
  • opencascade
  • pyside2-tools
  • pyside2
  • python-matplotlib
  • python-netcdf4
  • python-packaging
  • python-pivy
  • qt5-svg
  • qt5-tools
  • qt5-webengine
  • shared-mime-info
  • shiboken2
  • swig
  • utf8cpp
  • verdict
  • xerces-c
  • yaml-cpp
sudo pacman -S --needed boost cmake coin curl desktop-file-utils eigen gcc-fortran git glew hicolor-icon-theme jsoncpp libspnav med nlohmann-json opencascade pyside2-tools pyside2 python-matplotlib python-netcdf4 python-packaging python-pivy qt5-svg qt5-tools qt5-webengine shared-mime-info shiboken2 swig utf8cpp xerces-c yaml-cpp

Note: Since version 5.0.1 of the openmpi package the binary libmpi_cxx.so stopped being shipped, this breaks the compilation with the current CMake process. To fix this you need to downgrade the package, see this forum post.

Distribuciones antiguas y no convencionales

En otras distribuciones, tenemos muy pocos comentarios de los usuarios, por lo que podría ser más difícil encontrar los paquetes necesarios.

Intente primero localizar las bibliotecas necesarias mencionadas en bibliotecas de terceros en su gestor de paquetes. Tenga en cuenta que algunas de ellas pueden tener un nombre de paquete ligeramente diferente; busque nombre, pero también libname, nombre-dev, nombre-devel, y similares. Si no es posible, intente compilar esas bibliotecas usted mismo.

FreeCAD requiere una versión del compilador GNU g++ igual o superior a la 3.0.0, ya que FreeCAD está escrito principalmente en C++. Durante la compilación se ejecutan algunos scripts de Python, por lo que el intérprete de Python tiene que funcionar correctamente. Para evitar cualquier problema con el enlazador también es una buena idea tener las rutas de las bibliotecas en la variable LD_LIBRARY_PATH o en el archivo ld.so.conf. Esto ya se hace en las distribuciones modernas de Linux, pero puede ser necesario configurarlo en las más antiguas.

Pivy

Pivy (envoltorios de Python para Coin3d) no es necesario para construir FreeCAD o para iniciarlo, pero es necesario como una dependencia en tiempo de ejecución por el Ambiente de Trabajo Borrador. Si no vas a utilizar este ambiente de trabajo, no necesitarás Pivy. Sin embargo, ten en cuenta que el Ambiente de Trabajo Borrador es utilizado internamente por otros ambientes de trabajo, como Arquitectura y BIM, por lo que Pivy necesita ser instalado para utilizar estos ambientes de trabajo también.

En noviembre de 2015 la versión obsoleta de Pivy incluida con el código fuente de FreeCAD ya no compilará en muchos sistemas. Esto no es un gran problema ya que normalmente deberías obtener Pivy desde el gestor de paquetes de tu distribución; si no puedes encontrar Pivy, puede que tengas que compilarlo tú mismo, ver Instrucciones de compilación de Pivy.

Símbolos de depuración

Para solucionar los fallos en FreeCAD, es útil tener los símbolos de depuración de las bibliotecas de dependencia importantes como Qt. Para ello, intenta instalar los paquetes de dependencia que terminan con -dbg, -dbgsym, -debuginfo o similares, dependiendo de tu distribución de Linux.

Para Ubuntu, es posible que tenga que habilitar repositorios especiales para poder ver e instalar estos paquetes de depuración con el gestor de paquetes. Consulte Debug Symbol Packages para obtener más información.

Compila FreeCAD

Compilación contra Python 2 y Qt4 ya no está bien soportada, y a partir de la versión 0.20 ya no está soportada en absoluto. Debería compilar contra Python 3 y Qt5. 0.20 requiere al menos Python3.6 y Qt 5.9.

FreeCAD utiliza CMake como su principal sistema de compilación, ya que está disponible en los principales sistemas operativos. La compilación con CMake es normalmente muy simple y ocurre en dos pasos.

  1. CMake comprueba que todos los programas y bibliotecas necesarios están presentes en tu sistema, y genera un Makefile que se configura para el segundo paso. FreeCAD tiene varias opciones de configuración entre las que elegir, pero viene con unos valores por defecto razonables. Algunas alternativas se detallan a continuación.
  2. La compilación propiamente dicha, que se realiza con el programa make, que genera los ejecutables de FreeCAD.

Dado que FreeCAD es una aplicación de gran tamaño, la compilación de todo el código fuente puede tardar entre 10 minutos y una hora, dependiendo de tu CPU y del número de núcleos de la CPU utilizados para la compilación.

Creación fuera-fuente

Para construir fuera-fuente, simplemente crea un directorio de construcción, freecad-build, distinto de tu carpeta de fuentes de FreeCAD, freecad-source; entonces desde este directorio de construcción apunta cmake a la carpeta de fuentes correcta. Puedes usar cmake-gui o ccmake en lugar de cmake en las instrucciones de abajo también. Una vez que cmake termine de configurar el entorno, utilice make para iniciar la compilación real.

# from your freecad source folder:
mkdir build
cd build
cmake ../
make -j$(nproc --ignore=2)

La opción -j de make controla cuántos trabajos (archivos) se compilan en paralelo. El programa nproc imprime el número de núcleos de la CPU en su sistema; usándolo junto con la opción -j puede elegir procesar tantos archivos como núcleos tenga, para acelerar la compilación general del programa. En el ejemplo anterior, utilizará todos los núcleos de tu sistema excepto dos; esto mantendrá a tu ordenador respondiendo para otros usos mientras la compilación se realiza en segundo plano. El ejecutable de FreeCAD aparecerá finalmente en el directorio freecad-build/bin. Ver también Compilación (aceleración) para mejorar la velocidad de compilación.

Resolving cmake issues

If you have done a build before and get stuck on a dependency that is not recognized or can't seem to be resolved, try the following:

  • Delete the contents of the build directory before running cmake again. FreeCAD is a rapidly moving target, you may be tripping over cached cmake information that points at an older version than the new repository head can use. Clearing the cache may allow cmake to recover and recognize the version you actually need.
  • If cmake complains about missing a specific file, use a tool such as "apt-file search", or its equivalent in other package systems, to discover what package that file belongs to and install it. Bear in mind that you are likely to need the -dev version of the package that carries header or config files files required for FreeCAD to use the package.

Compiling against GNU libc 2.34 and later

GNU libc 2.34 introduces a change to the library that can cause builds on some Linux systems to fail with an error like:

No rule to make target '/usr/lib/x86_64-linux-gnu/libdl.so

To resolve this, a symbolic link must be manually created from the (now empty) system-installed libdl.so.* to the location your compiler says it is looking for the file. For example (if the actual installed copy of libdl.so on your system is /usr/lib/x86_64-linux-gnu/libdl.so.2):

sudo ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so

Adapt the command for the structure of your system by searching for libdl.so* and linking it to the appropriate location.

Cómo reparar su directorio de código fuente

Si accidentalmente realizaste una compilación dentro del directorio de código fuente, o agregaste archivos extraños, y quisieras restaurar el contenido a sólo el código fuente original, puedes realizar los siguientes pasos.

> .gitignore
git clean -df
git reset --hard HEAD

La primera línea borra el archivo .gitignore. Esto asegura que los siguientes comandos de limpieza y reinicio afectarán a todo el directorio y no ignorarán los elementos que coincidan con las expresiones en .gitignore. La segunda línea borra todos los archivos y directorios que no son rastreados por el repositorio git; luego el último comando restablecerá cualquier cambio en los archivos rastreados, incluyendo el primer comando que borró el archivo .gitignore.

Si no borra el directorio de fuentes, las siguientes ejecuciones de cmake pueden no capturar las nuevas opciones del sistema si el código cambia.

Configuración

Pasando diferentes opciones a cmake, puedes cambiar cómo se compila FreeCAD. La sintaxis es la siguiente.

cmake -D <var>:<type>=<value> $SOURCE_DIR

Donde $SOURCE_DIR es el directorio que contiene el código fuente. El <tipo> puede omitirse en la mayoría de los casos. El espacio después de la opción -D también puede omitirse.

Por ejemplo, para evitar construir el Ambiente de trabajo MEF:

cmake -D BUILD_FEM:BOOL=OFF ../freecad-source
cmake -DBUILD_FEM=OFF ../freecad-source

Todas las variables posibles están listadas en el archivo InitializeFreeCADBuildOptions.cmake, ubicado en el directorio cMake/FreeCAD_Helpers. En este archivo, busque la palabra option para llegar a las variables que se pueden establecer, y ver sus valores por defecto.

# ==============================================================================
# =================   All the options for the build process    =================
# ==============================================================================

option(BUILD_FORCE_DIRECTORY "The build directory must be different to the source directory." OFF)
option(BUILD_GUI "Build FreeCAD Gui. Otherwise you have only the command line and the Python import module." ON)
option(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
option(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
...

Alternativamente, utilice el comando cmake -LH para listar la configuración actual, y por tanto todas las variables que pueden ser modificadas. También puede instalar y utilizar cmake-gui para lanzar una interfaz gráfica que muestra todas las variables que pueden ser modificadas. En las siguientes secciones enumeramos algunas de las opciones más relevantes que puede querer utilizar.

Para una creación de depuración

Crea una compilación Debug para solucionar fallos en FreeCAD. Ten en cuenta que con esta compilación el Croquizador se vuelve muy lento con croquis complejos.

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug ../freecad-source

Para una creación de versión

Crea una compilación Release para probar el código que no se bloquea. Una compilación Release se ejecutará mucho más rápido que una compilación Debug.

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Release ../freecad-source

Creación contra Python 3 y Qt5

Por defecto, FreeCAD 0.19 y anteriores construyen para Python 2 y Qt4. Dado que estos dos paquetes son obsoletos, es mejor construir para Python 3 y Qt5. El soporte para Python 2 y Qt4 se ha eliminado en FreeCAD 0.20 y no es necesario activar explícitamente Qt5 y Python 3 si se compilan las últimas versiones de desarrollo.

Por 0.20_dev:

cmake ../freecad-source

Tenga en cuenta que al cambiar entre las compilaciones 0.19 y 0.20, puede ser necesario borrar CMakeCache.txt antes de ejecutar cmake.

Creación para una versión específica de Python

Si el ejecutable python por defecto en tu sistema es un enlace simbólico a Python 2, cmake intentará configurar FreeCAD para esta versión. Puedes elegir otra versión de Python dando la ruta a un ejecutable específico:

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source

Si eso no funciona, es posible que tenga que definir variables adicionales que apunten a las bibliotecas de Python deseadas y a los directorios de inclusión:

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \
    -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
    -DPYTHON_PACKAGES_PATH=/usr/lib/python3.6/site-packages/ \
    ../freecad-source

Es posible tener varias versiones independientes de Python en el mismo sistema, por lo que las ubicaciones y números de versión de sus archivos de Python dependerán de su distribución particular de Linux. Utilice python3 -V para mostrar la versión de Python que está utilizando actualmente; sólo son necesarios los dos primeros números; por ejemplo, si el resultado es Python 3.6.8, necesita especificar los directorios que se refieren a la versión 3.6. Si no conoce los directorios correctos, intente buscarlos con el comando locate.

locate python3.6

Puede utilizar python3 -m site en un terminal para determinar el directorio site-packages, o dist-packages para los sistemas Debian.

Some components of FreeCAD, such as PySide, try to autodetect the most recent Python version installed on your system, which might fail if it is different from what you entered above. Adding the following cMake option might solve the issue:

-DPython3_FIND_STRATEGY=LOCATION

Creación con Qt Creator contra Python 3 y Qt5

1. Inicie Qt Creator.

2. Haga clic en Abierto Proyecto.

3. Navega hasta el directorio donde está el código fuente, freecad-source/, y elige el archivo CMakeLists.txt más alto.

4. Al seleccionar el archivo, se ejecutará automáticamente cmake en él, pero puede fallar si las opciones apropiadas no están correctamente configuradas.

5. Vaya a Projects → Build & Run → Imported Kit → Build → Build Settings → CMake. Establezca el directorio de compilación adecuado, freecad-build/.

6. Establezca las variables apropiadas en el diálogo Clave-Valor, de tipos String y Bool.

PYTHON_EXECUTABLE=/usr/bin/python3

7. Si las variables no cargan el proyecto correctamente, puede que tenga que ir a Projects → Manage Kits → Kits → Default (o Kit importado o similar) → CMake Configuration. A continuación, pulse Cambiar, y añada la configuración adecuada como se ha descrito anteriormente. Puede que tenga que añadir más variables sobre las rutas de Python, si no se encuentra el Python del sistema.

PYTHON_EXECUTABLE:STRING=/usr/bin/python3.7
PYTHON_INCLUDE_DIR:STRING=/usr/include/python3.7m
PYTHON_LIBRARY:STRING=/usr/lib/x86_64-linux-gnu/libpython3.7m.so
PYTHON_PACKAGES_PATH:STRING=/usr/lib/python3.7/site-packages

7.1. Pulse Aplicar y luego Aceptar.

7.2. Asegúrese de que el resto de las opciones están correctamente configuradas, por ejemplo, Versión de Qt debe ser una versión presente instalada en el sistema, como Qt 5.9.5 en PATH (qt5).

Pulse Aplicar y luego Aceptar para cerrar la configuración.

El programa cmake debería ejecutarse automáticamente de nuevo, y debería rellenar todo el diálogo Clave-Valor con todas las variables configurables.

8. Vaya a Projects → Build & Run → Imported Kit → Run → Run Settings → Run Configuration y elija FreeCADMain para compilar la versión gráfica de FreeCAD, o FreeCADMainCMD para compilar sólo la versión de línea de comandos.

9. Finalmente, vaya al menú Build → Build Project "FreeCAD". Si se trata de una nueva compilación, debería tardar varios minutos, incluso horas, dependiendo del número de procesadores que tengas disponibles.

Qt designer complemento

Si quieres desarrollar código Qt para FreeCAD, necesitarás el plugin Qt Designer que proporciona todos los widgets personalizados de FreeCAD.

Entra en un directorio auxiliar del código fuente, ejecuta qmake con el archivo de proyecto indicado para crear un Makefile; luego ejecuta make para compilar el plugin.

cd freecad-source/src/Tools/plugins/widget
qmake plugin.pro
make

Si estás compilando para Qt5, asegúrate de que el binario qmake es el correspondiente a esta versión, para que el Makefile resultante contenga la información necesaria para Qt5.

cd freecad-source/src/Tools/plugins/widget
$QT_DIR/bin/qmake plugin.pro
make

donde $QT_DIR es el directorio que almacena las bibliotecas binarias de Qt, por ejemplo, /usr/lib/x86_64-linux-gnu/qt5.

La biblioteca creada es libFreeCAD_widgets.so, que debe copiarse en $QT_DIR/plugins/designer.

sudo cp libFreeCAD_widgets.so $QT_DIR/plugins/designer

Pivy externo o interno

Anteriormente, una versión de Pivy estaba incluida en el código fuente de FreeCAD (interno). Si querías usar la copia de Pivy de tu sistema (externo), necesitabas usar <código>-DFREECAD_USE_EXTERNAL_PIVY=1</código>.

El uso de Pivy externo se convirtió en el valor por defecto durante el desarrollo de FreeCAD 0.16, por lo que ya no es necesario configurar esta opción manualmente.

Documentación de Doxygen

Si tienes Doxygen instalado puedes construir la documentación del código fuente. Consulte documentación de origen para obtener instrucciones.

Documentación adicional

El código fuente de FreeCAD es muy extenso, y con CMake es posible configurar muchas opciones. Aprender a usar CMake completamente puede ser útil para elegir las opciones adecuadas para tus necesidades particulares.

Hacer un paquete debian

Si planea construir un paquete Debian a partir de las fuentes, necesita instalar primero ciertos paquetes:

sudo apt install dh-make devscripts lintian

Vaya al directorio de FreeCAD y llame a

debuild

Una vez construido el paquete, puede utilizar lintian para comprobar si el paquete contiene errores

lintian freecad-package.deb

*.deb package with checkinstall

The Debian script checkinstall allows to create a *.deb package that can be installed and removed with the standard dpkg commands. It may need to be installed first (on Ubuntu use sudo apt install checkinstall). It's interactive and asks for the required information providing helpful defaults. During the process the package is installed and a *.deb file and a backup archive are created.

It's a good idea to define a name and a short description for the package. The name must be entered to uninstall it again and the desription will be listed by dpkg -l. The default name "build" is not very informative.

Example:

cd freecad-source/build
cmake ..
make
sudo checkinstall                                  # e.g. name=freecad-test1

The result is a *.deb file in the build folder. checkinstall will install the build by default. This is how you can install or uninstall it:

cd freecad-source/build
ls | grep freecad
        freecad-test1_20220814-1_amd64.deb
sudo dpkg -i freecad-test1_20220814-1_amd64.deb   # install
dkpg -l | grep freecad                            # find by name
sudo dpkg -r freecad-test1                        # uninstall by name

Actualización del código fuente

El sistema CMake permite actualizar de forma inteligente el código fuente, y sólo recompilar lo que ha cambiado, haciendo que las compilaciones posteriores sean más rápidas.

Muévete a la ubicación donde el código fuente de FreeCAD fue descargado por primera vez, y saca el nuevo código:

cd freecad-source
git pull

A continuación, muévete al directorio de compilación donde el código fue compilado inicialmente, y ejecuta cmake especificando el directorio actual (denotado por un punto); luego activa la re-compilación con make.

cd ../freecad-build
cmake .
make -j$(nproc --ignore=2)

Uninstalling the source code

In case the compiled source code was installed with sudo make install (for Debian) the files were copied to the /usr/local folder into several subfolders. For uninstallation the file install_manifest.txt can be used. It has been created into the build folder during compilation and contains all installed files. As long as this file exists, the installation can be uninstalled.

cd freecad-source/freecad-build
xargs sudo rm < install_manifest.txt

Solución de problemas

Para sistemas de 64 bits

Cuando se compone FreeCAD para 64 bits hay un problema conocido con el paquete OpenCASCADE (OCCT) de 64 bits. Para que FreeCAD funcione correctamente puede ser necesario ejecutar el script configure y establecer CXXFLAGS adicionales:

./configure CXXFLAGS="-D_OCC64"

Para los sistemas basados en Debian, esta opción no es necesaria cuando se utilizan los paquetes precompilados de OpenCASCADE porque éstos establecen el CXXFLAGS adecuado internamente.

Scripts de creación automática

Aquí está todo lo que necesitas para una construcción completa de FreeCAD. Es un enfoque de un solo script y funciona en una distribución de Linux recién instalada. Los comandos pedirán la contraseña de root para la instalación de paquetes y nuevos repositorios online. Estos scripts deberían funcionar en versiones de 32 y 64 bits. Están escritos para diferentes versiones, pero también es probable que funcionen en una versión posterior con o sin cambios importantes.

Si tienes un script de este tipo para tu distribución preferida, por favor discútelo en el foro de FreeCAD para que podamos incorporarlo.

Ubuntu

Estos scripts proporcionan una forma fiable de instalar el conjunto correcto de dependencias necesarias para construir y ejecutar FreeCAD en Ubuntu. Hacen uso de los archivos de paquetes personales de Ubuntu (PPA), y deberían funcionar en cualquier versión de Ubuntu a la que se dirija el PPA. El freecad-daily PPA se dirige a versiones recientes de Ubuntu, mientras que el freecad-stable PPA se dirige a las versiones oficialmente soportadas de Ubuntu.

Este script instala la instantánea diaria compilada de FreeCAD y sus dependencias. Añade el repositorio diario, obtiene las dependencias para construir esta versión, e instala los paquetes necesarios. Después procede a sacar el código fuente en un directorio particular, crea un directorio de compilación y cambia en él, configura el entorno de compilación con cmake, y finalmente construye el programa completo con make. Guarda el script en un archivo, hazlo ejecutable y ejecútalo, pero no utilices sudo; se pedirán privilegios de superusuario sólo para los comandos seleccionados. Pulsa "CTRL-ENTER" para cambiar de canal, "ALT-SHIFT-D" para subir, "ALT-SHIFT-B" para hacer un resumen, o pulsa "ALT" para hacer otros comandos.

#!/bin/sh
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-daily && sudo apt-get update
sudo apt-get build-dep freecad-daily
sudo apt-get install freecad-daily

git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad-source
mkdir freecad-build
cd freecad-build
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DFREECAD_USE_PYBIND11=ON ../freecad-source
make -j$(nproc --ignore=2)

Si lo deseas, puedes desinstalar la versión precompilada de FreeCAD (freecad-daily) dejando las dependencias en su lugar, sin embargo, dejar este paquete instalado permitirá al gestor de paquetes mantener sus dependencias actualizadas también; esto es sobre todo útil si tienes la intención de seguir el desarrollo de FreeCAD, y actualizar y compilar constantemente las fuentes desde el repositorio Git.

El script anterior asume que quieres compilar la última versión de FreeCAD, por lo que estás usando el repositorio "diario" para obtener las dependencias. Sin embargo, puedes obtener las dependencias de la versión "estable" de tu versión actual de Ubuntu. Si este es el caso, reemplace la parte superior del script anterior con las siguientes instrucciones. Para Ubuntu 12.04, omita --enable-source del comando.

#!/bin/sh
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-stable && sudo apt-get update
sudo apt-get build-dep freecad
sudo apt-get install libqt5xmlpatterns5-dev   # Needed for 0.20; should go away on next packaging update 
sudo apt-get install freecad

Una vez que instales el paquete freecad desde el repositorio freecad-stable, sustituirá al ejecutable de FreeCAD que está disponible en el repositorio de Universe Ubuntu. El ejecutable se llamará simplemente freecad, y no freecad-stable.

openSUSE

No se necesitan repositorios externos para compilar FreeCAD. Sin embargo, hay una incompatibilidad con python3-devel que debe ser eliminada. FreeCAD puede ser compilado desde GIT

# 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 --recurse-submodules https://github.com/FreeCAD/FreeCAD.git free-cad
 
# Now you will have a 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

Como estás usando git, la próxima vez que desees compilar no tienes que clonar todo, simplemente tira de git y compila una vez más

# 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
# Note: to speed up build use all CPU cores: make -j$(nproc)
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 --recurse-submodules https://github.com/FreeCAD/FreeCAD.git freecad
 
# go to source dir
cd freecad
 
# build configuration 
cmake .
 
# build FreeCAD
# Note: to speed up build use all CPU cores: make -j$(nproc)
make
 
# test FreeCAD
cd bin
./FreeCAD -t 0

Fedora 27/28/29

Enviado por el usuario [PrzemoF] en el foro.

#!/bin/bash

ARCH=$(arch)

MAIN_DIR=FreeCAD
BUILD_DIR=build

#FEDORA_VERSION=27
#FEDORA_VERSION=28
FEDORA_VERSION=29

PACKAGES="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 med-devel vtk-devel"

FEDORA_29_PACKAGES="boost-python2 boost-python3 boost-python2-devel boost-python3-devel"

if [ "$FEDORA_VERSION" = "29" ]; then
    PACKAGES="$PACKAGES $FEDORA_29_PACKAGES"
fi

echo "Installing packages required to build FreeCAD"
sudo dnf -y install $PACKAGES
cd ~
mkdir $MAIN_DIR || { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }
cd $MAIN_DIR
git clone --recurse-submodules https://github.com/FreeCAD/FreeCAD.git
mkdir $BUILD_DIR || { echo "~/$BUILD_DIR already exist. Quitting.."; exit; }
cd $BUILD_DIR
cmake ../FreeCAD 
make -j$(nproc)

Arch usando AUR

Repositorio de usuarios Arch (AUR) es una colección de recetas hechas por el usuario para construir paquetes que no están oficialmente soportados por los mantenedores de la distribución / comunidad. Por lo general, son seguros. Puedes ver quién mantiene el paquete y durante cuánto tiempo lo ha hecho. Se recomienda comprobar los archivos de construcción. También hay software que no es de código abierto disponible en esta área, incluso si es mantenido por la compañía oficial propietaria.

Requisito previo : git

Pasos :

  1. Abrir un terminal. Opcionalmente, crear un directorio, por ejemplo, mkdir git. Opcionalmente, cambiar de directorio, por ejemplo, cd git.
  2. Clonar el repositorio AUR : git clone http://aur.archlinux.org/packages/freecad-git
  3. Entrar en la carpeta del repositorio AUR : cd freecad-git
  4. Compilar usando Arch makepkg : makepkg -s. La bandera -s o --syncdeps también instalará las dependencias necesarias.
  5. Instalar el paquete creado : makepkg --install o hacer doble clic en el pkgname-pkgver.pkg.tar.xz dentro de su navegador de archivos.

Para actualizar FreeCAD a la última compilación simplemente repite el paso 3.Actualiza el repo de AUR cuando haya algún cambio de ruptura en la receta o nuevas características usando git checkout -f dentro de la carpeta.