Difference between revisions of "Installing Lazarus on macOS"

From Free Pascal wiki
Jump to navigationJump to search
(Undo revision 155868 by Edgardager (talk))
Tag: Undo
Line 1: Line 1:
 
{{Installing Lazarus on macOS}}
 
{{Installing Lazarus on macOS}}
  
Installing Lazarus on a Mac is not particularly difficult but it is critical that you do the install in the correct order. Skipping steps will almost certainly end in tears. In brief, here is what you need to do:
+
Instalar Lazarus en una Mac no es particularmente difícil pero es crítico que se haga en el orden correcto. Omitir pasos terminará con certeza en llanto. Al grano, aquí está lo que necesita hacer:
  
# Download and install Xcode (optional depending on your needs - see below for details).
+
# Descargue e instale Xcode (opcional depende de sus necesidades - ver abajo para detalles).
# Install the global command line tools for Xcode.
+
# Instale las herramientas globales para comandos en línea para Xcode.
# Download and install the Free Pascal Compiler (FPC) binaries package and the FPC source package from the [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area] ('''Important''' do this ''before'' you install the Lazarus IDE)
+
# Descargue e instale el paquete de binarios del Compilador de Free Pascal Compiler (FPC) y el paquete de los fuentes de FPC desde Lazarus IDE file area (Importante hágalo antes de instalar el IDE de Lazarus)
# Download and install the Lazarus IDE  from the [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area]
+
# Descargue e instale el IDE de Lazarus desde el área de archivo de Lazarus IDE
# Configure LLDB - the Apple supplied (and signed) debugger from within the Lazarus IDE.
+
# Configure LLDB - el depurador que suministra (y firma) Apple desde adentro del IDE de Lazarus.
  
These steps are explained in more detail below.
+
Estos pasos se explican en más detalle abajo.
  
  
  
== Installation ==
+
== Instalación ==
  
