Difference between revisions of "Installing Lazarus on Windows"

From Lazarus wiki
Jump to navigationJump to search
(→‎Installing Lazarus from sources on Windows: Remove reference to defunct git-svn (Needs Updating for SVN -> Git transition)
 
(25 intermediate revisions by 4 users not shown)
Line 6: Line 6:
  
 
The current releases of the Windows Lazarus installer packages install very easily, and should work 'out-of-the-box'.  
 
The current releases of the Windows Lazarus installer packages install very easily, and should work 'out-of-the-box'.  
 +
 +
Do not install into the standard program folder <tt>c:\Program Files</tt> because access to it is restricted. Moreover, it is recommended to avoid spaces in the folder name because it may confuse some tools used by Lazarus.
 +
 +
If you already have another Lazarus version on your system it is recommended to keep the old version and to keep it separate from the new installation. For this purpose Lazarus offers to write its configuration files into a specific directory so that both versions can coexist. See section [[#Preparation_for_the_first_start|Preparation for the first start]] below.
  
 
Upgrading can be as simple as downloading the new installer and running it. You will be taken through a typical Windows installation wizard to install the FPC compiler and FPC source within the same directory structure as Lazarus IDE, and Lazarus should launch and operate without significant problems, provided you have '''uninstalled''' any previous version of Lazarus and/or FPC which was not installed with a recent version fo the Windows installer (older installations can often be found in the C:\pp directory).
 
Upgrading can be as simple as downloading the new installer and running it. You will be taken through a typical Windows installation wizard to install the FPC compiler and FPC source within the same directory structure as Lazarus IDE, and Lazarus should launch and operate without significant problems, provided you have '''uninstalled''' any previous version of Lazarus and/or FPC which was not installed with a recent version fo the Windows installer (older installations can often be found in the C:\pp directory).
  
You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]].
+
<!-- You can also use a Lazarus Snapshot. For download locations see [[Lazarus Snapshots Downloads]]. -->
 +
 
 +
{{Tip|It's perhaps a good idea to reboot your Windows system after you have installed Lazarus and before you try to install additional Lazarus components such as zeoslib for example.}}
 +
 
 +
== Installing Lazarus on a Portable USB device ==
 +
 
 +
It is even possible to install the whole Lazarus/FPC package on a portable USB drive or memory stick (capacity at least 256 MB), for use in environments where you are not allowed to install software on your Windows workstation or where you do not have administrator privileges. You do have to be very careful about adjusting the paths in the compiler and environment options and the <tt>fpc.cfg</tt> file. 
 +
 
 +
Helpfully there is a third-party Lazarus application [https://github.com/JoeJoeTV/startLazarusPortable startLazarusPortable] available on GitHub in both source and compiled form to take care of this for you. startLazarusPortable is a launcher application that starts Lazarus from a folder/portable USB device and makes all the necessary configuration changes for you.
 +
 
 +
See also [https://forum.lazarus.freepascal.org/index.php/topic,46436.msg393696.html#msg393696 this forum post] which (as of early February 2020) contains a fix for when you have added some packages to the Lazarus IDE from the online repository.
 +
 
 +
== Installing Lazarus from sources on Windows ==
 +
 
 +
The following instructions are for both SubVersioN and Git repository of the Lazarus IDE.  If you are not planning to follow the development source, just want a one-off, you can download a zip file of the Lazarus development source.
 +
 
 +
It is assumed that the following installations will go into folders appropriately named <tt>c:\Lazarus-fixes22</tt> or <tt>c:\Lazarus-dev</tt>. Of course any other folder names can be used provided that they do not contain spaces or non-ASCII characters, and that the folders are fully writeable by the user. Do NOT install into <tt>c:\Program files</tt> which is not fully writeable by a user.
 +
 
 +
=== Getting the Lazarus sources by using TortoiseSVN ===
 +
 
 +
The easiest way to work with svn is by using the TortoiseSVN application (https://tortoisesvn.net/index.de.html). Install this application if you do not have it already. It adds short-cuts to the Explorer context menu from which you can work with svn easily.
 +
 
 +
To download the Lazarus fixes 2.2 sources create the folder <tt>c:\Lazarus-fixes22</tt> and right-click on it in  Explorer. In the context menu open the command ''SVN Checkout...''. Enter the ''URL of the SVN repository'' in the corresponding box. This is:
 +
 +
* <nowiki>https://github.com/fpc/Lazarus/branches/fixes_2_2</nowiki> for the fixes version (adjust the version number in the <tt>fixes22</tt> folder name for the current version).
 +
 +
Make sure that the ''Checkout directory'' box contains the directory in which you want to have the new Lazarus version (<tt>c:\Lazarus-fixes22</tt> in our example). After pressing OK the source files are downloaded which will take some time.
 +
 
 +
Note: svn checkout of the development version (aka trunk in svn or or main in git) is problematical due to an svn bug. See below using command line svn.
 +
 
 +
=== Getting the Lazarus sources from the command line ===
 +
 
 +
Alternatively you can also download the sources from the command line if you have the command line version of SVN (https://subversion.apache.org/packages.html#windows) or GIT (https://gitforwindows.org/) on your system.
 +
 
 +
==== Downloading Lazarus "fixes" version source ====
 +
 
 +
[[Lazarus_2.2_fixes_branch|Details of the fixes]] included in the Lazarus 2.2 fixes version. Here are the steps to follow to download the fixes source:
 +
 
 +
* Open a command prompt window
 +
 
 +
* Create a folder for the new Lazarus:
 +
 
 +
  md c:\Lazarus-fixes22
 +
 
 +
* Change into this folder:
 +
 +
  cd c:\Lazarus-fixes22
 +
 
 +
Using git:
 +
 
 +
  <nowiki>git clone -b fixes_2_2 https://gitlab.com/freepascal.org/lazarus/lazarus.git .</nowiki>
 +
 
 +
Using svn:
 +
 
 +
  <nowiki>svn checkout https://github.com/fpc/Lazarus/branches/fixes_2_2 .</nowiki>
 +
 
 +
* The download will take some time. Be patient.
 +
 
 +
==== Downloading Lazarus development version source ====
  
Tip: It's perhaps a good idea to reboot your Windows system after you have installed Lazarus and before you try to install additional Lazarus components such as zeoslib for example.
+
Here are the steps to follow to download the development  (was known as "trunk" in SVN; now known as "main" in GIT) version source of the Lazarus IDE using svn or git:
  
== Installing Lazarus on a Portable USB Drive ==
+
* Open a command prompt window
  
It is even possible to install the whole Lazarus/FPC package on a portable USB drive (capacity at least 256 MB), for use in environments where you are not allowed to install software on your Windows workstation or where you haven't got administrator privileges. You do have to be a little careful about adjusting the paths in the compiler and environment options and the <tt>fpc.cfg</tt> file.  It may also be necessary to keep the directory for test compilation on your portable drive.
+
* Create a folder for the new Lazarus:
  
Q:DOES ANYONE KNOW HOW TO SET UP RELATIVE PATHS IN THESE TAGS AND FILES, SO THAT THE ADDRESSING WORKS WHEN YOU MOVE THE USB DEVICE TO ANOTHER MACHINE WHERE IT HAS A DIFFERENT DRIVE LETTER?
+
  md c:\Lazarus-dev
  
A: This is what I do. It's relatively convoluted, but it's the best solution I've found. I have a "bin" directory on my USB drive, where I have several scripts and utilities installed. Inside that directory is a batch file called "setenv.bat" which sets an environment variable called THUMBDRIVE. It is set by using this command in the batch file:
+
* Change into this folder:  
 +
 +
  cd c:\Lazarus-dev
  
<syntaxhighlight lang="dos">set THUMBDRIVE=%CD:~0,2%</syntaxhighlight>
+
Using git:
  
This is used in setenv.bat to set some paths to other things I have installed on the USB drive. I also have a link in the root directory of the thumb drive with this property:
+
  <nowiki>git clone -b main https://gitlab.com/freepascal.org/lazarus/lazarus.git .</nowiki>
  
<syntaxhighlight lang="dos">%SystemRoot%\system32\cmd.exe /k bin\setenv</syntaxhighlight>
+
Using svn (due to an svn bug, this is a two step process):
  
so that when I click on that link when the thumb drive folder is displayed after inserting it, it will open a command prompt at the thumb drive with the environment variables set from <tt>setenv.bat</tt>.
+
  <nowiki>svn checkout --depth files https://github.com/fpc/Lazarus/branches .</nowiki>
 +
  svn update --set-depth infinity main
  
Also inside the bin directory is [http://sed.sf.net sed] (the actual binary is one I obtained from the mingw distribution). So I created another batch file called <tt>fixlaz.bat</tt> which takes one argument, the drive letter which is currently in the Lazarus/FPC settings files that you want to change (note that this is the previous drive letter the last time you ran <tt>fixlaz.bat</tt>, not the current one of your USB drive which <tt>fixlaz.bat</tt> already knows). You will need to create this batch file to fit where you installed Lazarus in the root directory structure of the drive if you didn't install it directly in the root folder, and then repeat these lines also for the <tt>editoroptions.xml</tt> and <tt>fpc.cfg</tt> files (<tt>fpc.cfg</tt> is in the fpc bin directory, which might be buried deep in the lazarus folder):
+
* The download will take some time. Be patient.
  
<syntaxhighlight lang="dos">
+
=== Getting the Lazarus sources from a snapshot ===
copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
+
 
sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml
+
A snapshot of the Lazarus development version source is available from the official GitLab repository. You can download it through the Gitlab web interface at https://gitlab.com/freepascal.org/lazarus/lazarus. Alternatively, you can fetch it from https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.zip.
</syntaxhighlight>
 
  
So to use it, I would type at the command prompt of the USB drive:
+
Other, previously available snapshot 'servers', are mentioned here [[Lazarus Snapshots Downloads|snapshot servers]]. Not recommended.
  
<syntaxhighlight lang="dos">fixlaz G:</syntaxhighlight>
+
Unzip the downloaded archive to the folder in which you want Lazarus to be installed, eg <tt>c:\lazarus-dev</tt>.
  
if "G:" was the previous drive letter used the last time I ran it. This will then scan the file(s) and replace "G:" with the current drive letter of the USB drive, which is in the %THUMBDRIVE% environment variable (after running <tt>setenv.bat</tt>). Note that you could write it to save the current drive letter in a separate file, so that you wouldn't have to remember it yourself the next time. But this works well enough for me right now.
+
=== Building Lazarus ===
  
== From source on Windows using svn on the command line ==
+
Prerequisite for building Lazarus is that a recent FPC installation must be available. "Recent version" means:
  
Please note these instructions are for SubVersion, but there is also a Git mirror repository of Free Pascal Compiler and Lazarus. See [[git mirrors|Git mirror]] for details. You can also use git directly with SubVersion server using git-svn link. See [[Lazarus git-svn|Lazarus git-svn]] for details.
+
* the current FPC release;  
 +
* the previous release version;
 +
* the FPC fixes version; or
 +
* the FPC development version.
  
Open a command prompt window. Start->Run...>CMD or choose the MS-DOS icon. You will use this window to enter the commands below.
+
If you already have a Lazarus release installation on your disk - here you can find the FPC in the equally named folder of the installation directory. Make sure that the FPC version number is adequate. If not, install a newer Lazarus release (which is always recommended). Or, of course, you can also install FPC separately. You are also strongly recommended to install the FPC source as well, not absolutely essential but very handy.
  
You have to download the Lazarus source from one of the [[Lazarus Snapshots Downloads|snapshot servers]]. Then unzip it to <tt>c:\lazarus</tt> for example [below called <tt>$(LazarusDir)</tt>].
+
You should also be aware that the bitness of the FPC determines the bitness of the Lazarus IDE and the bitness of the applications that you will create. So, when your fpc.exe resides in a folder <tt>i386_win32</tt> the IDE (and your applications) will be 32-bit. When the folder is <tt>x86_64-win64</tt> the IDE (and your applications) will be 64-bit.
  
Or you can use SVN (example for text mode SVN):
+
* Remember the full path to the folder containing <tt>fpc.exe</tt> and use it in the following batch file.
 +
* Change to the folder into which you downloaded the source files and create a batch file with the following content
  
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
mkdir c:\lazarus
+
set path=c:\freepascal\bin\x86_64-win64
cd /d c:\lazarus
+
:: Of course change this path variable to the path of your FPC compiler
svn checkout https://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus
+
make bigide
 
</syntaxhighlight>
 
</syntaxhighlight>
  
You have to install at least the latest stable FPC version (eg FPC 3.2.0 as at Jan 2021).  
+
* Executing this batch file will build a Lazarus containing all the basic packages, like in a release version. (Of course you must install any other third-party packages by yourself later.)
 
+
* if using Powershell, try these commands (this time assuming your FPC is in c:\FPC\3.2.2 - typical of a recent install) -
Type (replace "YourLazarusDir" with the path you have unzipped/checked out Lazarus; replace:  
+
<syntaxhighlight lang=dos>$env:PATH="c:\FPC\3.2.2\bin\i386-win32"
 +
make bigide
 +
</syntaxhighlight>
 +
* Since the Lazarus development version (trunk in svn, main in git) is not "stable" it may happen that the "bigide" version cannot be build due to an error in one of the standard packages. In this case it may be helpful to know that the basic IDE (with LCL only) can be built by using the <tt>make</tt> command without the <tt>bigide</tt> parameter:
  
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
cd "YourLazarusDir"
+
set path=c:\freepascal\bin\x86_64-win64
rem Of course change the first path variable to
+
:: Of course change this path variable to the path of your FPC compiler
rem the path of your FPC compiler
 
set path=c:\freepascal\bin\x86_64-win64;%PATH%
 
 
make
 
make
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* Windows 98 and Windows ME need a special flag to compile. You need to use make <tt>OPT="-dWIN9XPLATFORM"</tt> otherwise the lazarus.exe will not be able to run on these operating systems.
+
* Because the Lazarus IDE by default links to a dll-call "CreateToolhelp32Snapshot", which does not exist on the Win9x platform, the IDE will not run on Win9x out of the box. In order to make it run you have to rebuild the IDE with <tt>make -dWIN9XPLATFORM bigide</tt>.
 +
* Compilation will take some time again. At the end, the new IDE is ready, but you should not start it yet -- read the next section first.
 +
 
 +
=== Preparation for the first start ===
  
If you have followed this successfully, you can now type: <tt>lazarus.exe</tt> which should start the Lazarus IDE.  
+
Before you start the new IDE you should make sure that it does not interfere with your current other Lazarus installation(s). For this purpose you must have a separate directory for the Lazarus configuration files, maybe <tt>c:\LazConfigs\trunk</tt>. Lazarus writes is configuration settings to this folder if you open the <tt>lazarus.exe</tt> with the argument <tt>--primary-config-path=c:\LazConfigs\dev</tt>, or shorter, <tt>--pcp=c:\LazConfigs\dev</tt>. When this parameter is missing the configuration files are read from and written to the default folder in <tt>c:\users\<your_name>\appdata\lazarus</tt> which will very probably change settings of the other installation.
  
You can also compile the examples:
+
Since it is easy to forget this command line parameter it is highly recommended to add a file <tt>lazarus.cfg</tt> to the lazarus installation folder (the folder containing <tt>lazarus.exe</tt>) in which the pcp parameter is listed. This is also how the Lazarus release versions handle secondary installations.
  
<syntaxhighlight lang="dos">
+
<syntaxhighlight lang="dos" inline>echo "--pcp=c:\LazConfigs\trunk" > lazarus.cfg </syntaxhighlight>{{keypress|enter}}
cd "YourLazarusDir"\examples
+
 
make
+
Starting Lazarus in the directory containing that <tt>lazarus.cfg</tt> file will ensure Lazarus keeps its config files in the nominated directory.
</syntaxhighlight>
+
 
 +
Alternatively you can also start the IDE from the desktop short-cut which has the <tt>--pcp=...</tt> as an argument.
 +
 
 +
=== First start of the IDE ===
 +
 
 +
When you start the new IDE for the first time probably there will be an error message saying that the FPC and the debugger cannot be found. In this error dialog, navigate to the folder which you had used as the path to build the IDE, and select the <tt>fpc.exe</tt>. As for the debugger, navigate to the <tt>mingw</tt> folder of your Lazarus release installation (or install gdb separately) and select the <tt>gdb.exe</tt>. There may also be a message about an issue with the fppkg configuration - click "Restore fppkg configuration" to resolve this. If subsequent error messages appear they can be ignored.
 +
 
 +
Now the IDE will be happy and you can start using your new Lazarus trunk (or fixes) IDE.
 +
 
 +
=== Updating the installed version ===
 +
 
 +
It is the advantage of a version-control system such as git and svn that it is very easy to update the installed source version with any subsequent changes.
 +
 
 +
==== svn ====
  
== From source on Windows using the GUI Tortoise SVN ==
+
* If you used TortoiseSVN right-click on the installation folder of this Lazarus and select ''SVN Update'' from the context menu.
 +
* If you prefer the console change directory (cd) to the installation folder and type <tt>svn update</tt>, or <tt>svn up</tt>
  
1> First of all install the latest stable Lazarus to obtain a good starting FPC, for example in <tt>C:\lazarus_2_0_10</tt>.
+
==== git ====
  
2> Now use TortoiseSVN to checkout <tt>http://svn.freepascal.org/svn/lazarus/trunk/ into c:\lazarus</tt>
+
If you used git:
  
3> Make the following <tt>C:\lazarus\build.bat</tt> batch file:
+
* Open a command prompt
 +
* cd to the installation folder and type <tt>git pull</tt>
  
Replace <tt>$(LazarusDir)</tt> with your Lazarus directory and make sure the FPC version number matches
+
The download now is very fast because only the differences to the local installation must be fetched.
  
<syntaxhighlight lang="dos">
+
Then start the IDE, go to ''Tools'' > ''Build Lazarus with profile...'' and recompile the IDE. It may happen that compilation aborts with some error; in this case go to ''Tools'' > ''Configure Build Lazarus'', select ''Clean all'' and ''Switch after building to automatically'' in the "Clean up" box, and click ''Build''.
SET PATH=$(LazarusDir)\fpc\3.2.0\bin\i386-win32\
 
make bigide
 
</syntaxhighlight>
 
  
Now create a shortcut on your desktop to start Lazarus and put the following command to start Lazarus which will make sure that it separates the config files from the stable and the SVN versions:
+
=== Help: The new IDE does not start ===
  
<syntaxhighlight lang="dos">$(LazarusDir)\startlazarus.exe --pcp=$(LazarusDir)\configdir </syntaxhighlight>
+
In very rare cases the new sources contain a fatal error so that the IDE does not start successfully.
  
Always start Lazarus from this shortcut, never directly from the executable. The first time you start Lazarus configure your FPC dir, FPC source directory and Lazarus directory.
+
For this case you must know that the IDE always keeps a backup copy, called <tt>lazarus.exe.old</tt>. Simply delete the newly created <tt>lazarus.exe</tt> and rename <tt>lazarus.exe.old</tt> to <tt>lazarus.exe</tt>. Now you are back to work, at least with the old version.  
  
'''Building Lazarus on Win98 and WinME'''
+
Try the installation later again, usually such catastrophic bugs are soon detected, reported and fixed.
  
Because the Lazarus IDE by default links to a dll-call "CreateToolhelp32Snapshot", which does not exist on the Win9x platform, the IDE will not run on Win9x out of the box. In order to make it run you have to rebuild the IDE with <tt>make -dWIN9XPLATFORM bigide</tt>.
+
If you used TortoiseSVN you may want to right-click on the Lazarus installation folder and select ''SVN Show Log'' from the context menu to see the commit notes of the recent changes and to learn whether the bug already has been fixed.
  
== What does the ''bigide'' <tt>make</tt> argument do? ==
+
If you used command line git, you can change to the source folder and type <tt>git log {{keypress|&#124;}} more</tt>  
 +
to see the commit notes of the recent changes and to learn whether the bug already has been fixed.
  
 +
=== What does the ''bigide'' <tt>make</tt> argument do? ===
 
{{BigIDE}}
 
{{BigIDE}}
  

Latest revision as of 07:19, 13 January 2022

Windows logo - 2012.svg

This article applies to Windows only.

See also: Multiplatform Programming Guide

Using the Windows Installer

By far the easiest and most common way to install Lazarus on Windows is to go to the official Lazarus SourceForge download site select an appropriate combined FPC/Lazarus installation package, download the latest release and launch the installer.

The current releases of the Windows Lazarus installer packages install very easily, and should work 'out-of-the-box'.

Do not install into the standard program folder c:\Program Files because access to it is restricted. Moreover, it is recommended to avoid spaces in the folder name because it may confuse some tools used by Lazarus.

If you already have another Lazarus version on your system it is recommended to keep the old version and to keep it separate from the new installation. For this purpose Lazarus offers to write its configuration files into a specific directory so that both versions can coexist. See section Preparation for the first start below.

Upgrading can be as simple as downloading the new installer and running it. You will be taken through a typical Windows installation wizard to install the FPC compiler and FPC source within the same directory structure as Lazarus IDE, and Lazarus should launch and operate without significant problems, provided you have uninstalled any previous version of Lazarus and/or FPC which was not installed with a recent version fo the Windows installer (older installations can often be found in the C:\pp directory).


Note-icon.png

Tip: It's perhaps a good idea to reboot your Windows system after you have installed Lazarus and before you try to install additional Lazarus components such as zeoslib for example.

Installing Lazarus on a Portable USB device

It is even possible to install the whole Lazarus/FPC package on a portable USB drive or memory stick (capacity at least 256 MB), for use in environments where you are not allowed to install software on your Windows workstation or where you do not have administrator privileges. You do have to be very careful about adjusting the paths in the compiler and environment options and the fpc.cfg file.

Helpfully there is a third-party Lazarus application startLazarusPortable available on GitHub in both source and compiled form to take care of this for you. startLazarusPortable is a launcher application that starts Lazarus from a folder/portable USB device and makes all the necessary configuration changes for you.

See also this forum post which (as of early February 2020) contains a fix for when you have added some packages to the Lazarus IDE from the online repository.

Installing Lazarus from sources on Windows

The following instructions are for both SubVersioN and Git repository of the Lazarus IDE. If you are not planning to follow the development source, just want a one-off, you can download a zip file of the Lazarus development source.

It is assumed that the following installations will go into folders appropriately named c:\Lazarus-fixes22 or c:\Lazarus-dev. Of course any other folder names can be used provided that they do not contain spaces or non-ASCII characters, and that the folders are fully writeable by the user. Do NOT install into c:\Program files which is not fully writeable by a user.

Getting the Lazarus sources by using TortoiseSVN

The easiest way to work with svn is by using the TortoiseSVN application (https://tortoisesvn.net/index.de.html). Install this application if you do not have it already. It adds short-cuts to the Explorer context menu from which you can work with svn easily.

To download the Lazarus fixes 2.2 sources create the folder c:\Lazarus-fixes22 and right-click on it in Explorer. In the context menu open the command SVN Checkout.... Enter the URL of the SVN repository in the corresponding box. This is:

  • https://github.com/fpc/Lazarus/branches/fixes_2_2 for the fixes version (adjust the version number in the fixes22 folder name for the current version).

Make sure that the Checkout directory box contains the directory in which you want to have the new Lazarus version (c:\Lazarus-fixes22 in our example). After pressing OK the source files are downloaded which will take some time.

Note: svn checkout of the development version (aka trunk in svn or or main in git) is problematical due to an svn bug. See below using command line svn.

Getting the Lazarus sources from the command line

Alternatively you can also download the sources from the command line if you have the command line version of SVN (https://subversion.apache.org/packages.html#windows) or GIT (https://gitforwindows.org/) on your system.

Downloading Lazarus "fixes" version source

Details of the fixes included in the Lazarus 2.2 fixes version. Here are the steps to follow to download the fixes source:

  • Open a command prompt window
  • Create a folder for the new Lazarus:
 md c:\Lazarus-fixes22
  • Change into this folder:
 cd c:\Lazarus-fixes22

Using git:

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

Using svn:

 svn checkout https://github.com/fpc/Lazarus/branches/fixes_2_2 .
  • The download will take some time. Be patient.

Downloading Lazarus development version source

Here are the steps to follow to download the development (was known as "trunk" in SVN; now known as "main" in GIT) version source of the Lazarus IDE using svn or git:

  • Open a command prompt window
  • Create a folder for the new Lazarus:
 md c:\Lazarus-dev
  • Change into this folder:
 cd c:\Lazarus-dev

Using git:

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

Using svn (due to an svn bug, this is a two step process):

 svn checkout --depth files https://github.com/fpc/Lazarus/branches .
 svn update --set-depth infinity main
  • The download will take some time. Be patient.

Getting the Lazarus sources from a snapshot

A snapshot of the Lazarus development version source is available from the official GitLab repository. You can download it through the Gitlab web interface at https://gitlab.com/freepascal.org/lazarus/lazarus. Alternatively, you can fetch it from https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.zip.

Other, previously available snapshot 'servers', are mentioned here snapshot servers. Not recommended.

Unzip the downloaded archive to the folder in which you want Lazarus to be installed, eg c:\lazarus-dev.

Building Lazarus

Prerequisite for building Lazarus is that a recent FPC installation must be available. "Recent version" means:

  • the current FPC release;
  • the previous release version;
  • the FPC fixes version; or
  • the FPC development version.

If you already have a Lazarus release installation on your disk - here you can find the FPC in the equally named folder of the installation directory. Make sure that the FPC version number is adequate. If not, install a newer Lazarus release (which is always recommended). Or, of course, you can also install FPC separately. You are also strongly recommended to install the FPC source as well, not absolutely essential but very handy.

You should also be aware that the bitness of the FPC determines the bitness of the Lazarus IDE and the bitness of the applications that you will create. So, when your fpc.exe resides in a folder i386_win32 the IDE (and your applications) will be 32-bit. When the folder is x86_64-win64 the IDE (and your applications) will be 64-bit.

  • Remember the full path to the folder containing fpc.exe and use it in the following batch file.
  • Change to the folder into which you downloaded the source files and create a batch file with the following content
set path=c:\freepascal\bin\x86_64-win64
:: Of course change this path variable to the path of your FPC compiler
make bigide
  • Executing this batch file will build a Lazarus containing all the basic packages, like in a release version. (Of course you must install any other third-party packages by yourself later.)
  • if using Powershell, try these commands (this time assuming your FPC is in c:\FPC\3.2.2 - typical of a recent install) -
$env:PATH="c:\FPC\3.2.2\bin\i386-win32"
make bigide
  • Since the Lazarus development version (trunk in svn, main in git) is not "stable" it may happen that the "bigide" version cannot be build due to an error in one of the standard packages. In this case it may be helpful to know that the basic IDE (with LCL only) can be built by using the make command without the bigide parameter:
set path=c:\freepascal\bin\x86_64-win64
:: Of course change this path variable to the path of your FPC compiler
make
  • Because the Lazarus IDE by default links to a dll-call "CreateToolhelp32Snapshot", which does not exist on the Win9x platform, the IDE will not run on Win9x out of the box. In order to make it run you have to rebuild the IDE with make -dWIN9XPLATFORM bigide.
  • Compilation will take some time again. At the end, the new IDE is ready, but you should not start it yet -- read the next section first.

Preparation for the first start

Before you start the new IDE you should make sure that it does not interfere with your current other Lazarus installation(s). For this purpose you must have a separate directory for the Lazarus configuration files, maybe c:\LazConfigs\trunk. Lazarus writes is configuration settings to this folder if you open the lazarus.exe with the argument --primary-config-path=c:\LazConfigs\dev, or shorter, --pcp=c:\LazConfigs\dev. When this parameter is missing the configuration files are read from and written to the default folder in c:\users\<your_name>\appdata\lazarus which will very probably change settings of the other installation.

Since it is easy to forget this command line parameter it is highly recommended to add a file lazarus.cfg to the lazarus installation folder (the folder containing lazarus.exe) in which the pcp parameter is listed. This is also how the Lazarus release versions handle secondary installations.

echo "--pcp=c:\LazConfigs\trunk" > lazarus.cfg Enter

Starting Lazarus in the directory containing that lazarus.cfg file will ensure Lazarus keeps its config files in the nominated directory.

Alternatively you can also start the IDE from the desktop short-cut which has the --pcp=... as an argument.

First start of the IDE

When you start the new IDE for the first time probably there will be an error message saying that the FPC and the debugger cannot be found. In this error dialog, navigate to the folder which you had used as the path to build the IDE, and select the fpc.exe. As for the debugger, navigate to the mingw folder of your Lazarus release installation (or install gdb separately) and select the gdb.exe. There may also be a message about an issue with the fppkg configuration - click "Restore fppkg configuration" to resolve this. If subsequent error messages appear they can be ignored.

Now the IDE will be happy and you can start using your new Lazarus trunk (or fixes) IDE.

Updating the installed version

It is the advantage of a version-control system such as git and svn that it is very easy to update the installed source version with any subsequent changes.

svn

  • If you used TortoiseSVN right-click on the installation folder of this Lazarus and select SVN Update from the context menu.
  • If you prefer the console change directory (cd) to the installation folder and type svn update, or svn up

git

If you used git:

  • Open a command prompt
  • cd to the installation folder and type git pull

The download now is very fast because only the differences to the local installation must be fetched.

Then start the IDE, go to Tools > Build Lazarus with profile... and recompile the IDE. It may happen that compilation aborts with some error; in this case go to Tools > Configure Build Lazarus, select Clean all and Switch after building to automatically in the "Clean up" box, and click Build.

Help: The new IDE does not start

In very rare cases the new sources contain a fatal error so that the IDE does not start successfully.

For this case you must know that the IDE always keeps a backup copy, called lazarus.exe.old. Simply delete the newly created lazarus.exe and rename lazarus.exe.old to lazarus.exe. Now you are back to work, at least with the old version.

Try the installation later again, usually such catastrophic bugs are soon detected, reported and fixed.

If you used TortoiseSVN you may want to right-click on the Lazarus installation folder and select SVN Show Log from the context menu to see the commit notes of the recent changes and to learn whether the bug already has been fixed.

If you used command line git, you can change to the source folder and type git log | more to see the commit notes of the recent changes and to learn whether the bug already has been fixed.

What does the bigide make argument do?

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.

Multiple Lazarus installs

Please see Multiple Lazarus for details on having more than one Lazarus version installed on one system. We cover issues that can arise due to multiple Lazarus installs here, because they can also happen when installing over a previous version.

Troubleshooting

Troubleshooting details that should (hopefully) be applicable across platforms may be found in the article Installation Troubleshooting.

Lazarus FAQ

The Lazarus FAQ - Frequently Asked Questions - page is available here.

Installing old versions

See Installation hints for old versions

See also