The detailed instructions assume a recent version of macOS on your Mac, a recent version of Xcode and/or Xcode command line tools from Apple and a recent version of Lazarus. On the [[#Legacy_Information|Legacy Information]] page, you will see older information that may be relevant if you are using older components. You can assist by replacing out of date information, either deleting it, or, if it may help someone working with a legacy project, moving it to the [[Legacy_Information:_Installing_Lazarus_on_Mac|legacy information]] page.
+
Las instrucciones detalladas asumen una reciente versión de MacOS en su Mac, una versión reciente de Xcode y/o herramientas de comandos en línea para Xcode de Apple y una versión reciente de Lazarus. En la página [[#Legacy_Information|Legacy Information]], verá información anterior que pueda ser relevante si está usando componentes antiguos. Puede asistir reemplazando la información desactualizada, tanto borrándola, o, si puede ayudar a alguien que trabaje con un proyecto legado, moverlo a la página  [[Legacy_Information:_Installing_Lazarus_on_Mac|legacy information]].
  
In general, this is about using both the '''Carbon''' and '''Cocoa''' Widget Sets. While Carbon was once seen as a little more stable, with the release Lazarus 2.0.8 the 64 bit Cocoa Widget Set has now surpassed Carbon and should be considered seriously for any new projects. Carbon was intentionally limited to 32 bits by Apple and you should be aware that it and the ability to run 32 bit executables have been removed completely from macOS 10.15 Catalina and later versions which now only support 64 bit executables using Cocoa.  
+
En general, esto es acerca de usar los Widget Set '''Carbon''' y ‘’’Cocoa’’’. Mientras que Carbon se vio alguna vez como más estable, con el lanzamiento de Lazarus 2.0.8 el Widget Set Cocoa ha sobrepasado a Carbon y debería considerarse seriamente para cualquier proyecto nuevo. Carbon se limitó intencionalmente a 32 bit por Apple y deberá estar consciente de que Carbon y la habilidad de ejecutar programas de 32 bits ha sido removido completamente de MacOS 10.15 Catalina y posteriores versiones las que sólo soportan ejecutables de 64 bits que usan Cocoa.
  
=== Step 1: Download Xcode (optional) ===
+
=== Paso 1: Descargar Xcode (opcional) ===
  
Xcode is a 12GB download which will take up 16GB of disk space. You '''only''' need to download and install the full Xcode development environment '''if''' you need:
+
Xcode es una descarga de 12GB la cual tomará hasta 16GB de espacio en disco. '''Sólo''' necesitará descargar e instalar el ambiente de desarrollo completo de Xcode '''si''' necesita:
  
* the SDKs for '''iOS''', '''iPadOS''', watchOS and tvOS; or
+
* el SDKs para '''iOS''', '''iPadOS''', watchOS y tvOS; ó
* to validate and upload apps to the Mac App Store; or
+
* validar y subir aplicaciones a la Mac App Store; ó
* to [[Notarization for macOS 10.14.5+|notarise]] apps for distribution outside of the Mac App Store.  
+
* para [[Notarization for macOS 10.14.5+|notarise]] apps para distribución fuera de la Mac App Store.  
  
Xcode 11.3.1 for use on macOS 10.14 Mojave must now be installed by downloading it from [http://developer.apple.com/ Apple Developer Connection] (ADC), which requires free registration.  Xcode 12.4.x for use on macOS 10.15 Catalina and later versions can be installed from the [https://apps.apple.com/us/genre/mac-developer-tools/id12002?mt=12 Mac App store]. Note that you must first move any old Xcode versions from the Applications folder into the trash or rename the Xcode app (eg Xcode.app to Xcode_1014.app). You can then select which version of Xcode to use with the command line utility <tt>xcode-select</tt>. Open an Applications > Utilities > Terminal and type <tt>man xcode-select</tt> for this utility's manual page.
+
Xcode 11.3.1 para usarse en MacOS 10.14 Mojave debe instalarse descargándolo desde (ADC) [http://developer.apple.com/ Apple Developer Connection], el cual es de registro gratuito.  Xcode 12.4.x para uso en MacOS 10.15 Catalina y posteriores versiones pueden instalarse desde [https://apps.apple.com/us/genre/mac-developer-tools/id12002?mt=12 Mac App store].  
 +
 
 +
Note que debe primero eliminar cualquier versión anterior de Xcode de la carpeta Aplicaciones o renombre Xcode app (p.e. Xcode.app a Xcode_1014.app). Puede entonces seleccionar la versión de Xcode a usarse con la utilidad de comandos en línea <tt>xcode-select</tt>. Abrir una terminal Applications > Utilities > Terminal y teclear <tt>man xcode-select</tt> para el manual de utilidad.
 +
 
 +
'''Sistemas Anteriores:'''
 +
 
 +
Las herramientas para desarrollador de Xcode pueden instalarse desde los discos de instalación originales de MacOS o una nueva copia descargada del sitio (ADC) [http://developer.apple.com/ Apple Developer Connection], el cual requiere de registrarse sin costo.  Descargue el archivo Xcode, terminará en su directorio de Descargas como un archivo zip.  Abralo.  Se desactivará en su directorio de Descargas.  Puede que le guste o no.  Otros usuarios verán la ruta pero serán incapaces de usarla.  Y ahí viene lo confuso. Así que moví el mío y luego escribí xcode-select a donde se movió (en una terminal) -
  
'''Older systems:'''
 
  
The Xcode developer tools can be installed from the original macOS installation disks or a newer copy downloaded from the [http://developer.apple.com/ Apple Developer Connection] (ADC), which requires free registration. Download the Xcode file, it will end up in your Downloads directory as a zip file. Click it. It is unarchived into your Downloads directory. You may be happy with it there but maybe not. Other users will see the path to it but be unable to use it. And it is untidy there. So I moved mine and then told xcode-select where it was moved to (in a terminal) -
 
  
 
<syntaxhighlight lang="bash">mv Downloads/Xcode.app /Developer/.
 
<syntaxhighlight lang="bash">mv Downloads/Xcode.app /Developer/.
 
sudo xcode-select -s /Developer/Xcode.app/Contents/Developer </syntaxhighlight>
 
sudo xcode-select -s /Developer/Xcode.app/Contents/Developer </syntaxhighlight>
  
=== Step 2: Xcode Command Line Tools ===
 
  
This is shown here as a separate step because it really is a separate step. Don't confuse these standalone command line tools with the internal Xcode command line tools that the Xcode GUI will tell you are already installed if you installed the full Xcode package in Step 1. FPC cannot use those Xcode internal command line tools without configuration changes (see [[Xcode]] for details).
+
=== Paso 2: Las Herramientas de comandos en línea de Xcode ===
 +
 
 +
Esto se muestra aquí como un paso aparte porque en serio es un paso aparte. No confunda estas herramientas independientes de comandos en línea con las herramientas internas de comandos en línea de Xcode, las que le dirá el GUI de Xcode que ya había instalado aunque ya se había instalado el paquete completo de Xcode en el paso 1. FPC no puede usar esas herramientas de comandos en línea internas sin los cambios de configuración  (ver [[Xcode]] para detalles).
 +
 
 +
Haga lo siguiente, es rápido y fácil para todas las versiones de MacOS incluida Catalina 10.15:
  
Do the following, it is quick and easy for all macOS versions up to and including Catalina 10.15:
 
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 47: Line 53:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For Big Sur 11.x and later, you only need to enter the first of the two commands above unless you have also installed the full Xcode package. If you have only installed the command line tools, you should omit entering the ''xcodebuild'' command.
+
Para Big Sur 11.x y posteriores, sólo necesita entrar el primero de los dos comandos arriba a menos que ya haya instalado el paquete completo de Xcode. Si sólo instaló las herramientas de comandos en línea, debería omitir hacer el comando ''xcodebuild''.
 +
 
 +
Si tiene problemas instalando las herramientas de comandos en línea usando este método de comandos en línea (p.e. el instalador se congela mientras que “busca Software”), puede también descargar e instalar el paquete de herramientas de comandos en línea ingresando en el sitio [https://developer.apple.com/download/more/?=for%20Xcode Apple Developer Site] luego descargar e instalar la imagen de disco de las ''Herramientas de comandos en línea para Xcode''.
 +
 
 +
=== Paso 3: binarios FPC código fuente FPC ===
 +
 
 +
{{Note| Para las instalaciones Apple Silicon/AArch64/M1, si está instalando FPC 3.2.2  (Lazarus 2.2RCx or 2.2.0 o posteriores) no necesita compilar una versión nativa de FPC para Apple Silicon porque FPC 3.2.2 para MacOS es un binario universal que contiene ejecutables tanto para Intel como para aarch64.  Si está instalando una versión de FPC anterior a la 3.2.2, entonces por favor refiérase a [[macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FApple_Silicon_Support|estas instrucciones]] para construir un Compilador de Free Pascal nativo para Apple Silicon después de instalar el binario de 64 bits de Intel y los paquetes fuente para FCP.}}
 +
 
 +
Descargue e instale el paquete de binarios oficial de FPC y el paquete fuente de FPC por separado en el sitio [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area].  
  
If you have problems installing the command line tools using this command line method (eg the installer freezes while "finding Software"), you can also download and install the command line tools package by logging in to the [https://developer.apple.com/download/more/?=for%20Xcode Apple Developer Site] and downloading and installing the ''Command Line Tools for Xcode'' disk image.
+
Cuando llegue al área de archivos del IDE de Lazarus:
  
=== Step 3: FPC binaries and FPC source code ===
+
# Escoja la versión correcta para su sistema operativo.  La vasta mayoría de usuarios Mac deberían escoger los paquetes de 64 bits en el directorio x86-64.  Cada computador Mac desde finales de 2006 ha sido funcional a 64 bits.  El hecho de que Apple haya dejado completamente todo el soporte a 32 bits desde la versión de MacOS 10.15 Catalina (liberada en Octubre de 2019) es otra razón para escoger los paquetes de 64 bits.
 +
# Escoja la versión de Lazarus que desee instalar y se le presentará con los dos binarios FPC y paquetes fuentes para descargar.
  
{{Note| For Apple Silicon/AArch64/M1 installations, if you are installing FPC 3.2.2 (Lazarus 2.2RCx or 2.2.0 or later) you don't need to compile a native Apple Silicon version of FPC because FPC 3.2.2 for macOS is a universal binary containing both Intel and aarch64 executables. If you are installing a version of FPC earlier than 3.2.2, then please refer to [[macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FApple_Silicon_Support|these instructions]] for building a native Apple Silicon Free Pascal Compiler after installing the 64 bit Intel binary and source packages for FPC.}}
+
Estos paquetes de instalación se construyeron por los desarrolladores de FPC/Lazarus y versiones formales. Como estos paquetes de instalación no son aprobados por Apple, necesita mantener oprimida la tecla Control, cliquear el paquete y elegir Abrir y confirmar que desea instalar desde un Desarrollador Desconocido.
  
Download and install the official FPC binaries package and the separate FPC source package from the [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area].  
+
Podrá gustarle intentar una simple y rápida prueba de FPC en este estado -
 +
[[Installing_the_Free_Pascal_Compiler#Testing_the_FPC_Install|Probar la instalación FPC]].
  
When you arrive at the Lazarus IDE file area:
+
=== Paso 4: Instalar el IDE de Lazarus ===
  
# Choose the correct version of your operating system. The vast majority of Mac users should now choose the 64 bit packages in the Lazarus macOS x86-64 directory. Every Mac computer since late 2006 has been 64 bit capable. The fact that Apple has completely dropped all 32 bit support from macOS 10.15 Catalina (released in October 2019) is another reason to choose the 64 bit packages.
+
Es crítico que un Compilador Free Pascal compatible (FPC) y su código fuente deba ser instalado ''antes que instale'' el IDE de Lazarus.
# Choose the version of Lazarus you wish to install and you will be presented with the two FPC binary and source packages to download.
 
  
These installation packages are built by the FPC/Lazarus developers and track formal releases. As these installation packages are not approved by Apple, you need to hold down the Control key, click the package and choose Open and confirm you want to install from an Unknown Developer.
+
{{Note| Para la instalación en Apple Silicon/AArch64, por favor refiérase al sitio [[#Lazarus Fixes 2.2|Ajustes en Lazarus 2.2]] o [[#FPC_development_version|Desarrollo de Lazarus]] encontrará instrucciones para construir un IDE nativo de Lazarus.  Sáltese las instrucciones de construcción y use las fuentes de ajustes de Lazarus 2.2 o las fuentes de desarrollo de Lazarus y descargue las que guste.}}
  
You might like to try a simple and quick test of FPC at this stage - [[Installing_the_Free_Pascal_Compiler#Testing_the_FPC_Install|Testing FPC installation]].
+
Descargue e instale el IDE de Lazarus del sitio [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area].  Cuando esté en el área de archivos, escoja la versión conforme a su sistema operativo.  La vasta mayoría de usuarios Mac deberían escoger los paquetes de 64 bits en el directorio Lazarus MacOS x86_64.  Cada computador Mac desde finales de 2006 es capaz de ejecutarse a 64 bits.  El hecho de que Apple haya abandonado completamente el soporte a 32 bits desde MacOS 10.15 Catalina (liberada en Octubre de 2019) es otra razón para escoger los paquetes a 64 bits.
  
=== Step 4: Install the Lazarus IDE ===
 
  
It is critical that a compatible Free Pascal Compiler (FPC) and its source must be installed ''before you install'' the Lazarus IDE. 
+
=== Paso 5: Configure el Depurador ===
  
{{Note| For installation on Apple Silicon/AArch64, please refer to the [[#Lazarus Fixes 2.2|Lazarus Fixes 2.2]] or [[#FPC_development_version|Lazarus development]] instructions to build a native Lazarus IDE. Skip to the building instructions and use the Lazarus Fixes 2.2 source / Lazarus development source download as you wish.}}
+
En versiones de Lazarus 1.8.4 y anteriores, necesita usar <tt>gdb</tt> como depurador, lento para instalar y difícil de firmar. Desde Lazarus 2.0.0 puede (y debería) usar <tt>lldb</tt>, un depurador proporcionado por Apple, el cual no necesita firmarse.  
  
Download and install the Lazarus IDE from the [https://sourceforge.net/projects/lazarus/files/ Lazarus IDE file area]. When you arrive at that file area, choose the correct version of your operating system. The vast majority of Mac users should now choose the 64 bit packages in the Lazarus macOS x86-64 directory. Every Mac computer since late 2006 has been 64 bit capable. The fact that Apple has completely dropped all 32 bit support from macOS 10.15 Catalina (released in October 2019) is another reason to choose the 64 bit packages.
+
Asumiendo que tenga instalado lo que necesite e inicie Lazarus, todo lo que falta será configurar el depurador. Si no hace esto ahora, Lazarus tratará de usar <tt>gdb</tt> y fallará.
  
=== Step 5: Configure the Debugger ===
+
Tenga en cuenta que para depurar aplicaciones de 64 bits, puede que tenga dificultades con <tt>lldb</tt> por lo que se recomienda instalar una versión de <tt>gdb</tt> diferente.
  
In versions of Lazarus 1.8.4 and earlier, you needed to use <tt>gdb</tt> as a debugger, slow to install and hard to sign. Since Lazarus 2.0.0 you can (and should) use <tt>lldb</tt>, a debugger provided by Apple, no signing required.
+
* Lazarus versión 2.0.12 con FPC 3.0.4: Es posible instalar <tt>gdb</tt> y compilar la versión según su versión de S.O. (p.e. El Capitán usará la versión de gdb 7.12.1).
  
Assuming you have installed what is necessary and started Lazarus, all that remains is configuring the debugger. If you don't do this now, Lazarus will try to use <tt>gdb</tt> and fail.
+
* Lazarus versión 2.2.0: Primero, clique  Lazarus > Preferencias > Debugger - Debugger Backend;
  
* Lazarus version 2.2.0: First, click Lazarus > Preferences > Debugger - Debugger Backend;
+
* Lazarus antes de la version 2.2.0: Primero, clique Herramientas > Opciones > Debugger.
  
* Lazarus before version 2.2.0: First, click Tools > Options > Debugger.  
+
En la parte superior derecha de la ventana ahora abrir tiene la etiqueta “Tipo de Debugger y ruta”, debe poner tanto el tipo y la ruta. Seleccione el tipo "LLDB debugger (con fpdebug) (Beta)" y seleccione o escriba la ruta <tt>/usr/bin/lldb</tt>.
  
Top right of the window now open has a label, "Debugger type and path", you must set both the type and the path. Select the type "LLDB debugger (with fpdebug) (Beta)" and select or type the path <tt>/usr/bin/lldb</tt>.
 
  
 
[[File:Set_Debugger2.png|none]]
 
[[File:Set_Debugger2.png|none]]
  
If "LLDB debugger (with fpdebug) (Beta)" is not shown in the selection list, see [[#Installing_LazDebuggerFpLLdb|Installing LazDebuggerFpLLdb]] below. The XCode command line tools install <tt>lldb</tt> to the <tt>/usr/bin</tt> directory. Save those settings and you can now try to compile the almost nothing program that Lazarus has kindly provided for you (click the small green triangle near top left).
+
Si no se muestra en la lista de selección "LLDB debugger (with fpdebug) (Beta), vea abajo [[#Installing_LazDebuggerFpLLdb|Installing LazDebuggerFpLLdb]]. Las herramientas de comandos en línea instala <tt>lldb</tt> en el directorio <tt>/usr/bin</tt>. Guarde esas opciones y puede ahora intentar compilar su programa (clique el pequeño triángulo verde en la parte superior izquierda).
  
Next you see a puzzling question, see image below. Choose a "Debug Format" from one of those offered -
+
En seguida verá una pregunta capciosa, vea la imagen abajo. Escoja un “Formato de Depuración" de los siguientes -
  
 
[[File:Set_Dwarf.png|none]]
 
[[File:Set_Dwarf.png|none]]
  
Martin_fr, the person who has given us this interface between the Lazarus IDE and <tt>lldb</tt>, suggests you use ''' "dwarf3" '''. Then, you need to enter your password, a macOS cuteness because one application appears to be interfering with another. In this case, that's fine!
+
Martin_fr, la persona que nos ha dado esta interfaz entre el IDE de Lazarus y <tt>lldb</tt>, sugiere que use ''' "dwarf3" '''. Luego, necesitará entrar su contraseña, un detalle de MacOS porque una aplicación parece interferir con otra. En este caso, está bien!
 +
 
 +
Cuando se ejecuta el depurador de vez en cuando se le preguntará por su contraseña para permitir la depuración.  Esto es por su propia seguridad.
  
When running the debugger from time to time you will be asked for your password to allow debugging. This is for your own safety.
 
  
==== Extra Information on using lldb ====
+
==== Información Extra al usar lldb ====
  
A great deal of information about using lldb appears in [https://forum.lazarus.freepascal.org/index.php/topic,42869.0.html this forum thread]. Here are a few gems, again, from Martin_fr:
+
Un gran acuerdo de información acerca de usar lldb aparece en el sitio [https://forum.lazarus.freepascal.org/index.php/topic,42869.0.html this forum thread]. —- Aquí hay algunas gemas, de nuevo, de Martin_fr:
  
In the unexpected case of problems, it may be worth trying "dwarf with sets" instead of just "dwarf3".  
+
En el inesperado caso de problemas, puede no servir intentar "dwarf con sets" en vez de sólo "dwarf3".  
  
The "debug info" setting only affects the units directly in your project. However, units in packages may have debug info too. This can be:
+
La opción de "debug info" sólo afecta las unidades directamente en su proyecto. Sin embargo, las unidades en los paquetes puede que tengan información sobre depuración también. Esto puede ser:
  
* set per package
+
* set por paquete
* for many, but not all packages in the menu Tools > Configure "Build Lazarus"
+
* para muchos, pero no todos los paquetes en el menú Herramientas > Configurar “Construir Lazarus"
 
* Project > Project Options > [[IDE_Window:_Compiler_Options#Additions_and_Overrides|Additions and Overrides]]
 
* Project > Project Options > [[IDE_Window:_Compiler_Options#Additions_and_Overrides|Additions and Overrides]]
  
If you change settings for a package, you might want to check which package you expect to step into when debugging. Packages you do not step into, do not need debug info.
+
Si se cambia las opciones para un paquete, puede querer revisar qué paquete espera seguir cuando se depura. Los paquetes que no siga, no necesitan la información de depuración.
  
If you use a type from a package (such as TForm from LCL) it is enough that your unit (in which you declare the variable / must declare and use a variable to include the type) has debug info. Reducing the number of packages with debug info (including those that default to have debug info), can shorten the debuggers start-up time.
+
Si usa un tipo desde un paquete (como TForm de LCL) basta que su unidad (en la cual declaró la variable / vaya a declarar y usar una variable a incluir en el tipo) tenga información de depuración. Reducir el número de paquetes con información de depuración (incluyendo aquellos que por defecto tengan información sobre depuración), puede acortar el tiempo de arranque de los depuradores.
  
Also it may be worth comparing (it has not been tested) the debuggers start up time for the same settings, only changing the checkbox "use external debug info".
+
También puede servir comparar (no se ha probado) el tiempo de arranque de los depuradores para las mismas opciones, sólo cambiando el checkbox "use external debug info".
  
This needs to be only set in your project. If set in your project it will affect all packages. (If set in a package it should have no affect.)
+
Esto necesita ponerse sólo en su proyecto. Si se pone en su proyecto afectará a todos los paquetes. (Si se pone en un paquete debería no surtir efecto.)
  
==== Installing LazDebuggerFpLLdb ====
 
  
If you installed from source and used the [[#What does the bigide make argument do?|<tt>bigide</tt>]] parameter to <tt>make</tt>, then the correct debugger will be installed, as a package, and ready to go. If, however, you installed in another way, it may, or may not be there.
+
==== Instalar LazDebuggerFpLLdb ====
  
From the main IDE screen, click Packages->Install/UninstallPackages. Shown is two lists of packages, the list on the left is installed, the list on the right is available to install. Look for LazDebuggerFpLldb (exactly that, there are some similar named but less suitable packages). If it is on the right hand side, click it, press "Install Selection" and then "Save and rebuild IDE". This will take a little time, the IDE will shutdown and restart and all should be well. Now jump back up the page and continue configuring the debugger.
+
Si instaló desde la fuente y usó el [[#What does the bigide make argument do?|<tt>bigide</tt>]] parámetro a <tt>construir</tt>, entonces el depurador correcto será instalado, como paquete, y liso a usar. Si, no obstante, se instalara de otra forma, puede, o no puede estar ahí.
  
== Cocoa 64 bit vs Carbon 32 bit ==
+
Desde la pantalla principal del IDE, clique Paquetes->Instalar/DesinstalarPaquetes.  Se muestra dos listas de paquetes, la lista de la izquierda está instalada, la lista de la derecha está disponible a instalarse.  Busque LazDebuggerFpLldb (exactamente así, hay varios con nombres similares pero son menos adecuados).  Si está al lado derecho, clíquelo, presione “Selección a Instalar" y luego “Guardar y reconstruir IDE".  Esto tomará algo de tiempo, el IDE se reiniciará y todo deberá estar bien.  Ahora regrese a la página y continúe configurando el depurador.
  
Using the Apple 64 bit Cocoa framework is now undeniably the future on the Mac. The Apple 32 bit Carbon framework, while no longer being developed, works pretty much as expected, but you are advised to try Cocoa first because Apple dropped all support for 32 bit applications and the 32 bit Carbon framework in macOS 10.15 Catalina (October 2019).
 
  
It is possible to build a Cocoa version of the Lazarus IDE with v2.0.0 and later.  It is also possible to build a Carbon version of the Lazarus IDE (unless you are running macOS 10.15 Catalina or later) and use that to generate Cocoa 64 bit binaries.
+
== Cocoa 64 bits vs Carbon 32 bits ==
  
To produce Cocoa applications in the Carbon or Cocoa IDE, you need to set the Target to the 64 bit processor and select the Cocoa widgetset:
+
Usar el marco de Apple de 64 bits Cocoa es ahora innegable para el futuro del Mac.  El marco de 32 bits Carbon de Apple, mientras que no se ha estado desarrollando, funciona como se esperaba, pero se le advierte a probar Cocoa primero porque Apple abandonó todo soporte para aplicaciones a 32 bits en MacOS 10.15 Catalina (Octubre 2019).
  
* Open your project with Lazarus and from the menu select Project > Project Options
+
Es posible construir una versión de Cocoa para el IDE de Lazarus con la versión 2.0.0 y posteriores.  Es también posible construir una versión de Carbon del IDE de Lazarus (a menos que esté ejecutando MacOs 10.15 Catalina o posteriores) y lo use para generar binarios Cocoa de 64 bits.
* In the "Config and Target" panel set the "Target CPU family" to be "x86_64" (Intel) or "aarch64" (Apple M1)
 
* In the "Config and Target" panel, if the "Current LCL widgetset" is not set to Cocoa, click "Select another LCL widgetset" which will take you to the "Additions and Overrides" panel where you can click on "Set LCLWidgetType" pulldown and set the value to "Cocoa"
 
* Make sure under Tools > Options (Lazarus > Preferences in v2.2.0 and later) that "Compiler Executable" is set to "/usr/local/bin/fpc" to get 64 bit applications.
 
* Now compile your project - and please feed back any problems you experience.
 
  
== FPC + Lazarus Compatibility Matrix ==
+
Para producir aplicaciones Cocoa en el IDE Carbon o Cocoa, necesitará poner el Destino a procesador de 64 bits y seleccionar el widgetset Cocoa:
 +
 
 +
 
 +
* Abra su proyecto con Lazarus y desde el menú seleccione Proyecto > Opciones de Proyecto
 +
* En el panel "Config and Target" ponga "Target CPU family" en "x86_64" (Intel) o "aarch64" (Apple M1)
 +
* En el panel "Config and Target", si "Current LCL widgetset" no está puesto en Cocoa, clique "Select another LCL widgetset" el cual le lleve al panel de "Additions and Overrides" donde pueda clicar en "Set LCLWidgetType" y poder seleccionar "Cocoa"
 +
* Asegúrese que en Herramientas > Opciones (Lazarus > Preferencias para v2.2.0 y posteriores) que "Compiler Executable" esté puesto en "/usr/local/bin/fpc" para obtener aplicaciones de 64 bits.
 +
* Ahora compile su proyecto - y por favor comuníquese si tiene problemas con su experiencia.
 +
 
 +
== Matriz de Compatibilidad FPC + Lazarus ==
 +
 
 +
No toda combinación de Lazarus y Free Pascal es compatible con cada instalación de MacOS.  Por favor refiérase a la siguiente tabla para encontrar la versión correcta para su ambiente de desarrollo:
  
Not every combination of Lazarus and Free Pascal is compatible with every installation of macOS. Please refer to the following table in order to find the correct version for your development environment:
 
 
{{Template:Compatibility matrix of Lazarus for Mac}}
 
{{Template:Compatibility matrix of Lazarus for Mac}}
  
== Installing non-release versions of the Lazarus IDE ==
+
== Instalar versiones del IDE de Lazarus que no han sido lanzadas ==
  
=== Lazarus Fixes 2.2 ===
+
=== Ajustes para Lazarus 2.2 ===
  
* [[Lazarus_2.2_fixes_branch|Fixes included in fixes_2_2]]
+
* [[Lazarus_2.2_fixes_branch|Ajustes incluidos en fixes_2_2]]
  
There are a number of reasons why you may be better off using a non-release version of Lazarus, specifically, fixes_2_2. Particularly:
+
Hay un número de razones por las que pueda mejor usar una versión no-liberada de Lazarus, específicamente, fixes_2_2. En lo particular:
  
* You almost certainly need to target 64 bit Cocoa, macOS 10.15 Catalina and later do not support 32 bit Carbon at all.
+
* La necesidad de trabajar Cocoa a 64 bits, pues MacOS 10.15 Catalina y posteriores no dan soporte a Carbon a 32 bits.
* The Cocoa widget set has steadily improved and the lldb debugger interface has rapidly improved, since even v2.0.0.
+
* El widget Cococa ha mejorado notoriamente y la interfaz del depurador lldb ha mejorado rápidamente, incluso desde v2.0.0.
* If your Mac has an Apple M1 Processor, the debugger in fixes_2_2 now works for aarch64.
+
* Si su Mac tiene un Procesador Apple M1, el depurador en fixes_2_2 ahora funciona para aarch64.
* Fixes_2_2 is a safer and more stable option than the development branch, but still gets the new features much faster than the release version.
+
* Fixes_2_2 es una opción más estable que la rama de desarrollo, pero todavía obtiene las nuevas características mucho más rápidas que la versión a liberar.
  
Pre-compiled binaries based on fixes_2_2 are not available from SourceForge so we download and build from the source code. A little slow initially but very reliable and a great test of your compiler install ! You will need git which is included in all recent versions of the Xcode command line tools which you should have already installed (see [[#Step_2:_Xcode_Command_Line_Tools|Xcode Command Line Tools]] above).
+
Los binarios Pre-compilados basados en fixes_2_2 no están disponibles desde SourceForge así que lo descargamos y construimos desde los fuentes. Un poco lento inicialmente pero muy confiable y una gran prueba para la instalación de su compilador! Necesitará git el cual se incluye en todas las versiones recientes de las herramientas de comandos en línea de Xcode, las que ya debió instalar previamente (ver [[#Step_2:_Xcode_Command_Line_Tools|Xcode Command Line Tools]] arriba).
  
About svn or git: The Xcode 11.4 command line tools on macOS 10.15 no longer install svn, only git. You can install subversion via fink, ports or brew.
+
Acerca de svn o git: Las herramientas de comandos en línea de Xcode 11.4 en MacOS 10.15 ya no instalan svn, sólo git. Puede instalar la subversión por medio de fink, ports o brew.
  
{{Apple Silicon Lazarus Build Notes}}
 
  
==== Downloading Lazarus Fixes 2.2 source ====
+
{{Notas sobre la Construcción de Lazarus en Apple Silicon}}
  
Create a directory for Lazarus and download the current fixes version:
+
==== Descargar los fuentes de Lazarus Fixes 2.2 ====
 +
 
 +
Cree un directorio para Lazarus y descargue la versión de fixes actual.
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 172: Line 191:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Using git:
+
Usando git:
 
  git clone -b fixes_2_2 https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_fixes
 
  git clone -b fixes_2_2 https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_fixes
  
Using svn:
+
Usando svn:
 
  svn checkout https://github.com/fpc/Lazarus/branches/fixes_2_2 laz_fixes
 
  svn checkout https://github.com/fpc/Lazarus/branches/fixes_2_2 laz_fixes
  
Depending on your internet connection and server congestion this takes a few seconds or a few minutes.
+
Dependiendo de su conexión a internet y la congestión del servidor esto tomará algunos segundos o minutos.
 +
 
  
==== Updating Lazarus Fixes 2.2 source ====
+
==== Actualizar las fuentes de Lazarus Fixes 2.2 ====
  
To keep your fixes_2_2 installation up to date is as easy as:
+
para mantener actualizada su instalación fixes_2_2 es tan simple como:
  
Using git:
+
Usando git:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 192: Line 212:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Using svn:
+
Usando svn:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 200: Line 220:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== Building Lazarus Fixes 2.2 source ====  
+
==== Construir las fuentes de Lazarus Fixes 2.2 ====  
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd laz_fixes
 
cd laz_fixes
 
make distclean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide
 
make distclean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide
//-wait some time...
+
//-espere algún tiempo . . .
 
open startlazarus.app --args "--pcp=~/.laz_fixes"
 
open startlazarus.app --args "--pcp=~/.laz_fixes"
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* Note I pass a parameter to use a config directory that is based on the name of the actual install directory. It makes some scripting easy.
+
* Note que paso un parámetro para usar un directorio de configuración que se basa en el nombre del directorio actual de instalación. Hace que el scripting sea sencillo.
  
* On older macOS versions supporting 32 bit applications, replace the above make line with "''make LCL_PLATFORM=carbon CPU_TARGET=i386 bigide'' " and set up your project as mentioned in the [[#Cocoa_64_bit_vs_Carbon_32_bit|Carbon and Cocoa]] section below.
+
* en antiguas versiones de MacOS que soportan las aplicaciones de 32 bits, reemplace la anterior línea de make con "''make LCL_PLATFORM=carbon CPU_TARGET=i386 bigide'' " y configure su proyecto como se menciona el la sección arriba [[#Cocoa_64_bit_vs_Carbon_32_bit|Carbon and Cocoa]].
  
You might like to put a small script in your $HOME/bin directory and even set a path to it (very UNIX!)
+
Le gustará colocar un pequeño script en su directorio $HOME/bin e incluso colocar una ruta a él (muy UNIX!)
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 222: Line 242:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Lazarus development version ===
+
=== Version de Desarrollo de Lazarus ===
  
* [[Lazarus_2.4.0_release_notes|Lazarus Development Version Notes]] - Note: work in progress
+
* [[Lazarus_2.4.0_release_notes|Notas de la Versión de Desarrollo de Lazarus]] - Nota: trabajo en progreso
  
Precompiled binaries based on the development version (was known as "trunk" in SVN; now known as "main" in GIT) of the Lazarus IDE are not available from SourceForge, so here's how to download the development version source using ''svn'' or ''git'' and build the Lazarus IDE. You will need svn (before macOS 10.15 - Catalina) or git (after macOS 10.14 - Mojave) which is included in the standalone Xcode command line tools which you should have already installed (see Xcode Command Line Tools above).  
+
Los binarios precompilados basados en la versión de desarrollo (era conocida como "trunk" en SVN; ahora conocido como "main" en GIT) del IDE de Lazarus ya no está disponible de SourceForge, así que aquí está cómo descargar la versión de desarrollo usando ''svn'' o ''git'' y construir el IDE. Necesitará svn (antes de MacOS 10.15 - Catalina) o git (después de MacOS 10.14 - Mojave) el cual se incluye con las herramientas de comando en línea de Xcode el cual debería ya haber instalado (ver arriba las Herramientas de Comando en Línea de Xcode).
  
{{Apple Silicon Lazarus Build Notes}}
+
{{Notas sobre Construcción para Apple Silicon}}
  
==== Downloading Lazarus development version source ====
+
==== Descargue las fuentes de la versión de desarrollo de Lazarus ====
  
 
<syntaxhighlight lang="sh">
 
<syntaxhighlight lang="sh">
Line 238: Line 258:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Using git:
+
Usando git:
 
  git clone -b main https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_main
 
  git clone -b main https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_main
  
Using svn:
+
Usando svn:
 
  svn checkout --depth files https://github.com/fpc/Lazarus/branches all
 
  svn checkout --depth files https://github.com/fpc/Lazarus/branches all
 
  cd all
 
  cd all
 
  svn update --set-depth infinity main
 
  svn update --set-depth infinity main
  
The above svn invocation is more complex due to a bug in many versions of Subversion. This workaround was the work of Alfred (aka Don Alfredo in the [[Forum]]) who is the wizard behind [[fpcupdeluxe]].
+
La anterior llamada a svn es más compleja debido a un bug en muchas versiones de Subversion. Este ajuste ha sido el trabajo de Alfred (aka Don Alfredo en el [[Forum]]) y quien es el mago detrás de esto [[fpcupdeluxe]].
  
==== Updating Lazarus development version source ====
+
==== Actualizando la fuente de la versión de desarrollo de Lazarus ====
  
To update your existing Lazarus development version source.
+
Para actualizar su fuente de la versión de desarrollo de Lazarus.
  
Using git:
+
Usando git:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 260: Line 280:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Using svn:
+
Usando svn:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 268: Line 288:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== Building Lazarus development version source ====
+
==== Construyendo la fuente de la versión de desarrollo de Lazarus ====
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 278: Line 298:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
After one of above commands, wait some time and:
+
Después de los siguientes comandos, espere algo de tiempo y:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
open startlazarus.app --args "--pcp=~/.laz_dev"
 
open startlazarus.app --args "--pcp=~/.laz_dev"
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== What does the bigide make argument do? ===
+
=== Qué hace el argumento bigide? ===
  
 
{{BigIDE}}
 
{{BigIDE}}
  
== Installing non-release versions of FPC ==
+
== Instalando versions no-liberadas de FPC ==
  
 
{{macOS FPC Source Installation}}
 
{{macOS FPC Source Installation}}
  
== Known issues and solutions ==
+
== Problemas conocidos y soluciones ==
  
=== Lazarus IDE v2.2.0 - rebuilding issue ===
+
=== Problema al reconstruir Lazarus IDE v2.2.0 ===
  
 
<div class="mw-collapsible mw-collapsed">
 
<div class="mw-collapsible mw-collapsed">
  
Any attempt to rebuild the Lazarus IDE from within itself fails with permission errors because the files and directories are owned by a user with the id of 503 whereas most users will find that their id is 501. The solution is to open an Applications > Utilities> Terminal and:
+
Cualquier intento de reconstruir el IDE de Lazarus desde sí mismo fallará con los errores de permiso porque los archivos y directorios le pertenecen a un usuario con el id de 503 mientras que muchos usuarios encontrarán que su id es 501. La solución es abrir una Terminal (Aplicaciones > Utilidades > Terminal) y:
 +
 
  
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
Line 303: Line 324:
 
  sudo chown -R your_username Lazarus
 
  sudo chown -R your_username Lazarus
  
==== The following rebuilding errors do not happen on Intel computers ====
+
==== Los siguientes errores en reconstrucción no ocurren en los computadores Intel ====
 +
 
 +
El siguiente error que ocurre es que el compilador de recursos "fpcres" no se encuentra.  La solución es crear un archivo <tt>.fpc.cfg</tt> (nótese el punto inicial) en su directorio home y agregar las siguientes líneas en él:
  
The next error that occurs is that the resource compiler "fpcres" is not found. The solution is to create a <tt>.fpc.cfg</tt> (note the initial dot) file in your home directory and add these lines to it:
 
  
 
  #include /etc/fpc.cfg
 
  #include /etc/fpc.cfg
 
  -FD/usr/local/bin
 
  -FD/usr/local/bin
  
so that "fpcres" can be found where it was installed.
+
de tal forma que se pueda encontrar "fpcres" donde se instaló.
  
The next error complains of an unsupported target architecture <tt>-Paarch64</tt>, with the advice to invoke the "fpc" compiler driver instead - except that is what we are doing already. The solution is to go to Lazarus > Preferences > Compiler executable which is set to <tt>/usr/local/bin/fpc</tt> and change that to <tt>/usr/local/lib/fpc/3.2.2/ppca64</tt> instead.
+
El siguiente error se muestra por una arquitectura target no soportada <tt>-Paarch64</tt>, con el consejo de invocar el driver de compilador "fpc" en su lugar - excepto que eso es lo que ya hemos hecho. La solución es ir a Lazarus > Preferencias > Ejecutable de Compilador el cual se pone como <tt>/usr/local/bin/fpc</tt> y se deberá cambiar por <tt>/usr/local/lib/fpc/3.2.2/ppca64</tt> en su lugar.
  
The IDE will now be successfully rebuilt but will not restart automatically. Trying to then start Lazarus from either the <tt>startlazarus.app</tt> icon or the <tt>lazarus.app</tt> icon in <tt>/Applications/Lazarus</tt> still results in the original Intel lazarus binary being launched. The correct aarch64 binary can be found in <tt>~/.lazarus/bin/aarch64-darwin/lazarus</tt>. So the final solution is to open an Application > Utilities > Terminal and:
+
El IDE será ahora reconstruido exitosamente pero no reiniciará de forma automática. Intentando entonces iniciar Lazarus desde el icono de <tt>startlazarus.app</tt> o el icono  <tt>lazarus.app</tt> en <tt>/Applications/Lazarus</tt> todavía resulta en el binario original de Intel siendo lanzado. El binario correcto para aarch64 puede encontrarse en <tt>~/.lazarus/bin/aarch64-darwin/lazarus</tt>. Así que la solución final es abrir una Application > Utilities > Terminal y:
  
 
  mv /Applications/Lazarus/lazarus /Applications/Lazarus/lazarus.old
 
  mv /Applications/Lazarus/lazarus /Applications/Lazarus/lazarus.old
 
  mv  ~/.lazarus/bin/aarch64-darwin/lazarus /Applications/Lazarus/
 
  mv  ~/.lazarus/bin/aarch64-darwin/lazarus /Applications/Lazarus/
  
You can then start the IDE with either the <tt>startLazarus.app</tt> or <tt>lazarus.app</tt> icons. When you do restart lazarus, it is worth returning to the Lazarus > Preferences > Compiler executable which is set to <tt>/usr/local/lib/fpc/3.2.2/ppca64</tt> and changing it back to <tt>/usr/local/bin/fpc</tt> so that you can compile both aarch64 and Intel binaries to, for example, make a [[macOS_Big_Sur_changes_for_developers#Creating_a_universal_binary_for_aarch64_and_x86_64|Universal Binary]] which will run on both Intel and aarch64 machines.
+
Puedes entonces iniciar el IDE mediante los iconos <tt>startLazarus.app</tt> o <tt>lazarus.app</tt>. Cuando reincide Lazarus, merece que ponga nuevamente el ejecutable del compilador Lazarus > Preferencias > Ejecutable del Compilador a <tt>/usr/local/lib/fpc/3.2.2/ppca64</tt> y colocarlo nuevamente a <tt>/usr/local/bin/fpc</tt> de tal forma que pueda compilar binarios para aarch64 e Intel, por ejemplo, crear un [[macOS_Big_Sur_changes_for_developers#Creating_a_universal_binary_for_aarch64_and_x86_64|Universal Binary]] el cual se ejecutará tanto en máquinas Intel y aarch64.
 
</div></div>
 
</div></div>
  

Revision as of 16:52, 3 March 2023

English (en) español (es) 한국어 (ko) русский (ru)

macOSlogo.png

This article applies to macOS only.

See also: Multiplatform Programming Guide


Instalar Lazarus en una Mac no es particularmente difícil pero es crítico que se haga en el orden correcto. Omitir pasos terminará con certeza en llanto. Al grano, aquí está lo que necesita hacer:

  1. Descargue e instale Xcode (opcional depende de sus necesidades - ver abajo para detalles).
  2. Instale las herramientas globales para comandos en línea para Xcode.
  3. Descargue e instale el paquete de binarios del Compilador de Free Pascal Compiler (FPC) y el paquete de los fuentes de FPC desde Lazarus IDE file area (Importante hágalo antes de instalar el IDE de Lazarus)
  4. Descargue e instale el IDE de Lazarus desde el área de archivo de Lazarus IDE
  5. Configure LLDB - el depurador que suministra (y firma) Apple desde adentro del IDE de Lazarus.

Estos pasos se explican en más detalle abajo.


Instalación

Las instrucciones detalladas asumen una reciente versión de MacOS en su Mac, una versión reciente de Xcode y/o herramientas de comandos en línea para Xcode de Apple y una versión reciente de Lazarus. En la página Legacy Information, verá información anterior que pueda ser relevante si está usando componentes antiguos. Puede asistir reemplazando la información desactualizada, tanto borrándola, o, si puede ayudar a alguien que trabaje con un proyecto legado, moverlo a la página legacy information.

En general, esto es acerca de usar los Widget Set Carbon y ‘’’Cocoa’’’. Mientras que Carbon se vio alguna vez como más estable, con el lanzamiento de Lazarus 2.0.8 el Widget Set Cocoa ha sobrepasado a Carbon y debería considerarse seriamente para cualquier proyecto nuevo. Carbon se limitó intencionalmente a 32 bit por Apple y deberá estar consciente de que Carbon y la habilidad de ejecutar programas de 32 bits ha sido removido completamente de MacOS 10.15 Catalina y posteriores versiones las que sólo soportan ejecutables de 64 bits que usan Cocoa.

Paso 1: Descargar Xcode (opcional)

Xcode es una descarga de 12GB la cual tomará hasta 16GB de espacio en disco. Sólo necesitará descargar e instalar el ambiente de desarrollo completo de Xcode si necesita:

  • el SDKs para iOS, iPadOS, watchOS y tvOS; ó
  • validar y subir aplicaciones a la Mac App Store; ó
  • para notarise apps para distribución fuera de la Mac App Store.

Xcode 11.3.1 para usarse en MacOS 10.14 Mojave debe instalarse descargándolo desde (ADC) Apple Developer Connection, el cual es de registro gratuito. Xcode 12.4.x para uso en MacOS 10.15 Catalina y posteriores versiones pueden instalarse desde Mac App store.

Note que debe primero eliminar cualquier versión anterior de Xcode de la carpeta Aplicaciones o renombre Xcode app (p.e. Xcode.app a Xcode_1014.app). Puede entonces seleccionar la versión de Xcode a usarse con la utilidad de comandos en línea xcode-select. Abrir una terminal Applications > Utilities > Terminal y teclear man xcode-select para el manual de utilidad.

Sistemas Anteriores:

Las herramientas para desarrollador de Xcode pueden instalarse desde los discos de instalación originales de MacOS o una nueva copia descargada del sitio (ADC) Apple Developer Connection, el cual requiere de registrarse sin costo. Descargue el archivo Xcode, terminará en su directorio de Descargas como un archivo zip. Abralo. Se desactivará en su directorio de Descargas. Puede que le guste o no. Otros usuarios verán la ruta pero serán incapaces de usarla. Y ahí viene lo confuso. Así que moví el mío y luego escribí xcode-select a donde se movió (en una terminal) -


mv Downloads/Xcode.app /Developer/.
sudo xcode-select -s /Developer/Xcode.app/Contents/Developer


Paso 2: Las Herramientas de comandos en línea de Xcode

Esto se muestra aquí como un paso aparte porque en serio es un paso aparte. No confunda estas herramientas independientes de comandos en línea con las herramientas internas de comandos en línea de Xcode, las que le dirá el GUI de Xcode que ya había instalado aunque ya se había instalado el paquete completo de Xcode en el paso 1. FPC no puede usar esas herramientas de comandos en línea internas sin los cambios de configuración (ver Xcode para detalles).

Haga lo siguiente, es rápido y fácil para todas las versiones de MacOS incluida Catalina 10.15:


sudo xcode-select --install
sudo xcodebuild -license accept

Para Big Sur 11.x y posteriores, sólo necesita entrar el primero de los dos comandos arriba a menos que ya haya instalado el paquete completo de Xcode. Si sólo instaló las herramientas de comandos en línea, debería omitir hacer el comando xcodebuild.

Si tiene problemas instalando las herramientas de comandos en línea usando este método de comandos en línea (p.e. el instalador se congela mientras que “busca Software”), puede también descargar e instalar el paquete de herramientas de comandos en línea ingresando en el sitio Apple Developer Site luego descargar e instalar la imagen de disco de las Herramientas de comandos en línea para Xcode.

Paso 3: binarios FPC código fuente FPC

Light bulb  Note: Para las instalaciones Apple Silicon/AArch64/M1, si está instalando FPC 3.2.2 (Lazarus 2.2RCx or 2.2.0 o posteriores) no necesita compilar una versión nativa de FPC para Apple Silicon porque FPC 3.2.2 para MacOS es un binario universal que contiene ejecutables tanto para Intel como para aarch64. Si está instalando una versión de FPC anterior a la 3.2.2, entonces por favor refiérase a estas instrucciones para construir un Compilador de Free Pascal nativo para Apple Silicon después de instalar el binario de 64 bits de Intel y los paquetes fuente para FCP.

Descargue e instale el paquete de binarios oficial de FPC y el paquete fuente de FPC por separado en el sitio Lazarus IDE file area.

Cuando llegue al área de archivos del IDE de Lazarus:

  1. Escoja la versión correcta para su sistema operativo. La vasta mayoría de usuarios Mac deberían escoger los paquetes de 64 bits en el directorio x86-64. Cada computador Mac desde finales de 2006 ha sido funcional a 64 bits. El hecho de que Apple haya dejado completamente todo el soporte a 32 bits desde la versión de MacOS 10.15 Catalina (liberada en Octubre de 2019) es otra razón para escoger los paquetes de 64 bits.
  2. Escoja la versión de Lazarus que desee instalar y se le presentará con los dos binarios FPC y paquetes fuentes para descargar.

Estos paquetes de instalación se construyeron por los desarrolladores de FPC/Lazarus y versiones formales. Como estos paquetes de instalación no son aprobados por Apple, necesita mantener oprimida la tecla Control, cliquear el paquete y elegir Abrir y confirmar que desea instalar desde un Desarrollador Desconocido.

Podrá gustarle intentar una simple y rápida prueba de FPC en este estado - Probar la instalación FPC.

Paso 4: Instalar el IDE de Lazarus

Es crítico que un Compilador Free Pascal compatible (FPC) y su código fuente deba ser instalado antes que instale el IDE de Lazarus.

Light bulb  Note: Para la instalación en Apple Silicon/AArch64, por favor refiérase al sitio Ajustes en Lazarus 2.2 o Desarrollo de Lazarus encontrará instrucciones para construir un IDE nativo de Lazarus. Sáltese las instrucciones de construcción y use las fuentes de ajustes de Lazarus 2.2 o las fuentes de desarrollo de Lazarus y descargue las que guste.

Descargue e instale el IDE de Lazarus del sitio Lazarus IDE file area. Cuando esté en el área de archivos, escoja la versión conforme a su sistema operativo. La vasta mayoría de usuarios Mac deberían escoger los paquetes de 64 bits en el directorio Lazarus MacOS x86_64. Cada computador Mac desde finales de 2006 es capaz de ejecutarse a 64 bits. El hecho de que Apple haya abandonado completamente el soporte a 32 bits desde MacOS 10.15 Catalina (liberada en Octubre de 2019) es otra razón para escoger los paquetes a 64 bits.


Paso 5: Configure el Depurador

En versiones de Lazarus 1.8.4 y anteriores, necesita usar gdb como depurador, lento para instalar y difícil de firmar. Desde Lazarus 2.0.0 puede (y debería) usar lldb, un depurador proporcionado por Apple, el cual no necesita firmarse.

Asumiendo que tenga instalado lo que necesite e inicie Lazarus, todo lo que falta será configurar el depurador. Si no hace esto ahora, Lazarus tratará de usar gdb y fallará.

Tenga en cuenta que para depurar aplicaciones de 64 bits, puede que tenga dificultades con lldb por lo que se recomienda instalar una versión de gdb diferente.

  • Lazarus versión 2.0.12 con FPC 3.0.4: Es posible instalar gdb y compilar la versión según su versión de S.O. (p.e. El Capitán usará la versión de gdb 7.12.1).
  • Lazarus versión 2.2.0: Primero, clique Lazarus > Preferencias > Debugger - Debugger Backend;
  • Lazarus antes de la version 2.2.0: Primero, clique Herramientas > Opciones > Debugger.

En la parte superior derecha de la ventana ahora abrir tiene la etiqueta “Tipo de Debugger y ruta”, debe poner tanto el tipo y la ruta. Seleccione el tipo "LLDB debugger (con fpdebug) (Beta)" y seleccione o escriba la ruta /usr/bin/lldb.


Set Debugger2.png

Si no se muestra en la lista de selección "LLDB debugger (with fpdebug) (Beta)”, vea abajo Installing LazDebuggerFpLLdb. Las herramientas de comandos en línea instala lldb en el directorio /usr/bin. Guarde esas opciones y puede ahora intentar compilar su programa (clique el pequeño triángulo verde en la parte superior izquierda).

En seguida verá una pregunta capciosa, vea la imagen abajo. Escoja un “Formato de Depuración" de los siguientes -

Set Dwarf.png

Martin_fr, la persona que nos ha dado esta interfaz entre el IDE de Lazarus y lldb, sugiere que use "dwarf3" . Luego, necesitará entrar su contraseña, un detalle de MacOS porque una aplicación parece interferir con otra. En este caso, está bien!

Cuando se ejecuta el depurador de vez en cuando se le preguntará por su contraseña para permitir la depuración. Esto es por su propia seguridad.


Información Extra al usar lldb

Un gran acuerdo de información acerca de usar lldb aparece en el sitio this forum thread. —- Aquí hay algunas gemas, de nuevo, de Martin_fr:

En el inesperado caso de problemas, puede no servir intentar "dwarf con sets" en vez de sólo "dwarf3".

La opción de "debug info" sólo afecta las unidades directamente en su proyecto. Sin embargo, las unidades en los paquetes puede que tengan información sobre depuración también. Esto puede ser:

  • set por paquete
  • para muchos, pero no todos los paquetes en el menú Herramientas > Configurar “Construir Lazarus"
  • Project > Project Options > Additions and Overrides

Si se cambia las opciones para un paquete, puede querer revisar qué paquete espera seguir cuando se depura. Los paquetes que no siga, no necesitan la información de depuración.

Si usa un tipo desde un paquete (como TForm de LCL) basta que su unidad (en la cual declaró la variable / vaya a declarar y usar una variable a incluir en el tipo) tenga información de depuración. Reducir el número de paquetes con información de depuración (incluyendo aquellos que por defecto tengan información sobre depuración), puede acortar el tiempo de arranque de los depuradores.

También puede servir comparar (no se ha probado) el tiempo de arranque de los depuradores para las mismas opciones, sólo cambiando el checkbox "use external debug info".

Esto necesita ponerse sólo en su proyecto. Si se pone en su proyecto afectará a todos los paquetes. (Si se pone en un paquete debería no surtir efecto.)


Instalar LazDebuggerFpLLdb

Si instaló desde la fuente y usó el bigide parámetro a construir, entonces el depurador correcto será instalado, como paquete, y liso a usar. Si, no obstante, se instalara de otra forma, puede, o no puede estar ahí.

Desde la pantalla principal del IDE, clique Paquetes->Instalar/DesinstalarPaquetes. Se muestra dos listas de paquetes, la lista de la izquierda está instalada, la lista de la derecha está disponible a instalarse. Busque LazDebuggerFpLldb (exactamente así, hay varios con nombres similares pero son menos adecuados). Si está al lado derecho, clíquelo, presione “Selección a Instalar" y luego “Guardar y reconstruir IDE". Esto tomará algo de tiempo, el IDE se reiniciará y todo deberá estar bien. Ahora regrese a la página y continúe configurando el depurador.


Cocoa 64 bits vs Carbon 32 bits

Usar el marco de Apple de 64 bits Cocoa es ahora innegable para el futuro del Mac. El marco de 32 bits Carbon de Apple, mientras que no se ha estado desarrollando, funciona como se esperaba, pero se le advierte a probar Cocoa primero porque Apple abandonó todo soporte para aplicaciones a 32 bits en MacOS 10.15 Catalina (Octubre 2019).

Es posible construir una versión de Cocoa para el IDE de Lazarus con la versión 2.0.0 y posteriores. Es también posible construir una versión de Carbon del IDE de Lazarus (a menos que esté ejecutando MacOs 10.15 Catalina o posteriores) y lo use para generar binarios Cocoa de 64 bits.

Para producir aplicaciones Cocoa en el IDE Carbon o Cocoa, necesitará poner el Destino a procesador de 64 bits y seleccionar el widgetset Cocoa:


  • Abra su proyecto con Lazarus y desde el menú seleccione Proyecto > Opciones de Proyecto
  • En el panel "Config and Target" ponga "Target CPU family" en "x86_64" (Intel) o "aarch64" (Apple M1)
  • En el panel "Config and Target", si "Current LCL widgetset" no está puesto en Cocoa, clique "Select another LCL widgetset" el cual le lleve al panel de "Additions and Overrides" donde pueda clicar en "Set LCLWidgetType" y poder seleccionar "Cocoa"
  • Asegúrese que en Herramientas > Opciones (Lazarus > Preferencias para v2.2.0 y posteriores) que "Compiler Executable" esté puesto en "/usr/local/bin/fpc" para obtener aplicaciones de 64 bits.
  • Ahora compile su proyecto - y por favor comuníquese si tiene problemas con su experiencia.

Matriz de Compatibilidad FPC + Lazarus

No toda combinación de Lazarus y Free Pascal es compatible con cada instalación de MacOS. Por favor refiérase a la siguiente tabla para encontrar la versión correcta para su ambiente de desarrollo:

Lazarus Compatibility Matrix
Lazarus 1.8.x Lazarus 2.0.y Lazarus 2.0.8 Lazarus 2.0.10 Lazarus 2.0.12 Lazarus 2.2.y
FPC 3.0.4 FPC 3.2.0 FPC 3.2.2
PPC processors
Mac OS X 10.4 (Tiger) Incompatible Incompatible Incompatible Incompatible Incompatible Incompatible Incompatible
Mac OS X 10.5 (Leopard) Not tested Not tested Incompatible Incompatible Incompatible Incompatible Incompatible
Intel processors
Mac OS X 10.4 (Tiger) Incompatible Incompatible Incompatible Incompatible Incompatible Incompatible Incompatible
Mac OS X 10.5 (Leopard) Not tested Compatible^ Not tested Compatible^** Not tested Not tested Not tested
Mac OS X 10.6 (Snow Leopard) Compatible Compatible^^ Not tested Not tested Not tested Not tested Not tested
Mac OS X 10.7 (Lion) Compatible Not tested Not tested Not tested Not tested Not tested Not tested
OS X 10.8 (Mountain Lion) Compatible^^ Compatible Compatible**# Compatible**# Compatible**# Compatible# Compatible
OS X 10.9 (Mavericks) Compatible^^ Compatible Compatible** Compatible** Not tested Not tested Not tested
OS X 10.10 (Yosemite) Compatible^^ Compatible Compatible** Compatible** Not tested Not tested Not tested
OS X 10.11 (El Capitan) Compatible^^ Compatible Compatible*** Compatible Compatible Compatible Comptaible
macOS 10.12 (Sierra) Compatible^^ Compatible Compatible*** Compatible Compatible Compatible Compatible
macOS 10.13 (High Sierra) Not tested Compatible Compatible*** Compatible Compatible Compatible Comptaible
macOS 10.14 (Mojave) Not tested Compatible Compatible*** Compatible Compatible Compatible Compatible
macOS 10.15 (Catalina) Not tested Compatible Compatible*** Compatible Compatible Compatible Compatible
macOS 11 (Big Sur) Not tested Compatible Compatible*** Compatible Compatible Compatible Compatible
macOS 12 (Monterey) Not tested Not tested Not tested Not tested Not tested Not tested Compatible
macOS 13 (Ventura) Not tested Not tested Not tested Not tested Not tested Not tested Compatible
macOS 14 (Sonoma) Not tested Not tested Not tested Not tested Not tested Not tested Compatible
Apple Silicon M series processors
macOS 11 (Big Sur) Not tested Not tested Not tested Compatible†† Compatible†† Compatible††† Compatible*
macOS 12 (Monterey) Not tested Not tested Not tested Compatible†† Compatible†† Compatible††† Compatible*
macOS 13 (Ventura) Not tested Not tested Not tested Compatible†† Compatible†† Compatible††† Compatible*
macOS 14 (Sonoma) Not tested Not tested Not tested Compatible†† Compatible†† Compatible††† Compatible*

x = 0, 2 or 4; y = 0, 2, 4 or 6

^ Carbon interface compiles - Cocoa does not.

^^ Restrictions apply to debugging with gdb.

* Lazarus 2.2.0 installs universal binaries for FPC 3.2.2, but an Intel Lazarus IDE binary which you can use or recompile the IDE from within itself for a native aarch64 version.

** See Installing Lazarus 2.0.8, 2.0.10 with FPC 3.2.0 for macOS 10.10 and earlier for instructions.

*** See Installing Lazarus 2.0.8 with FPC 3.2.0 for macOS 10.11+ for instructions.

# Cannot run without debugging in the IDE. Can run compiled application outside of the IDE. See Issue #37324. Choose the gdb debugger, change timeout option to false or click through five "timeout" dialogs to run with debugging in the IDE.

Cannot "run without debugging" in the IDE. Can run compiled application outside of the IDE. See Lazarus IDE - Unable to "run without debugging" for workaround. See Issue #36780.

†† You need to compile a native aarch64 version of FPC 3.3.1 (trunk) and Lazarus 2.0.12 from source to support an Apple Silicon M series processor. Refer to these instructions for FPC and these instructions for the Lazarus IDE.

††† After installing FPC 3.2.2, you need to compile a native aarch64 version of Lazarus from source to support an Apple Silicon M series processor. Refer to these instructions for compiling the Lazarus IDE.

See the legacy version of this compatibility matrix for recommended installs on very old versions of macOS.

Instalar versiones del IDE de Lazarus que no han sido lanzadas

Ajustes para Lazarus 2.2

Hay un número de razones por las que pueda mejor usar una versión no-liberada de Lazarus, específicamente, fixes_2_2. En lo particular:

  • La necesidad de trabajar Cocoa a 64 bits, pues MacOS 10.15 Catalina y posteriores no dan soporte a Carbon a 32 bits.
  • El widget Cococa ha mejorado notoriamente y la interfaz del depurador lldb ha mejorado rápidamente, incluso desde v2.0.0.
  • Si su Mac tiene un Procesador Apple M1, el depurador en fixes_2_2 ahora funciona para aarch64.
  • Fixes_2_2 es una opción más estable que la rama de desarrollo, pero todavía obtiene las nuevas características mucho más rápidas que la versión a liberar.

Los binarios Pre-compilados basados en fixes_2_2 no están disponibles desde SourceForge así que lo descargamos y construimos desde los fuentes. Un poco lento inicialmente pero muy confiable y una gran prueba para la instalación de su compilador! Necesitará git el cual se incluye en todas las versiones recientes de las herramientas de comandos en línea de Xcode, las que ya debió instalar previamente (ver Xcode Command Line Tools arriba).

Acerca de svn o git: Las herramientas de comandos en línea de Xcode 11.4 en MacOS 10.15 ya no instalan svn, sólo git. Puede instalar la subversión por medio de fink, ports o brew.


Template:Notas sobre la Construcción de Lazarus en Apple Silicon

Descargar los fuentes de Lazarus Fixes 2.2

Cree un directorio para Lazarus y descargue la versión de fixes actual.

cd
mkdir -p bin/lazarus
cd bin/lazarus

Usando git:

git clone -b fixes_2_2 https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_fixes

Usando svn:

svn checkout https://github.com/fpc/Lazarus/branches/fixes_2_2 laz_fixes

Dependiendo de su conexión a internet y la congestión del servidor esto tomará algunos segundos o minutos.


Actualizar las fuentes de Lazarus Fixes 2.2

para mantener actualizada su instalación fixes_2_2 es tan simple como:

Usando git:

cd ~/bin/lazarus/laz_fixes
git clean -f -d
git pull

Usando svn:

cd ~/bin/lazarus/laz_fixes
svn clean --remove-unversioned
svn update

Construir las fuentes de Lazarus Fixes 2.2

cd laz_fixes
make distclean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide
//-espere algún tiempo . . .
open startlazarus.app --args "--pcp=~/.laz_fixes"
  • Note que paso un parámetro para usar un directorio de configuración que se basa en el nombre del directorio actual de instalación. Hace que el scripting sea sencillo.
  • en antiguas versiones de MacOS que soportan las aplicaciones de 32 bits, reemplace la anterior línea de make con "make LCL_PLATFORM=carbon CPU_TARGET=i386 bigide " y configure su proyecto como se menciona el la sección arriba Carbon and Cocoa.

Le gustará colocar un pequeño script en su directorio $HOME/bin e incluso colocar una ruta a él (muy UNIX!)

#!/bin/bash
LAZDIR="laz_fixes"
cd ~/bin/lazarus/"$LAZDIR"
open ~/bin/lazarus/"$LAZDIR"/lazarus.app --args "--pcp=~/.$LAZDIR"

Version de Desarrollo de Lazarus

Los binarios precompilados basados en la versión de desarrollo (era conocida como "trunk" en SVN; ahora conocido como "main" en GIT) del IDE de Lazarus ya no está disponible de SourceForge, así que aquí está cómo descargar la versión de desarrollo usando svn o git y construir el IDE. Necesitará svn (antes de MacOS 10.15 - Catalina) o git (después de MacOS 10.14 - Mojave) el cual se incluye con las herramientas de comando en línea de Xcode el cual debería ya haber instalado (ver arriba las Herramientas de Comando en Línea de Xcode).

Template:Notas sobre Construcción para Apple Silicon

Descargue las fuentes de la versión de desarrollo de Lazarus

cd
mkdir -p bin/lazarus
cd bin/lazarus

Usando git:

git clone -b main https://gitlab.com/freepascal.org/lazarus/lazarus.git laz_main

Usando svn:

svn checkout --depth files https://github.com/fpc/Lazarus/branches all
cd all
svn update --set-depth infinity main

La anterior llamada a svn es más compleja debido a un bug en muchas versiones de Subversion. Este ajuste ha sido el trabajo de Alfred (aka Don Alfredo en el Forum) y quien es el mago detrás de esto fpcupdeluxe.

Actualizando la fuente de la versión de desarrollo de Lazarus

Para actualizar su fuente de la versión de desarrollo de Lazarus.

Usando git:

cd ~/bin/lazarus/laz_main
git clean -f -d
git pull

Usando svn:

cd ~/bin/lazarus/laz_trunk
svn cleanup --remove-unversioned
svn update

Construyendo la fuente de la versión de desarrollo de Lazarus

make distclean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 ide

or, or bigger IDE:

make distclean all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide

Después de los siguientes comandos, espere algo de tiempo y:

open startlazarus.app --args "--pcp=~/.laz_dev"

Qué hace el argumento bigide?

The bigide make argument adds a bunch of packages to Lazarus that many find useful and cannot do without. The packages that are added are:

  • cairocanvas
  • chmhelp
  • datetimectrls
  • externhelp
  • fpcunit
  • fpdebug
  • instantfpc
  • jcf2
  • lazcontrols
  • lazdebuggers
  • lclextensions
  • leakview
  • macroscript
  • memds
  • onlinepackagemanager
  • pas2js
  • PascalScript
  • printers
  • projecttemplates
  • rtticontrols
  • sdf
  • sqldb
  • synedit
  • tachart
  • tdbf
  • todolist
  • turbopower_ipro
  • virtualtreeview

The above list is sourced from the [Lazarus source directory]/IDE/Makefile.fpc and may be subject to change.

Note that if you have not compiled your own Lazarus IDE with the bigide argument, you can install any of these packages yourself using the Lazarus IDE Package > Install/Uninstall Packages... dialog.

Instalando versions no-liberadas de FPC

Installing from source

There are two current non-release branches of the Free Pascal Compiler: the development (trunk) branch and the Fixes 3.2 branch which includes additional fixes to the released 3.2.2 version. Developers, and those who like living on the bleeding edge and testing new features and fixes, will choose the development version; more normal users, who wish to use a stable branch with some additional fixes since the latest release version, will choose the Fixes branch. The instructions below cover both these branches.

The source code is kept in a version control system called git:

  • macOS 10.5 and higher already contain a command line git client if you have installed the Xcode command line utilities.
  • You also need the latest released Free Pascal Compiler version (3.2.2 as of March 2022) installed in order to be able to successfully compile the development (trunk) version.
Light bulb  Note: When building a native aarch64 Free Pascal Compiler (ppca64) for an Apple Silicon M1 processor Mac, change the CPU_TARGET in the instructions below from x86_64 (Intel 64 bit) to aarch64 (ARM 64 bit - Apple Silicon M1) and change any reference to ppcx64 to ppca64

FPC development version

Note that since the development version of FPC (was known as "trunk" in SVN; now known as "main" in GIT) is by definition still under development, some of the features may still change before they end up in a release version.

Create a directory where you would like to put the source (eg fpc_main in your home directory). You don't need to be root to do this. Any normal user can do this. Open an Applications > Utilities > Terminal and do the following:

 []$ git clone -b main https://gitlab.com/freepascal.org/fpc/source.git fpc_main

This will create a directory called fpc_main and download the FPC main source to it.

To subsequently update your local source repository with the latest source changes you can simply do:

 []$ cd
 []$ cd fpc_main
 []$ git clean -f -d
 []$ git pull

To build and install FPC (the highlighted text should be all on one line):

 []$ cd
 []$ cd fpc_main
 []$ make distclean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"
 []$ sudo make install FPC=$PWD/compiler/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64

You will also need to update the links for the compiler in /usr/local/bin which will be pointing to the previous FPC version. For example:

 []$ cd /usr/local/bin
 []$ sudo rm ppc386
 []$ sudo rm ppcx64
 []$ sudo ln -s /usr/local/lib/fpc/3.3.1/ppc386
 []$ sudo ln -s /usr/local/lib/fpc/3.3.1/ppcx64

Note that you will need to build a new ppc386 compiler if you want to continue to compile 32 bit applications by replacing these lines (this is not be possible after Xcode 11.3.1 and macOS 10.14.6 Mojave because of Apple's removal of the 32 bit frameworks):

 []$ make clean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"
 []$ sudo make install FPC=$PWD/compiler/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64

with these two lines:

 []$ make clean all FPC=/usr/local/lib/fpc/3.2.2/ppc386 OS_TARGET=darwin CPU_TARGET=i386 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"
 []$ sudo make install FPC=$PWD/compiler/ppc386 OS_TARGET=darwin CPU_TARGET=i386

FPC Fixes 3.2

Create a directory where you would like to put the source (eg fpc_fixes32 in your home directory). You don't need to be root to do this. Any normal user can do this. Open an Applications > Utilities > Terminal and do the following:

 []$ git clone -b fixes_3_2 https://gitlab.com/freepascal.org/fpc/source.git fpc_fixes32

This will create a directory called fpc_fixes32 and download the FPC source to it.

To subsequently update your local copy of the repository source with the latest source changes you can simply do:

 []$ cd fpc_fixes32
 []$ git clean -f -d
 []$ git pull

To build and install FPC (the highlighted text should be all on one line):

 []$ cd
 []$ cd fpc_fixes32
 []$ make distclean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"
 []$ sudo make install FPC=$PWD/compiler/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64

You will also need to update the links for the compiler in /usr/local/bin which will be pointing to the previous FPC version. For example:

 []$ cd /usr/local/bin
 []$ sudo rm ppc386
 []$ sudo rm ppcx64
 []$ sudo ln -s /usr/local/lib/fpc/fixes-3.2/ppc386
 []$ sudo ln -s /usr/local/lib/fpc/fixes-3.2/ppcx64

Note that you will need to build a new ppc386 compiler if you want to continue to compile 32 bit applications by replacing these lines (this may not be possible after Xcode 11.3.1 and macOS 10.14.6 Mojave because of Apple's removal of the 32 bit frameworks):

 []$ make clean all FPC=/usr/local/lib/fpc/3.2.2/ppc386 OS_TARGET=darwin CPU_TARGET=i386 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"
 []$ sudo make install FPC=$PWD/compiler/ppc386 OS_TARGET=darwin CPU_TARGET=i386

Problemas conocidos y soluciones

Problema al reconstruir Lazarus IDE v2.2.0

Cualquier intento de reconstruir el IDE de Lazarus desde sí mismo fallará con los errores de permiso porque los archivos y directorios le pertenecen a un usuario con el id de 503 mientras que muchos usuarios encontrarán que su id es 501. La solución es abrir una Terminal (Aplicaciones > Utilidades > Terminal) y:


cd /Applications
sudo chown -R your_username Lazarus

Los siguientes errores en reconstrucción no ocurren en los computadores Intel

El siguiente error que ocurre es que el compilador de recursos "fpcres" no se encuentra. La solución es crear un archivo .fpc.cfg (nótese el punto inicial) en su directorio home y agregar las siguientes líneas en él:


#include /etc/fpc.cfg
-FD/usr/local/bin

de tal forma que se pueda encontrar "fpcres" donde se instaló.

El siguiente error se muestra por una arquitectura target no soportada -Paarch64, con el consejo de invocar el driver de compilador "fpc" en su lugar - excepto que eso es lo que ya hemos hecho. La solución es ir a Lazarus > Preferencias > Ejecutable de Compilador el cual se pone como /usr/local/bin/fpc y se deberá cambiar por /usr/local/lib/fpc/3.2.2/ppca64 en su lugar.

El IDE será ahora reconstruido exitosamente pero no reiniciará de forma automática. Intentando entonces iniciar Lazarus desde el icono de startlazarus.app o el icono lazarus.app en /Applications/Lazarus todavía resulta en el binario original de Intel siendo lanzado. El binario correcto para aarch64 puede encontrarse en ~/.lazarus/bin/aarch64-darwin/lazarus. Así que la solución final es abrir una Application > Utilities > Terminal y:

mv /Applications/Lazarus/lazarus /Applications/Lazarus/lazarus.old
mv  ~/.lazarus/bin/aarch64-darwin/lazarus /Applications/Lazarus/

Puedes entonces iniciar el IDE mediante los iconos startLazarus.app o lazarus.app. Cuando reincide Lazarus, merece que ponga nuevamente el ejecutable del compilador Lazarus > Preferencias > Ejecutable del Compilador a /usr/local/lib/fpc/3.2.2/ppca64 y colocarlo nuevamente a /usr/local/bin/fpc de tal forma que pueda compilar binarios para aarch64 e Intel, por ejemplo, crear un Universal Binary el cual se ejecutará tanto en máquinas Intel y aarch64.

Lazarus IDE - Unable to "run without debugging"

If you are using the Lazarus IDE 2.0.10 and the Run > Run without debugging menu option fails with a dialog similar to:

run dialog fail.png

then you need to patch the Lazarus 2.0.10 source code (Issue #37324 and Issue #36780). Specifically, patch ../ide/main.pp as below (unpatched lines shown first, patched lines shown second):

 7243,7245c7243,7245
 <     if RunAppBundle
 <         and FileExistsUTF8(Process.Executable)
 <     and FileExistsUTF8('/usr/bin/open') then
 ---
 >     if RunAppBundle then
 >     //    and FileExistsUTF8(Process.Executable)
 >     //and FileExistsUTF8('/usr/bin/open') then

and recompile the Lazarus IDE.

Alternatively, you can omit patching the source code and simply recompile Lazarus 2.0.10 with FPC 3.0.4.

A similar patching exercise and recompiling, or simply recompiling with FPC 3.0.4, needs to be done for Lazarus 2.0.8 if it has been compiled with FPC 3.2.0.

Upgrading from Mojave (10.14) to Catalina (10.15)

  • Run sudo xcode-select --install
  • To enable Lazarus to locate the crt1.10.5.o file change in /etc/fpc.cfg the -Fl behind "#ifdef cpux86_64" from
-Fl/Applications/Xcode.app/Contents/Developer/Toolchain...

to

-Fl/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/

Building the FPC compiler from Mojave (10.14) onwards

  • To find the crt1.10.5.o file when building a later Free Pascal Compiler version from source, you need to specify:
 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"

on the make command line because FPC ignores the /etc/fpc.cfg configuration file during builds of itself.

Mac Installation FAQ

  • See the Mac Installation FAQ for solutions to other common problems that may arise during (and after) installation of Lazarus and Free Pascal on macOS.

Uninstalling Lazarus and Free Pascal

Refer to Uninstalling Lazarus on macOS for uninstallation options.

Legacy Information

See Legacy Information for details of:

  • Installing Lazarus on Mac OS X 10.4 (Tiger), Mac OS X 10.5 (Leopard), OS X 10.8 (Mountain Lion)
  • Installing Lazarus 2.0.8, 2.0.10 with FPC 3.2.0 for macOS 10.10 and earlier
  • Installing Lazarus 2.0.8 with FPC 3.2.0 for macOS 10.11+
  • Installing Lazarus on PowerPC-based Macs
  • Old Xcode versions
  • Installing the gdb debugger
  • Compatibility matrix for Lazarus 1.0.0 through 1.6.4 and FPC 2.6.0 through 3.0.2.

See also

External links