Difference between revisions of "Installing Lazarus"

From Free Pascal wiki
(Installing Free Pascal under FreeBSD/auto)
(Add See also section)
 
(89 intermediate revisions by 13 users not shown)
Line 3: Line 3:
 
== Overview ==
 
== Overview ==
  
For binary downloads of Lazarus see [http://wiki.lazarus.freepascal.org/Getting_Lazarus#Download_and_install_Lazarus_release_version Download and install Lazarus release version]
+
A real "in depth" build guide is [http://www.stack.nl/~marcov/buildfaq.pdf here].
 
 
For people who simply want to install Lazarus and start using it for programming, the easiest approach is to download and install a recent, reasonably stable binary release (such as a Linux ".rpm" package, a Windows ".exe" installer, or a Mac OS X ".dmg" package). You can read the sections under Linux or Windows entitled "fpc binaries" or the first paragraphs in the sections on installing Lazarus in Linux or Windows; most of the remaining information can be safely ignored.
 
  
 +
For binary downloads of Lazarus see [[Getting_Lazarus#Download_and_install_Lazarus_release_version|Download and install Lazarus release version]].
  
 +
For people who simply want to install Lazarus and start using it for programming, the easiest approach is to download and install a recent, reasonably stable binary release (such as a Linux ".rpm" package, a Windows ".exe" installer, or a macOS ".dmg" package). You can read the sections under Linux or Windows entitled "fpc binaries" or the first paragraphs in the sections on installing Lazarus in Linux or Windows; most of the remaining information can be safely ignored.
  
 
For those who want to participate in the development of the compiler or the IDE, or for those who want the most up-to-date tools, an installation from source files is necessary, and much of the rest of this information is relevant.
 
For those who want to participate in the development of the compiler or the IDE, or for those who want the most up-to-date tools, an installation from source files is necessary, and much of the rest of this information is relevant.
Line 19: Line 19:
 
* FCL - the Free Pascal Component library, containing most of the non-graphic components used by Lazarus
 
* FCL - the Free Pascal Component library, containing most of the non-graphic components used by Lazarus
  
=== Lazarus System Requirements ===
+
== Lazarus system requirements ==
 
 
# Free Pascal compiler, packages, and sources. (*important*: of the same version/date)
 
# A supported widget tool-kit
 
#:;Win32: The native Win32 API can be used, or Qt widgetset.
 
#:;Linux/xxxBSD: GTK+ 2.x or Qt : Most Linux distributions and *BSDs already install the GTK+ 2.x libraries. You can also find them at http://www.gtk.org. <br>Qt is also supported with all distributions (auto installed if you prefer KDE). <br>
 
#:;Mac OS X: You need the Apple developer tools. See Installing under Mac OS X below. Qt can be used too.
 
 
 
The FAQ - Frequently Asked Questions file is available at http://www.lazarus.freepascal.org . Some of the questions can be found in the local file 'FAQ'.
 
 
 
Qt widget set is supported on Linux 32/64,Win32/64,Mac OS X, Haiku and embedded linux (qtopia) platforms.<br>
 
More about installation http://wiki.lazarus.freepascal.org/index.php/Qt_Interface <br>
 
 
 
The following sections describe how to get Free Pascal and how to install Lazarus properly.
 
 
 
== Installing The Free Pascal Compiler ==
 
 
 
There is an extensive discussion of how to install and build Free Pascal compilers available here http://www.stack.nl/~marcov/buildfaq.pdf - it may be a little too detailed for some users, but is very comprehensive.
 
 
 
Lazarus 1.4 requires fpc (Free Pascal) version 2.6.4 or higher and it requires both the compiled fpc libs (binaries) and the fpc sources and of the same version.
 
 
 
=== Installing Free Pascal under Linux ===
 
 
 
==== FPC Binaries ====
 
 
 
The latest release of Free Pascal, version 3.0.2, can be obtained from the Free Pascal website (http://www.freepascal.org/download.var, then choose a mirror) or from SourceForge (http://sourceforge.net/projects/lazarus).
 
 
 
At the Lazarus downloads section (http://www.lazarus.freepascal.org ) you can get the RPM or DEB of the Free Pascal compiler (compiler / Linux) and its packages. If you don't have an RPM-based or debian-based distribution, you can download and install the tarballs from http://www.freepascal.org. If you want to compile the binaries for yourself, see the BSD section.
 
 
 
Instructions:
 
 
 
{{Warning| if you're '''not using RPMs or debian packages''' (even if you plan to use alien) it's best to get latest stable fpc (3.0.2 as of now) and install Lazarus from source.}}<br>
 
 
 
Start Linux and login as '''root'''.
 
 
 
Download latest files from https://sourceforge.net/projects/lazarus/files/.
 
As example:
 
:* fpc-3.0.2-0.laz.i686.rpm
 
:* fpc-src-3.0.2-0.laz.i686.rpm
 
:* lazarus-1.6.4-0.i686.rpm
 
and install them with:
 
:* rpm -Uvh *.rpm
 
 
 
Debian users are recommended to use the deb packages, but may use either alien (warning, it doesn't generate fpc.cfg) or the tarball install.
 
 
 
==== FPC Sources ====
 
FPC source files are stored in a Subversion (SVN) repository that keeps track of all changes of the source tree.
 
Once you have the sources, please see [[#Installing Free Pascal from source under Linux/BSD]] for instructions on how to install them.
 
 
 
===== Download Daily Source Snapshot of Development Tree =====
 
You can download today's development sources in the form of a packed snapshot from the SVN source repository: these snapshots are updated on a daily basis, and reflect the state of the source repository. They are not tested, might not work or even crash your system. The files are kept at the site which has the SVN archive. The version of FPC used can vary.
 
Location: [http://www.hu.freepascal.org/lazarus/]
 
 
 
===== Up to date source repository using SVN =====
 
As an alternative to the daily zip files of the SVN sources, the SVN repository has been made accessible for everyone, with read-only access. This means that you can directly access the code, and you will have really the last-minute sources available. It is also a method which requires less bandwidth once you have done the first download (checkout in SVN lingo).
 
 
 
===== Getting the source =====
 
How to do this?
 
First, you need to have an SVN client installed. Use your package manager, install a tool like TortoiseSVN on Windows, or look at [http://subversion.tigris.org/] for more details.
 
 
 
Using command line SVN: change directory (cd) to the parent directory of your development area, eg
 
To retrieve the full source repository for the first time into an fpc subdirectory under your home directory, type
 
<syntaxhighlight lang="bash">
 
cd ~
 
svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
 
</syntaxhighlight>
 
 
 
To update the sources which were downloaded (checked out) above
 
<syntaxhighlight lang="bash">
 
cd ~
 
svn update fpc
 
</syntaxhighlight>
 
 
 
===== Getting a separate branch =====
 
If the current trunk version is in a state of rapid change and unsuitable for much use unless you want to work on the compiler itself, you can stay on a version that is updated with fixes.
 
To do this, you have to find out a stable '''branch''' that you want to track instead of the default '''trunk''' development version.
 
The example below shows how you can track the fixes_2_6 version; of course replace as needed depending on what branches you want to track.
 
 
 
This example keeps the fixes in another directory under your home directory - it wouldn't make sense to put two versions of the source in one directory...
 
<syntaxhighlight lang="bash">
 
cd ~
 
svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 fpc_fixes_2_6
 
</syntaxhighlight>
 
Update as usual:
 
<syntaxhighlight lang="bash">
 
cd ~
 
svn update fpc_fixes_2_6
 
</syntaxhighlight>
 
 
 
===== Documentation =====
 
The documentation sources are in a separate repository called fpcdocs, so the command to get them is
 
<syntaxhighlight lang="bash">
 
cd ~
 
svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
 
</syntaxhighlight>
 
 
 
If you want to learn more about subversion, read this excellent [http://svnbook.red-bean.com/ Subversion book] which is also available online in different formats for free.
 
 
 
For more information, see the [http://www.freepascal.org/develop.var Free Pascal] website.
 
 
 
=== Installing Free Pascal under Windows ===
 
 
 
==== FPC Binaries for Windows ====
 
 
 
By far the easiest way to get a working installation of Free Pascal is to download the current binary Windows release of Lazarus from the SourceForge repository [http://sourceforge.net/projects/lazarus/files/] - the release contains the current versions of the Free Pascal Compiler and the Free Pascal libraries as well as the Lazarus IDE.
 
 
 
If you want to install from sources, read on!
 
 
 
You can get the installer zip for fpc at Free Pascal's download section http://www.freepascal.org/download.var, then choose a mirror).
 
Installing from the sources -- see the next section to know how to get them -- is not for novices, since you need a starting compiler as well.
 
 
 
==== FPC Sources for Windows ====
 
<<<< See section above under [[#FPC Sources|FPC Sources]] for Linux, where the use of SVN is described >>>>
 
 
 
The easiest way to get the Free Pascal sources is via SVN; see the next section for more on that. You can also download the package as a whole -- see http://www.freepascal.org/develop.var for the daily snapshot of the 2.5.x release tree.
 
 
 
Windows FPC Sources via SVN
 
 
 
You will need to have a SVN client such as TortoiseSVN installed in order to perform the steps below. The exact commands vary between SVN clients; the ones given below are to be used under SVN home's client, which is available for download here.
 
 
 
First create a directory in which you'd like to put the sources. Any normal user can do this. Create a directory for fpc (e.g. C:\Source), then do the following at the command prompt:
 
<syntaxhighlight lang="bash">C:\Source> svn co http://svn.freepascal.org/svn/fpc/trunk fpc</syntaxhighlight>
 
Hint: To download/update the latest changes you can simply do
 
<syntaxhighlight lang="dos">
 
C:\> cd Source\FPC
 
C:\Source\FPC> svn up
 
</syntaxhighlight>
 
 
 
See: http://www.freepascal.org/down/i386/win32.var . Download FPC as one big file, unzip it and run the install.exe.
 
 
 
Extending your PATH variable to the fpc directory:
 
 
 
* Win98: Edit autoexec.bat and add the line: PATH=%PATH%;C:\pp\bin\bin\win32
 
* WinXP/2k: My Computer (Right Click) ->  Properties -> Advanced (Page) -> Environment Variables -> System Variables -> Edit "PATH", Add "C:\pp\bin\bin\win32" there.
 
 
 
Then restart windows.
 
 
 
After you have FPC binaries installed you can build FPC source from subversion. 
 
 
 
Hints: 
 
* Windows (7+) requires that an elevated user status command prompt be used.  From the start menu for "Command Prompt" right click and select "Run as Administrator".
 
* YOUR-PREFIX is totally dependent on where you installed FPC to.  At the time of this writing, the binaries are instructed to use a default location of "C:\FPC" and they were placed in "C:\FPC\2.6.4".  Under Linux, the make install scripts were adjusted to create a new sub-folder IF the FPC version changed since last build. The Windows scripts do not. So if you know the sub-folder name ie. 3.1.1 you can specify that. However, since versions change frequently, it is recommended that you just select and maintain a single PREFIX with no respect for FPC versions. A good prefix is C:\FPC but you must also make sure that the C:\FPC\bin\i386-win32\ folder is added to your path environment variable (see above on how to set your path and change it from the binary version to the newly compiled one).
 
Instructions:
 
* In command Prompt navigate to the localized FPC source. ie.) type "cd c:\Developer\FPC"
 
* To build FPC type "make all"
 
* To overwrite existing FPC type "make install PREFIX=YOUR-PREFIX"
 
* To install source type "make install sourceinstall PREFIX=YOUR-PREFIX"
 
 
 
==== Compiling/installing FPC and Lazarus from Sources of SVN (Win32) ====
 
 
 
17 Feb 2017 Version FPC '''3.0.2''' version Lazarus '''1.7.x'''
 
 
 
===== STEP #1: Create directories and get the sources =====
 
Create the following directories:
 
  c:\freepascal\
 
  c:\freepascal\binutils\
 
  c:\freepascal\binutils\i386-win32\
 
  c:\freepascal\fpc\
 
  c:\freepascal\fpc\3.0.2\
 
  c:\freepascal\laz\
 
 
 
You will need the latest '''released'' compiler to build a new compiler.
 
Get the ppc386 (the compiler) in FTP (below) and unzip it in c:\freepascal\binutils\
 
  ftp://ftp.freepascal.org/pub/fpc/dist/3.0.0/bootstrap/i386-win32-ppc386.zip
 
 
 
After installing [http://tortoisesvn.tigris.org/ TortoiseSVN], download the sources from SVN using a URL for each directory, see:
 
  Dir: c:\freepascal\binutils\i386-win32\
 
  URL: http://svn.freepascal.org/svn/fpcbuild/branches/fixes_3_0/install/binw32
 
 
 
  Dir: c:\freepascal\fpc\3.0.2
 
  URL: http://svn.freepascal.org/svn/fpc/branches/fixes_3_0/
 
 
 
  Dir: c:\freepascal\laz
 
  URL: http://svn.freepascal.org/svn/lazarus/trunk
 
 
 
===== STEP #2: Create a BAT file to compile FPC =====
 
After everything is downloaded, we need a BAT file to compile the FPC sources.
 
Create a new file c:\freepascal\makefpc.bat and copy/paste the following script:
 
 
 
<syntaxhighlight lang="dos">
 
@echo on
 
set myroot=c:\freepascal
 
set myFPC=%myroot%\fpc\3.0.2
 
set mybinutils=%myroot%\binutils
 
set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
 
cd %myFPC%
 
rd /s /q  %myfpc%\examples
 
make distclean all install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exe
 
</syntaxhighlight>
 
 
 
===== STEP #3: Make and install FPC =====
 
At the prompt (cmd.exe), navigate to the directory c:\freepascal and execute the script we just wrote:
 
 
 
<syntaxhighlight lang="dos">
 
cd /d c:\freepascal
 
makefpc.bat
 
</syntaxhighlight>
 
 
 
===== STEP #4: Create fpc.cfg file =====
 
Now we need to have a configuration file for FPC. This can be done with the fpcmkcfg tool in the fpc bin directory. Steps:
 
 
 
# Open a command line console
 
# cd /d C:\freepascal\fpc\3.0.2\bin\i386-win32
 
# fpcmkcfg -d basepath=C:\freepascal\fpc\3.0.2 -o .\fpc.cfg
 
 
 
{{Note|earlier instructions had \bin\i386-win32 appended to the basepath. This is not needed since at least FPC 2.4.4}}
 
 
 
===== STEP #5: Create a BAT file to compile Lazarus =====
 
To compile Lazarus for the first time, create a new file c:\freepascal\makelaz.bat and copy/paste the following script:
 
 
 
<syntaxhighlight lang="dos">
 
set myroot=c:\freepascal
 
set myFPC=%myroot%\fpc\3.0.2
 
set mybinutils=%myroot%\binutils
 
set PATH=%mybinutils%\i386-win32;%myFPC%\bin\i386-win32;%PATH%
 
cd %myroot%\laz
 
make clean all OPT="-glw2"
 
</syntaxhighlight>
 
 
 
 
 
Tip: You only need to use this BAT at the first time. Then you can just build Lazarus using the menu Tools menu> Build Lazarus.
 
 
 
===== STEP #6: Make Lazarus =====
 
At the prompt, navigate to the directory c:\freepascal and type: makelaz.bat
 
 
 
 
 
Done!
 
 
 
=== Installing Free Pascal under FreeBSD/auto ===
 
 
 
Latest FreeBSD ports collection has 3.0.2 stable version in ports/lang/fpc. But they are scattered over 96 (!) packages and the source can be obtained from /usr/ports/distfiles/freepascal.
 
 
 
This can be done as root.
 
 
 
<syntaxhighlight lang="bash">[]# cd /usr/ports/lang/fpc && make install && make clean</syntaxhighlight>
 
  
Other possibility is to use portinstall.
+
# A Free Pascal Compiler, packages, and sources. (*Important*: of the same version/date)
 +
# A supported widget set:
 +
#:;Win32/Win64: The native Win32 API can be used, or the Qt widgetset.
 +
#:;Linux/BSD: GTK+ 2.x or Qt : Most Linux distributions and *BSDs already install the GTK+ 2.x libraries. You can also find them at http://www.gtk.org. <br/>Qt is also supported with all distributions (auto installed if you prefer KDE).
 +
#:;macOS: You need the Apple Xcode developer tools. For macOS versions before 10.15 (Catalina), the 32 bit Carbon or 64 bit Cocoa widget sets can be used. <br/> For macOS 10.15 onwards, the 64 bit Cocoa widget set must be used as all 32 bit support has been removed by Apple.<br/> Qt can be used too, but it requires much more effort.
  
<syntaxhighlight lang="bash">[]# portinstall fpc</syntaxhighlight>
+
::The Qt widget set is supported on Linux 32/64, Win 32/64, macOS 32/64, FreeBSD 32/64, Haiku and embedded Linux (qtopia) platforms. For more details about the installation of Qt, see the [[Qt Interface]] article.
  
Once fpc is installed you can check if it's working by simply running
+
== Operating system specific guides ==
  
<syntaxhighlight lang="bash">[]$ fpc</syntaxhighlight>
+
While the remainder of this page has much valuable information, many users may need no more than the following operating system specific guides.
  
=== Installing Free Pascal from source under Linux/BSD ===
+
=== FreeBSD ===
 
 
Effectively, you need
 
 
 
If you have a file with all FPC sources, or two (FPC and Lazarus):
 
1. e.g. for fpc ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar preferably an export (no SVN/ dirs).
 
2. Lazarus source snapshot.
 
* a starting compiler, the latest release version (fpc 3.0.0) is the only version guaranteed to work. You can download a bootstrap compiler or use your distribution's package management/software system to install one
 
 
 
FPC build process:
 
* Fetch necessary files (starting compiler), FPC source file or source svn directory
 
* If using FPC source files: extract/de-tgz in work directory,
 
* Build: enter work/fpc/ and run
 
<syntaxhighlight lang="bash">
 
$MAKE all OPT='-gl' PP=/path/to/startingcompiler-name-ppc386
 
#/path/to/ can be omitted when ppc386 is in the path
 
#$MAKE is make on linux and gmake on BSD
 
</syntaxhighlight>
 
  
* Install fpc. Again in work/fpc, run
+
* See [[Installing Lazarus on FreeBSD]]
<syntaxhighlight lang="bash">
 
$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX
 
#replace the PP=compiler/ppc386 with the relevant compiler if not on Intel x86
 
#THEPREFIX= usually is /usr/local or just /usr, but e.g. on NetBSD it is /usr/pkg for ports)
 
</syntaxhighlight>
 
  
* Create a symlink:
+
=== Haiku ===
<syntaxhighlight lang="bash">
 
ln -s $THEPREFIX/lib/fpc/3.0.0/ppc386 $THEPREFIX/bin/ppc386
 
</syntaxhighlight>
 
  
* Install sources:
+
* See [[Installing Lazarus on Haiku]]
<syntaxhighlight lang="bash">
 
$MAKE install sourceinstall PREFIX=$THEPREFIX
 
</syntaxhighlight>
 
* Create a symlink for default Lazarus source path:
 
<syntaxhighlight lang=bash>
 
ln -sf $THEPREFIX/share/src/3.0.0/fpc /usr/share/fpcsrc
 
</syntaxhighlight>
 
  
* Set up fpc.cfg configuration file:
+
=== Linux ===
<syntaxhighlight lang="bash">$THEPREFIX/lib/fpc/3.0.0/samplecfg $THEPREFIX/lib/fpc/3.0.0 $ETCDIR</syntaxhighlight>
 
  
* Optionally test to see if ppc386 -i (or whatever compiler your architecture uses) gives output, else give a warning that user need to add $PREFIX/bin to his current path. Try to compiler a program with -viwn, and see if that gives errors.
+
* See [[Installing Lazarus on Linux]]
  
Notes:
+
=== macOS ===
* If you need fpcmake package lists, you need to generate or supply them yourself, (in the port, or in an extra archive) either way, do a dummy install to /tmp/pack and determine the files installed with <syntaxhighlight lang="bash">find . >ll</syntaxhighlight>
 
  
* $THEPREFIX and $ETCDIR should be user configurable. Otherwise local installs aren't possible.
+
* See [[Installing Lazarus on macOS]]
  
* BSDHIER=1 on all make commands forces BSD hierarchy conventions.
+
=== Raspbian  ===
  
=== Installing Free Pascal under Mac OS X ===
+
* See [[Lazarus on Raspberry Pi]]
  
See [[Installing Lazarus on MacOS X]]
+
=== Windows ===
  
==Installing Lazarus==
+
By far the easiest and most common way to install Lazarus on windows is to go to the Lazarus SourceForge download site, https://sourceforge.net/projects/lazarus/files/ select an appropriate combined FPC/Lazarus package, download and install.
  
===Installing Lazarus under Linux===
+
== Installing Lazarus ==
  
==== Ubuntu / Debian ====
+
=== Ubuntu/Debian Linux ===
  
It is recommended to use the [[fpcup|fpcUP]] updater-installer for first time users of Lazarus, which installs fpc & Lazarus in one go into a single subdirectory structure ( ~/development ).  
+
It is recommended to use the [[fpcup|fpcUP]] updater-installer for first time users of Lazarus, which installs Free Pascal and Lazarus in one go into a single subdirectory structure ( ~/development ).  
  
 
A way to get a current working installation of Lazarus is to download the .deb files for Free Pascal and Lazarus from the SourceForge repository. Here is how: [[Lazarus release version for Ubuntu|Getting Lazarus from our Ubuntu repository]].
 
A way to get a current working installation of Lazarus is to download the .deb files for Free Pascal and Lazarus from the SourceForge repository. Here is how: [[Lazarus release version for Ubuntu|Getting Lazarus from our Ubuntu repository]].
Line 331: Line 67:
 
Note that installing from the default Ubuntu sources will not install the Free Pascal Source Libraries - use the method above.
 
Note that installing from the default Ubuntu sources will not install the Free Pascal Source Libraries - use the method above.
  
{{Note|on Linux Ubuntu at least, the command to start Lazarus from a console is [[startlazarus]]. Else, if you installed it from a Debian package, you should have a Lazarus menu entry under Application/Programming.  
+
{{Note|on Linux Ubuntu at least, the command to start Lazarus from a console is [[startlazarus]]. If you installed it from a Debian package, you should have a Lazarus menu entry under Application/Programming.  
 
(Issue: there is an ambiguity with a program also called "lazarus" from a "tct" package available for Ubuntu).}}
 
(Issue: there is an ambiguity with a program also called "lazarus" from a "tct" package available for Ubuntu).}}
  
 +
'''Building debs the easy way'''
  
===== Building debs the easy way =====
+
The easiest way to get a current working installation of Lazarus is to download and build your own .deb packages by following the instructions at [[How to setup a FPC and Lazarus Ubuntu repository]]
  
The easiest way to get a current working installation of Lazarus is to download build your own .deb packages by following the instructions at:
+
'''Installing using rpms'''
  
[[How to setup a FPC and Lazarus Ubuntu repository]]
+
The next easiest way is to download the RPMs for Free Pascal and Lazarus from the SourceForge repository.
  
===== Installing using rpms =====
+
You need to download the selected version of:
 +
* the compiler (eg fpc-3.0.4-1.i686.rpm)
 +
* the pascal source library (eg fpc-src-3.0.4-2.i686.rpm)
 +
* the Lazarus package (eg lazarus-2.0.8-0.i686.rpm).
  
The next easiest way is to the RPMs for Free Pascal and Lazarus from the SourceForge repository.
+
Uninstall the old packages:
 
 
You need to download the selected version of
 
* the compiler (eg fpc-2.6.4-0.i686.rpm)
 
* the pascal source library (eg fpc-src-2.6.4-0.i686.rpm)
 
* the Lazarus package (eg lazarus-1.4.4-0.i686.rpm).
 
  
Uninstall the old packages:
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
rpm -ev lazarus
 
rpm -ev lazarus
Line 362: Line 96:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=====Installing on Raspbian Wheezy=====
+
=== Arch or Manjaro Linux (aarch64) ===
  
Raspbian is a custom version of Debian for the Raspberry Pi creditcard-size computer. See [[Lazarus on Raspberry Pi]] for details.
+
To install Free Pascal and Lazarus, see [[Install on aarch64 Arch or Manjaro]].
  
====Installing on Mandriva====
+
=== Fedora Linux ===
  
===== Lazarus 0.9.30 on Mandriva 2010. =====
+
Recent packages of Lazarus and Free Pascal are included in Fedora by default. See [[Install_on_Fedora|Install on Fedora]] on how to install them.
  
Install as given lower down however on compiling a program  you may get two error messages telling you that you are missing pixbuf 2.0  and  lgtk-x11-2.0.  to fix this install from the the software installer  libdgk_pixbuf2.0_0-devel and libgtk+2.0_0-devel.
+
=== Scientific Linux ===
  
====Installing on Slackware====
+
Scientific Linux is an RPM-based distribution focussing on science and research. See [[Scientific Linux]] for details.  
===== Installing Lazarus on Slackware 13.0 =====
 
There is no real difference from the slackware 12.2 or 12.0 version, therefore the procedure described below should work just as well.  
 
  
===== Installing Lazarus 0.9.30, for Slackware 12.0 users =====
+
=== Debian GNU Linux ===
This have worked in Slackware-12.0 on a Pentium-3 computer:
 
  
* The Free Pascal Compiler (FPC) is installed in SUPERUSER mode
+
There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.
* The lazarus in installed in USER mode
 
* The FPC compiler will be recompiled
 
* The lazarus Integrated Development Environment (IDE) source code is loaded from the SVN server
 
 
-- Download "fpc-2.4.2.i386-linux.tar" in a user folder and install it. Go to this folder and type:
 
<syntaxhighlight lang="bash">
 
bash-3.1$ tar -xvf fpc-2.4.2.i386-linux.tar
 
bash-3.1$ su
 
bash-3.1$ password:xxxxxx
 
bash-3.1# sh install.sh
 
...
 
(use the default answers for the next 6 questions: press "return" 6 times)
 
...
 
bash-3.1# exit
 
bash-3.2$ fpc
 
free pascal compiler version 2.4.2 [] for i386
 
Copyright (c) 2010 ...
 
...
 
...
 
</syntaxhighlight>
 
You have installed the compiler. You may want to recompile it or not, but in any case you will need to download the source code as it is required by the lazarus IDE.
 
  
-- Download "fpc-2.4.2.source.tar.gz" in a temporary folder. If you do not want to recompile the source then just skip this section. If you would like to run your own compiled version of FPC, then just type:
+
Note that for a fully working Lazarus install, no older or incompatible versions of, for example, the fpc source or fpc compiler must be installed. Remove them by typing
<syntaxhighlight lang="bash">
 
bash-3.1$ tar -xvzf fpc-2.4.2.source.tar.gz
 
bash-3.1$ cd fpc-2.4.2
 
bash-3.1$ make clean all
 
bash-3.1$ su
 
bash-3.1$ password: xxxxxxxx
 
bash-3.1# make install
 
bash-3.1# exit
 
bash-3.1$ fpc
 
free pascal compiler version 2.4.2 [...] for i386
 
Copyright (c) 2010 ...
 
...
 
...
 
</syntaxhighlight>
 
Now you have your own compiled version working.  
 
  
-- The Lazarus IDE editor needs to look at the FPC source code. Even if you do not want to recompile FPC, you need its source code. However, in order to save some space, I only keep a clean (not compiled) copy of the source code. I start from  the file  "fpc-2.4.2.source.tar.gz" again and I copy it to the /usr/local/src/FPC folder:
+
<syntaxhighlight lang="bash">dpkg -r <package name></syntaxhighlight>
<syntaxhighlight lang="bash">
 
bash-3.1$ su
 
bash-3.1$ password: xxxxxxxx
 
bash-3.1# cp fpc-2.4.2.source.tar.gz /usr/local/src/
 
bash-3.1# cd /usr/local/src/
 
bash-3.1# tar -xvzf fpc-2.4.2.source.tar.gz
 
bash-3.1# rm fpc-2.4.2.source.tar.gz
 
bash-3.1# exit
 
</syntaxhighlight>
 
The version number is included in the folder name "fpc-2.4.2". This way I can keep many versions the the compiler source and eventually switch between them.
 
  
-- The lazarus IDE is kept in my USER "~/lazarus" folder and always compiled in USER mode. I usually download the "lazarus-0.9.30-0.tar.gz" file, but here we can also get the latest development version from the SVN server:
+
without .deb extension. And then install the newest versions as described.
<syntaxhighlight lang="bash">bash-3.1$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus</syntaxhighlight>
 
This is for the first time you load it. Next time you will only need to type:
 
<syntaxhighlight lang="bash">bash-3.1$ svn update</syntaxhighlight>
 
If you do not have SVN installed on your computer, here is how to get it quickly:
 
 
 
--Download the two files: "subversion-1.4.6.tar.gz" and "subversion-deps-1.4.5.tar.gz" (or later versions). Type:
 
<syntaxhighlight lang="bash">
 
bash-3.1$ tar -xvzf subversion-1.4.6.tar.gz
 
bash-3.1$ tar -xvzf subversion-deps-1.4.6.tar.gz
 
bash-3.1$ cd subversion-1.4.6
 
bash-3.1$ ./configure
 
bash-3.1$ make
 
bash-3.1$ su
 
bash-3.1$ password:xxxxxx
 
bash-3.1# make install
 
bash-3.1$ exit
 
</syntaxhighlight>
 
 
 
-- At this point you have the folder "~/lazarus" containing the source code. You should compile it very simply:
 
  bash-3.1$ make clean all
 
After a few minutes, the compiler stops:
 
<syntaxhighlight lang="bash">
 
...
 
...
 
Linking ../Lazbuild
 
987 linescompiled ...
 
make [2] leaving ...
 
make [1] leaving ...
 
bash-3.1$
 
</syntaxhighlight>
 
 
 
-- Just type:
 
<syntaxhighlight lang="bash">bash-3.1$ ./lazarus</syntaxhighlight>
 
WOW! You get a message:  "Free Pascal sources not found". Just follow the instructions and indicate your Free Pascal Compiler source directory in the panel: "Environment->Options->Files". As explained earlier, on my computer this should point to "/usr/local/src/fpc-2.4.2". Note that when you change this folder, you should click on "Environment / Rescan_FPC_source_directory".
 
 
 
Voila!
 
 
 
====Installing on openSUSE====
 
 
 
===== Installing Lazarus 0.9.30. For openSUSE 11.1 users =====
 
 
 
Free Pascal Compiler requires:<br>
 
- Gnu binutils (gnu as, gnu ld, gnu make)
 
These utils can be installed by:
 
<syntaxhighlight lang="bash">zypper in -t pattern devel_basis</syntaxhighlight>
 
 
 
Lazarus also requires these components:
 
1) glib2 devel
 
2) gtk2 devel
 
 
 
'''Important''': The lazarus rpm requires the gtk 2 version, not the version 1.2.
 
 
 
These libraries can be installed by:
 
<syntaxhighlight lang="bash">zypper -n install gtk2 glib2</syntaxhighlight>
 
 
 
Download these binary files (RPM)
 
:* fpc-2.4.2-0.i686.rpm (yes i686 and not i386)
 
:* fpc-src-2.4.2-0.i686.rpm
 
:* lazarus-0.9.30-0.i686.rpm
 
 
 
install them opening a terminal session (mouse's right button -> Menu: Open in terminal)
 
<syntaxhighlight lang="bash">
 
rpm -Uvh fpc-2.4.2-0.i686.rpm
 
rpm -Uvh fpc-src-2.4.2-0.i686.rpm
 
rpm -Uvh lazarus-0.9.30-0.i686.rpm
 
</syntaxhighlight>
 
 
 
====Installing Lazarus 1.0.8 on Fedora Core 18====
 
 
 
After a fresh install of Fedora Core 18 '''yum''' is installed, but fails with an error messages.
 
*Open '''Software''', check for new software and update all packages.
 
*Reboot.
 
*Install packages '''gtk2-devel''', '''fpc''' and '''subversion'''. Fedora Core 18 already has fpc 2.6.2.
 
*Open a Terminal and do
 
svn co svn+ssh://svn.freepascal.org/FPC/svn/lazarus/tags/lazarus_1_0_8 lazarus
 
cd lazarus
 
make bigide
 
./lazarus
 
  
==== Installing Lazarus on Scientific Linux ====
+
=== From source on Linux ===
  
Scientific Linux is an RPM-based distribution focussing on science and research. See [[Scientific Linux]] for details.  
+
If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole Lazarus toolchain is installed into one directory, uninstall is very easy and you don't need to be root to install Lazarus. You can get tgz files for FPC, the FPC source and Lazarus from the downloads section or you can download it directly via svn.
  
==== Installing from source ====
+
Here is an example of installing 0.9.28 to Ubuntu 6.06. If you understand Linux commands and bash script, you can get what steps are needed. Just copy the script (change the version number when a new version has been released), paste it into a text editor, and save it as something like "install_lazarus.sh". Give it execute permission, and run it in a console.
  
If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole lazarus stuff is installed into one directory, uninstall is very easy and you don't need to be root to install lazarus. You can get tgz files for fpc, fpcsrc and lazarus from the downloads section or you can download it directly via svn.
+
{{Note|In this example, FPC is installed in /opt. So when prompted ''''Install prefix'''', enter '/opt/fpc'. }}
 
 
Here is an example of installing 0.9.28 to Ubuntu 6.06. If you understand Linux commands and bash script, you can get what steps are needed. Just copy the script (change the version number when new version has been released), paste it into a text editor, and save it as something like "install_lazarus.sh". Give it execute permission, and run it in
 
a console.
 
{{Note|In this example, fpc is installed in /opt. So when prompted 'Install prefix', enter '/opt/fpc'. }}
 
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
#!/bin/sh
 
#!/bin/sh
 
    
 
    
#installing required packages
+
# Installing the required packages
 
sudo apt-get install build-essential
 
sudo apt-get install build-essential
 
sudo apt-get install libgtk2.0-dev
 
sudo apt-get install libgtk2.0-dev
 
sudo apt-get install libgdk-pixbuf-dev
 
sudo apt-get install libgdk-pixbuf-dev
 
    
 
    
#installing Free Pascal source
+
# Installing the Free Pascal source
 
cd /opt
 
cd /opt
 
sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.4.2.source.tgz
 
sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.4.2.source.tgz
Line 537: Line 140:
 
sudo mv fpc fpcsrc
 
sudo mv fpc fpcsrc
 
    
 
    
#installing Free Pascal
+
# Installing the Free Pascal binaries
 
sudo mkdir fpc
 
sudo mkdir fpc
 
cd fpc
 
cd fpc
Line 545: Line 148:
 
sudo sh install.sh
 
sudo sh install.sh
 
    
 
    
#adding fpc path to the PATH
+
# Adding the FPC path to the PATH
 
echo "#FPC PATH" >> ~/.bash_profile
 
echo "#FPC PATH" >> ~/.bash_profile
 
echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile  
 
echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile  
Line 551: Line 154:
 
echo "fi" >> ~/.bash_profile
 
echo "fi" >> ~/.bash_profile
 
    
 
    
#installing Lazarus
+
# Installing the Lazarus IDE
 
cd ../
 
cd ../
 
sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.30-0.tar.gz
 
sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.30-0.tar.gz
 +
# sudo wget https://downloads.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.0RC5/lazarus-1.8.0-RC5.tar.gz
 
sudo tar -zxvf lazarus-0.9.30-0.tar.gz
 
sudo tar -zxvf lazarus-0.9.30-0.tar.gz
 
PATH=/opt/fpc/bin:"${PATH}"
 
PATH=/opt/fpc/bin:"${PATH}"
 
sudo chmod -R 777 lazarus
 
sudo chmod -R 777 lazarus
 
cd lazarus
 
cd lazarus
make clean all
+
make clean all bigide
 
./lazarus
 
./lazarus
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 564: Line 168:
 
{{Note|You have to manually set fpc-src path in the Environmental Options.}}
 
{{Note|You have to manually set fpc-src path in the Environmental Options.}}
  
===== Downloading Lazarus Source Code =====
+
'''Downloading Lazarus Source Code'''
  
 
Both the Lazarus and FPC source code reside in SVN/subversion repositories. SVN provides an easy way to update your sources by only downloading the changes. This is the recommended way and saves you a lot of time. A connection to the internet is needed for this, but you don't need to be root.  
 
Both the Lazarus and FPC source code reside in SVN/subversion repositories. SVN provides an easy way to update your sources by only downloading the changes. This is the recommended way and saves you a lot of time. A connection to the internet is needed for this, but you don't need to be root.  
Line 574: Line 178:
 
<font color="red">If you decide to use TortoiseSVN, remember to check "command line client tools" during its installation if you want Lazarus to show the SVN revision number in the About dialog.</font>
 
<font color="red">If you decide to use TortoiseSVN, remember to check "command line client tools" during its installation if you want Lazarus to show the SVN revision number in the About dialog.</font>
  
;Now the most important thing.... getting the sources:
+
Now get the Lazarus source:
  
<syntaxhighlight lang="bash">[]$ svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus</syntaxhighlight>
+
<syntaxhighlight lang="bash"> svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus</syntaxhighlight>
 
(replace the last lazarus with any other dir where you want to place your sources)
 
(replace the last lazarus with any other dir where you want to place your sources)
  
On subsequent occasions, to update simply type
+
On subsequent occasions, to update simply type:
  
<syntaxhighlight lang="bash">[]$ svn update lazarus</syntaxhighlight>
+
<syntaxhighlight lang="bash"> svn update lazarus</syntaxhighlight>
  
For more information on Subversion, see:
+
For more information on Subversion, see: http://subversion.tigris.org/
http://subversion.tigris.org/
 
  
===== Compiling and running =====
+
'''Compiling and running'''
  
Whether you checkout from cvs or svn, the next step is:  
+
When you have checked out the source from svn, the next step is:  
  
;compile lazarus:
+
;Compile Lazarus:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
[]$ cd lazarus
+
cd lazarus
[]$ make (gmake on BSD)
+
make bigide
 
</syntaxhighlight>
 
</syntaxhighlight>
  
If fpc is installed correctly, the compilation should work without problems. If not, see FAQ.
+
If FPC is installed correctly, the compilation should work without problems. If not, see the [[Lazarus Faq|Lazarus FAQ]].
  
 
;Start lazarus
 
;Start lazarus
<syntaxhighlight lang="bash">[]$ ./lazarus</syntaxhighlight>
+
<syntaxhighlight lang="bash">./lazarus</syntaxhighlight>
  
The IDE should start. If you started lazarus in a terminal, you can see some notes about missing settings. This is normal at first start. The IDE automatically tries to find out where the Free Pascal compiler and its sources are installed by searching in the most common directories.
+
The Lazarus IDE should start. If you started lazarus in a terminal, you can see some notes about missing settings. This is normal at first start. The IDE automatically tries to find out where the Free Pascal compiler and its sources are installed by searching in the most common directories.
  
 
;Check the paths:
 
;Check the paths:
Line 612: Line 215:
  
 
;Hint:
 
;Hint:
To update lazarus you can use
+
To update lazarus you can use:
<syntaxhighlight lang="bash">[]$ svn update lazarus</syntaxhighlight>
 
then for either update pathway:
 
<syntaxhighlight lang="bash">[]$ make clean all  (gmake on BSD)</syntaxhighlight>
 
This will rebuild lazarus and create an IDE without lazarus packages. To link your installed packages do '''after''' the above:
 
<syntaxhighlight lang="bash">[]$ ./lazbuild --build-ide=</syntaxhighlight>
 
  
You may have to append other options if for example you use a custom config directory (ie. add --pcp="C:\Documents and Settings\<USER>\Local Settings\Application Data\lazarus-tests"). See [[lazbuild]].
+
<syntaxhighlight lang="bash"> svn update lazarus</syntaxhighlight>
  
==== Installing Lazarus under Debian GNU/Linux ====
+
then for either update path:
  
There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.
+
<syntaxhighlight lang="bash"> make clean all bigide</syntaxhighlight>
  
Note that for a fully working Lazarus install, no older or incompatible versions of, for example, the fpc source or fpc compiler must be installed. Remove them by typing
+
This will rebuild Lazarus and create an IDE without your installed Lazarus packages. To link your installed packages do '''after''' the above:
  
<syntaxhighlight lang="bash">dpkg -r <package name></syntaxhighlight>
+
<syntaxhighlight lang="bash">./lazbuild --build-ide=</syntaxhighlight>
  
without .deb extension. And then install the newest versions as described.
+
You may have to append other options if for example you use a custom config directory. See [[lazbuild]].
  
=== Installing Lazarus under Windows ===
+
=== Windows ===
  
The current releases of the Windows Lazarus binary packages install very easily, and should work 'out-of-the-box'.  
+
The current releases of the Windows Lazarus binary packages install very easily, and should work 'out-of-the-box'. Upgrading is as simple as downloading the new installer and running it.  
  
Except for Win98 and ME, which needs a special flag to compile. See [[#Installing_from_source_2|Installing from source]].
+
Win98 and WinME need a special flag to compile. You need to use make OPT="-dWIN9XPLATFORM" otherwise the lazarus.exe will not be able to run on these operating systems.
  
==== Installing Lazarus on Portable USB Driver ====
+
'''Installing Lazarus on Portable USB Drive'''
  
 
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 fpc.cfg file.  It may also be necessary to keep the directory for test compilation on your portable drive.  
 
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 fpc.cfg file.  It may also be necessary to keep the directory for test compilation on your portable drive.  
Line 650: Line 248:
  
 
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 fixlaz.bat 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 fixlaz.bat, not the current one of your USB drive which fixlaz.bat 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 editoroptions.xml and fpc.cfg files (fpc.cfg is the the fpc bin directory, which might be buried deep in the lazarus folder):
 
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 fixlaz.bat 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 fixlaz.bat, not the current one of your USB drive which fixlaz.bat 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 editoroptions.xml and fpc.cfg files (fpc.cfg is the the fpc bin directory, which might be buried deep in the lazarus folder):
 +
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
 
copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
 
copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
Line 656: Line 255:
  
 
So to use it, I would type at the command prompt of the USB drive:
 
So to use it, I would type at the command prompt of the USB drive:
 +
 
<syntaxhighlight lang="dos">fixlaz G:</syntaxhighlight>
 
<syntaxhighlight lang="dos">fixlaz G:</syntaxhighlight>
 +
 
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 setenv.bat). 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.
 
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 setenv.bat). 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.
 
>>
 
>>
  
The binary package is available for Linux and Windows from
+
The binary package is available for Linux and Windows from http://sourceforge.net/project/showfiles.php?group_id=89339
  
http://sourceforge.net/project/showfiles.php?group_id=89339
+
Download the latest release and launch the application. You will be taken through a typical Windows installation, in which the FPC compiler and source libraries are installed within the same directory structure as Lazarus, and the IDE should launch and operate without significant problems, provided you have uninstalled(!!!) any previous version of Lazarus and/or FPC (often found in the C:\pp directory).
  
Download the latest release (currently Lazarus-0.9.30-0-win32.exe) and launch the application. You will be taken through a typical Windows installation, in which the FPC compiler and source libraries are installed within the same directory structure as Lazarus, and the IDE should launch and operate without significant problems, provided you have uninstalled(!!!) any previous version of Lazarus and/or FPC (often 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.
  
Tip:
+
=== From source on Windows ===
It's perhaps a good idea to reboot your Windows after you installed Lazarus and before you try to install additional lazarus components as zeoslib fore example.
 
  
==== Installing from source ====
 
 
If you prefer to install from sources, then follow these instructions.
 
If you prefer to install from sources, then follow these instructions.
  
Line 683: Line 282:
 
Or you use SVN (example for text mode SVN; adapt to GUI tools such as TortoiseSVN if you want to):
 
Or you use SVN (example for text mode SVN; adapt to GUI tools such as TortoiseSVN if you want to):
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
[]mkdir c:\lazarus
+
mkdir c:\lazarus
[]cd /d c:\lazarus
+
cd /d c:\lazarus
[]svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus
+
svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus
 
</syntaxhighlight>
 
</syntaxhighlight>
  
You have to install at least the latests stable FPC version (e.g. FPC 2.6.4, but an FPC 3.1.1 snapshot is also possible).  
+
You have to install at least the latests stable FPC version (e.g. FPC 3.0.4, but an FPC 3.1.1 snapshot is also possible).  
 
 
  
Type (replace $(LazarusDir) with the path you have unzipped/checked out Lazarus; replace  
+
Type (replace "YourLazarusDir" with the path you have unzipped/checked out Lazarus; replace  
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
cd /d $(LazarusDir)
+
cd "YourLazarusDir"
 
rem Of course change the first path variable to
 
rem Of course change the first path variable to
 
rem the path of your FPC compiler
 
rem the path of your FPC compiler
set path=c:\freepascal\bin\i386-win32;$(LazarusDir)
+
set path=c:\freepascal\bin\x86_64-win64;%PATH%
 
make
 
make
 
</syntaxhighlight>
 
</syntaxhighlight>
  
*Win9x: use make OPT="-dWIN9XPLATFORM" (Lazarus trunk (and upcoming 1.4)) otherwise the lazarus.exe will not be able to run on this platform.
+
*Win9x/WinME: use make OPT="-dWIN9XPLATFORM" otherwise the lazarus.exe will not be able to run on this platform.
  
 
If this works, you can type: lazarus.exe.  
 
If this works, you can type: lazarus.exe.  
Line 707: Line 305:
  
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
cd /d $(LazarusDir)\examples
+
cd "YourLazarusDir"\examples
 
make
 
make
 
</syntaxhighlight>
 
</syntaxhighlight>
  
<s>If you extracted lazarus to another drive, eg.: d:\lazarus, tt can happen that you need the gnu make utility to make it. If you have it, you can take its path to set path=...;<gmakepath> but it is simpler not to choose drive d:\</s>
+
'''Installing from source starting with a stable release'''
  
==== Installing from source starting with a stable release====
 
 
An alternative version of the instructions above.
 
An alternative version of the instructions above.
  
Line 723: Line 320:
  
 
Replace $(LazarusDir) with your Lazarus did and make sure the FPC version number matches
 
Replace $(LazarusDir) with your Lazarus did and make sure the FPC version number matches
 +
 
<syntaxhighlight lang="dos">
 
<syntaxhighlight lang="dos">
 
SET PATH=$(LazarusDir)\fpc\2.6.4\bin\i386-win32\
 
SET PATH=$(LazarusDir)\fpc\2.6.4\bin\i386-win32\
Line 734: Line 332:
 
Always start Lazarus from this shortcut, never directly from the executable. At the first time you start Lazarus configure you FPC dir, FPC sources dir and Lazarus dir.
 
Always start Lazarus from this shortcut, never directly from the executable. At the first time you start Lazarus configure you FPC dir, FPC sources dir and Lazarus dir.
  
==== Building Lazarus on Win98 and WinME ====
+
'''Building Lazarus on Win98 and WinME'''
 
 
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 "-dWIN9XPLATFORM".
 
 
 
=== Installing Lazarus under FreeBSD ===
 
The following applies to FreeBSD 9+ only.
 
 
 
====via Ports tree====
 
The latest version of Lazarus available in the FreeBSD port tree, is v 1.6RC2 We can use that to install Lazarus.
 
 
 
<syntaxhighlight lang="bash">[]# cd /usr/ports/editors/lazarus && make install clean clean-depends</syntaxhighlight>
 
 
 
If you start Lazarus IDE and you get a messages about missing source files, then go to '''Environment - Environment Options - Files Tab: FPC source library''' and enter the directory of the FPC source files.  It can be obtained from /usr/ports/distfiles/freepascal
 
 
 
====via pkgng====
 
<syntaxhighlight lang="bash">[]# pkg install editors/lazarus</syntaxhighlight>
 
 
 
At this point Lazarus might complain about missing source files.  If you don't have them:-
 
 
 
  mkdir /usr/ports/distfiles
 
  mkdir /usr/ports/distfiles/freepscal
 
  cd /usr/ports/distfiles/freepascal
 
  wget http://distcache.freebsd.org/ports-distfiles/freepascal/fpc-3.0.0.source.tar.gz
 
  tar xvfz fpc-3.0.0.source.tar.gz
 
 
 
Change the 3.0.0 to whatever version of fpc you have installed. Then go to '''Environment - Environment Options - Files Tab: FPC source library''' and enter
 
 
 
  /usr/ports/distfiles/freepascal/fpc-3.0.0
 
 
 
If when you try to compile something you get this error
 
 
 
  Error: resource compiler "fpcres" not found, switching to external mode
 
 
 
Then you can install fpcres like this
 
 
 
<syntaxhighlight lang="bash">[]# pkg install lang/fpc-utils</syntaxhighlight>
 
 
 
====via Lazarus repository====
 
This option will often be used if you want to follow Lazarus Trunk, a Fixes branch, or some other release (eg: compiling from a source tarball).
 
* Use the SubVersion or Git repositories to checkout a copy of the source code you want, or unpack a downloaded source archive into a suitable location
 
* The readme.txt file in Lazarus directory mentions 'make clean all'. This works if you are using Linux. Under FreeBSD 9.1 I had to replace 'make' with 'gmake'.
 
 
 
  cd /patch/to/lazarus_source
 
  gmake clean all
 
 
 
=== Installing Lazarus under PC-BSD 1.0rc1+ ===
 
 
 
You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from [http://www.pbidir.com/ PBI Dir]
 
 
 
Note that you must install glib* port from /usr/port/devel/glib* or glib packages by pkg_add -r glib12 glib20.
 
I will fix this in new PBI releases.
 
 
 
'''[other OpenBSD/NetBSD/DragonFlyBSD goes here]'''
 
 
 
=== Installing Lazarus under Mac OS X ===
 
 
 
See [[Installing Lazarus on MacOS X]].
 
 
 
=== Installing Lazarus under Haiku ===
 
  
Lazarus requires Qt under Haiku. Qt is not installed by default under Haiku. You need to install package available from this site : http://qt-haiku.ru/
+
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".
  
Currently, there is no binary package to install Lazarus.
+
== What does the ''bigide'' make argument do? ==
  
You will have to compile Lazarus from sources.
+
{{BigIDE}}
  
Detailed instructions to build Lazarus under Haiku are available here : [[Installing Lazarus on Haiku]]
+
== Multiple Lazarus installs ==
  
=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.
 
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 ==
These hints should be applicable across platforms; please adjust paths etc. according to your platform. Also, problems and solutions might be mentioned in the [[Lazarus_Faq]].
 
 
 
== Isolating the component ==
 
There may be multiple problems when installing Free Pascal and Lazarus.
 
If you have problems with starting Lazarus or compiling with it, first make sure your underlying FPC installation works, e.g. by trying to compile a simple example program.
 
 
 
== Location of installed components ==
 
On Linux/Unix/OSX, package/distribution provided installations will often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib, and probably the configuration in /etc/fpc.cfg
 
Source (Subversion) downloads often install in /usr/local/bin (libraries in /usr/local/lib).
 
 
 
== Missing or corrupt fpc.cfg file ==
 
The fpc.cfg file is the configuration file for FPC. For windows, it can normally be found in the fpc compiler's executable directory. On Unix/Linux/OSX, it is first searched in /etc/fpc.cfg, then
 
Only some problems that often occur are covered. Please see the Free Pascal User's guide, e.g. chapter Compiler usage/configuration file for more details, including the search order for fpc.cfg
 
 
 
If it is not present, FPC will in general not compile your programs properly.
 
 
 
=== Create fpc.cfg automatically ===
 
You can try to create fpc.cfg via a tool:
 
 
 
<syntaxhighlight lang="dos">
 
rem Change to the FPC executable directory, adjust to taste
 
cd /d C:\freepascal\fpc\2.4.5\bin\i386-win32
 
rem Create fpc.cfg; basepath is the "root" of your fpc tree
 
fpcmkcfg -d basepath=C:\freepascal\fpc\2.4.5 -o .\fpc.cfg
 
</syntaxhighlight>
 
{{Note|earlier instructions had \bin\i386-win32 appended to the basepath. This is not needed since at least FPC 2.4.4.}}
 
 
 
=== Create fpc.cfg manually ===
 
If the above doesn't work for you, you can copy/paste the code below to a new file named fpc.cfg to your fpc executable directory (or ~/.fpc.cfg or other location). Modify the paths so they match your situation.
 
 
 
$FPCVERSION is used to automatically determine the version of FPC being used for the compile. Using this variable allows this single fpc.cfg to be used with multiple fpc versions that have the same path structure making it easier to maintain multiple FPC installs.
 
 
 
<pre>
 
#
 
# Config file generated by fpcmkcfg on 24/12/2010 - 18:17:42
 
# Example fpc.cfg for Free Pascal Compiler
 
#
 
 
 
# ----------------------
 
# Defines (preprocessor)
 
# ----------------------
 
 
 
#
 
# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
 
#
 
# -d is the same as #DEFINE
 
# -u is the same as #UNDEF
 
#
 
 
 
#
 
# Some examples (for switches see below, and the -? helppages)
 
#
 
# Try compiling with the -dRELEASE or -dDEBUG on the commandline
 
#
 
 
 
# For a release compile with optimizes and strip debuginfo
 
#IFDEF RELEASE
 
-O2
 
-Xs
 
#WRITE Compiling Release Version
 
#ENDIF
 
 
 
# For a debug version compile with debuginfo and all codegeneration checks on
 
#IFDEF DEBUG
 
-glh
 
-Crtoi
 
#WRITE Compiling Debug Version
 
#ENDIF
 
 
 
# ----------------
 
# Parsing switches
 
# ----------------
 
 
 
# Pascal language mode
 
#      -Mfpc      free pascal dialect (default)
 
#      -Mobjfpc  switch some Delphi 2 extensions on
 
#      -Mdelphi  tries to be Delphi compatible
 
#      -Mtp      tries to be TP/BP 7.0 compatible
 
#      -Mgpc      tries to be gpc compatible
 
#      -Mmacpas  tries to be compatible to the macintosh pascal dialects
 
#
 
# Turn on Object Pascal extensions by default
 
#-Mobjfpc
 
 
 
# Assembler reader mode
 
#      -Rdefault  use default assembler
 
#      -Ratt      read AT&T style assembler
 
#      -Rintel    read Intel style assembler
 
#
 
# All assembler blocks are AT&T styled by default
 
#-Ratt
 
 
 
# Semantic checking
 
#      -S2        same as -Mobjfpc
 
#      -Sc        supports operators like C (*=,+=,/= and -=)
 
#      -Sa        include assertion code.
 
#      -Sd        same as -Mdelphi
 
#      -Se<x>    compiler stops after the <x> errors (default is 1)
 
#      -Sg        allow LABEL and GOTO
 
#      -Sh        Use ansistrings
 
#      -Si        support C++ styled INLINE
 
#      -SI<x>    set interface style to <x>
 
#        -SIcomCOM compatible interface (default)
 
#        -SIcorbaCORBA compatible interface
 
#      -Sm        support macros like C (global)
 
#      -So        same as -Mtp
 
#      -Sp        same as -Mgpc
 
#      -Ss        constructor name must be init (destructor must be done)
 
#
 
# Allow goto, inline, C-operators, C-vars
 
-Sgic
 
 
 
# ---------------
 
# Code generation
 
# ---------------
 
 
 
# Uncomment the next line if you always want static/dynamic units by default
 
# (can be overruled with -CD, -CS at the commandline)
 
#-CS
 
#-CD
 
 
 
# Set the default heapsize to 8Mb
 
#-Ch8000000
 
 
 
# Set default codegeneration checks (iocheck, overflow, range, stack)
 
#-Ci
 
#-Co
 
#-Cr
 
#-Ct
 
 
 
# Optimizer switches for i386 compiler
 
# -Os        generate smaller code
 
# -O1        level 1 optimizations (quick optimizations)
 
# -O2        level 2 optimizations (-O1 + slower optimizations)
 
# -O3        level 3 optimizations (same as -O2u)
 
# -Oa=N      set alignment to N
 
# -OoX      switch on optimalization X.
 
# -OoNOX    switch off optimalization X.
 
#              X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
 
# -OpCPU    set target processor.
 
#            CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM
 
 
 
 
 
# -----------------------
 
# Set Filenames and Paths
 
# -----------------------
 
 
 
# Both slashes and backslashes are allowed in paths
 
 
 
# path to the messagefile, not necessary anymore but can be used to override
 
# the default language
 
#-FrC:\freepascal\fpc\$FPCVERSION/msg/errore.msg
 
#-FrC:\freepascal\fpc\$FPCVERSION/msg/errorn.msg
 
#-FrC:\freepascal\fpc\$FPCVERSION/msg/errores.msg
 
#-FrC:\freepascal\fpc\$FPCVERSION/msg/errord.msg
 
#-FrC:\freepascal\fpc\$FPCVERSION/msg/errorr.msg
 
 
 
#IFDEF FPCAPACHE_1_13
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd13/
 
#ELSE
 
#IFDEF FPCAPACHE_2_0
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd20
 
#ELSE
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd22
 
#ENDIF
 
#ENDIF
 
 
 
# searchpath for units and other system dependent things
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/*
 
-FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/rtl
 
 
 
# path to the gcclib
 
 
 
 
 
# searchpath for libraries
 
#-FlC:\freepascal\fpc\$FPCVERSION/lib
 
#-Fl/lib;/usr/lib
 
 
 
# searchpath for tools
 
-FDC:\freepascal\fpc\$FPCVERSION/bin/$FPCTARGET
 
 
 
#IFNDEF CPUI386
 
#IFNDEF CPUAMD64
 
#DEFINE NEEDCROSSBINUTILS
 
#ENDIF
 
#ENDIF
 
 
 
#IFNDEF Win32
 
#DEFINE NEEDCROSSBINUTILS
 
#ENDIF
 
 
 
# binutils prefix for cross compiling
 
#IFDEF FPC_CROSSCOMPILING
 
#IFDEF NEEDCROSSBINUTILS
 
-XP$FPCTARGET-
 
#ENDIF
 
#ENDIF
 
 
 
 
 
# -------------
 
# Linking
 
# -------------
 
 
 
# generate always debugging information for GDB (slows down the compiling
 
# process)
 
#      -gc        generate checks for pointers
 
#      -gd        use dbx
 
#      -gg        use gsym
 
#      -gh        use heap trace unit (for memory leak debugging)
 
#      -gl        use line info unit to show more info for backtraces
 
#      -gv        generates programs tracable with valgrind
 
#      -gw        generate dwarf debugging info
 
#
 
# Enable debuginfo and use the line info unit by default
 
#-gl
 
 
 
# always pass an option to the linker
 
#-k-s
 
 
 
# Always strip debuginfo from the executable
 
-Xs
 
 
 
 
 
# -------------
 
# Miscellaneous
 
# -------------
 
 
 
# Write always a nice FPC logo ;)
 
-l
 
 
 
# Verbosity
 
#      e : Show errors (default)      d : Show debug info
 
#      w : Show warnings              u : Show unit info
 
#      n : Show notes                  t : Show tried/used files
 
#      h : Show hints                  m : Show defined macros
 
#      i : Show general info          p : Show compiled procedures
 
#      l : Show linenumbers            c : Show conditionals
 
#      a : Show everything            0 : Show nothing (except errors)
 
#      b : Show all procedure          r : Rhide/GCC compatibility mode
 
#          declarations if an error    x : Executable info (Win32 only)
 
#          occurs
 
#
 
# Display Info, Warnings, Notes and Hints
 
-viwn
 
# If you don't want so much verbosity use
 
#-vw
 
</pre>
 
 
 
=== Testing and batch file/shortcut usage ===
 
You can also explicitly specify a fpc.cfg to use:<bash>fpc -n -@/path/to/fpc.cfg</bash>. Handy for testing, creating shortcuts/shell scripts, having multiple FPC installations etc.
 
 
 
If that does not work, you can try to create fpc.cfg manually: copy over an existing fpc.cfg from a working installation and change the paths.
 
  
== Mixing FPC versions ==
+
Troubleshooting details that should (hopefully) be applicable across platforms may be found in the article [[Installation Troubleshooting]].
If your FPC cannot find its sources/ppu files while fpc.cfg has the right paths, another cause could be that the fpc executable is a different version than the (link to) ppc<architecture> compiler.
 
  
When compiling with fpc, fpc starts e.g ppc386 to compile for x86 targets. Please make sure fpc and ppc<architecture> are compiled by the same version/sourced from the same package.
+
== Lazarus FAQ ==
  
== Lazarus can't find sources ==
+
The Lazarus FAQ - Frequently Asked Questions - page is available [[Lazarus_Faq|here]].
There may be a message saying Lazarus can't find the sources; if so, go to the menu at the top and select Environment -> Environment options and insert the name of the directory where you expect to find your lazarus files (eg ~/FreePascal/lazarus), your compiler (e.g. /usr/local/bin/ppc386), the Free Pascal source directory (e.g. /usr/local/lib/fpc/$version/fpc or a directory in your own space e.g. ~/FreePascal/fpc). Then close the dialog and start programming.
 
  
== Paths in Lazarus options and project options ==
+
== Installing old versions ==
Note that you can set paths (for compiler, FPC units etc) in the general options settings. Options you specify in Project Options can override these per project.
 
If you experience path-related problems in a project but not in another, you might check if you mistakenly override general options.
 
  
=Installing old versions=
 
 
See [[Installation hints for old versions]]
 
See [[Installation hints for old versions]]
  
 +
== See also ==
  
{{AutoCategory}}
+
* [[Lazarus Installer|Creating your own Lazarus Windows installer]]
[[Category:FPC]]
 
[[Category:Lazarus]]
 
[[Category:Install]]
 

Latest revision as of 03:35, 19 September 2020

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) 日本語 (ja) 한국어 (ko) português (pt) русский (ru) slovenčina (sk) Tiếng Việt (vi) 中文(中国大陆)‎ (zh_CN)

Overview

A real "in depth" build guide is here.

For binary downloads of Lazarus see Download and install Lazarus release version.

For people who simply want to install Lazarus and start using it for programming, the easiest approach is to download and install a recent, reasonably stable binary release (such as a Linux ".rpm" package, a Windows ".exe" installer, or a macOS ".dmg" package). You can read the sections under Linux or Windows entitled "fpc binaries" or the first paragraphs in the sections on installing Lazarus in Linux or Windows; most of the remaining information can be safely ignored.

For those who want to participate in the development of the compiler or the IDE, or for those who want the most up-to-date tools, an installation from source files is necessary, and much of the rest of this information is relevant.

Lazarus provides two main parts:

  • LCL - the Lazarus Component Library
  • IDE - the RAD tool

These in turn are dependent on:

  • FPC - the Free Pascal compiler
  • FCL - the Free Pascal Component library, containing most of the non-graphic components used by Lazarus

Lazarus system requirements

  1. A Free Pascal Compiler, packages, and sources. (*Important*: of the same version/date)
  2. A supported widget set:
    Win32/Win64
    The native Win32 API can be used, or the Qt widgetset.
    Linux/BSD
    GTK+ 2.x or Qt : Most Linux distributions and *BSDs already install the GTK+ 2.x libraries. You can also find them at http://www.gtk.org.
    Qt is also supported with all distributions (auto installed if you prefer KDE).
    macOS
    You need the Apple Xcode developer tools. For macOS versions before 10.15 (Catalina), the 32 bit Carbon or 64 bit Cocoa widget sets can be used.
    For macOS 10.15 onwards, the 64 bit Cocoa widget set must be used as all 32 bit support has been removed by Apple.
    Qt can be used too, but it requires much more effort.
The Qt widget set is supported on Linux 32/64, Win 32/64, macOS 32/64, FreeBSD 32/64, Haiku and embedded Linux (qtopia) platforms. For more details about the installation of Qt, see the Qt Interface article.

Operating system specific guides

While the remainder of this page has much valuable information, many users may need no more than the following operating system specific guides.

FreeBSD

Haiku

Linux

macOS

Raspbian

Windows

By far the easiest and most common way to install Lazarus on windows is to go to the Lazarus SourceForge download site, https://sourceforge.net/projects/lazarus/files/ select an appropriate combined FPC/Lazarus package, download and install.

Installing Lazarus

Ubuntu/Debian Linux

It is recommended to use the fpcUP updater-installer for first time users of Lazarus, which installs Free Pascal and Lazarus in one go into a single subdirectory structure ( ~/development ).

A way to get a current working installation of Lazarus is to download the .deb files for Free Pascal and Lazarus from the SourceForge repository. Here is how: Getting Lazarus from our Ubuntu repository.

Note that installing from the default Ubuntu sources will not install the Free Pascal Source Libraries - use the method above.

Note-icon.png

Note: on Linux Ubuntu at least, the command to start Lazarus from a console is startlazarus. If you installed it from a Debian package, you should have a Lazarus menu entry under Application/Programming. (Issue: there is an ambiguity with a program also called "lazarus" from a "tct" package available for Ubuntu).

Building debs the easy way

The easiest way to get a current working installation of Lazarus is to download and build your own .deb packages by following the instructions at How to setup a FPC and Lazarus Ubuntu repository

Installing using rpms

The next easiest way is to download the RPMs for Free Pascal and Lazarus from the SourceForge repository.

You need to download the selected version of:

  • the compiler (eg fpc-3.0.4-1.i686.rpm)
  • the pascal source library (eg fpc-src-3.0.4-2.i686.rpm)
  • the Lazarus package (eg lazarus-2.0.8-0.i686.rpm).

Uninstall the old packages:

rpm -ev lazarus
rpm -ev fpc
rpm -ev fpc-src

Install the new packages:

rpm -ivh fpc-*
rpm -ivh lazarus-*

Arch or Manjaro Linux (aarch64)

To install Free Pascal and Lazarus, see Install on aarch64 Arch or Manjaro.

Fedora Linux

Recent packages of Lazarus and Free Pascal are included in Fedora by default. See Install on Fedora on how to install them.

Scientific Linux

Scientific Linux is an RPM-based distribution focussing on science and research. See Scientific Linux for details.

Debian GNU Linux

There are preliminary Debian packages for lazarus available for download. They are not the latest versions, however. Make sure you read /usr/share/doc/lazarus/README.Debian carefully before you start using it. Feedback is needed and appreciated; please send your comments to Carlos Laviola <claviola@debian.org>.

Note that for a fully working Lazarus install, no older or incompatible versions of, for example, the fpc source or fpc compiler must be installed. Remove them by typing

dpkg -r <package name>

without .deb extension. And then install the newest versions as described.

From source on Linux

If you prefer to install from source and compile the files yourself, follow these instructions. Because the whole Lazarus toolchain is installed into one directory, uninstall is very easy and you don't need to be root to install Lazarus. You can get tgz files for FPC, the FPC source and Lazarus from the downloads section or you can download it directly via svn.

Here is an example of installing 0.9.28 to Ubuntu 6.06. If you understand Linux commands and bash script, you can get what steps are needed. Just copy the script (change the version number when a new version has been released), paste it into a text editor, and save it as something like "install_lazarus.sh". Give it execute permission, and run it in a console.

Note-icon.png

Note: In this example, FPC is installed in /opt. So when prompted 'Install prefix', enter '/opt/fpc'.

#!/bin/sh
  
# Installing the required packages
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install libgdk-pixbuf-dev
  
# Installing the Free Pascal source
cd /opt
sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-src-2.4.2.source.tgz
sudo tar -xvf fpc-src-2.4.2.source.tgz
sudo mv fpc fpcsrc
  
# Installing the Free Pascal binaries
sudo mkdir fpc
cd fpc
sudo wget http://nchc.dl.sourceforge.net/lazarus/fpc-2.4.2.i686-linux.tar
sudo tar -xvf fpc-2.4.2.i686-linux.tar
echo "Enter '/opt/fpc' when prompted 'Install prefix'"
sudo sh install.sh
  
# Adding the FPC path to the PATH
echo "#FPC PATH" >> ~/.bash_profile
echo "if [ -d /opt/fpc/bin ] ; then" >> ~/.bash_profile 
echo PATH=/opt/fpc/bin:"${PATH}" >> ~/.bash_profile
echo "fi" >> ~/.bash_profile
  
# Installing the Lazarus IDE
cd ../
sudo wget http://nchc.dl.sourceforge.net/lazarus/lazarus-0.9.30-0.tar.gz
# sudo wget https://downloads.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.0RC5/lazarus-1.8.0-RC5.tar.gz
sudo tar -zxvf lazarus-0.9.30-0.tar.gz
PATH=/opt/fpc/bin:"${PATH}"
sudo chmod -R 777 lazarus
cd lazarus
make clean all bigide
./lazarus
Note-icon.png

Note: You have to manually set fpc-src path in the Environmental Options.

Downloading Lazarus Source Code

Both the Lazarus and FPC source code reside in SVN/subversion repositories. SVN provides an easy way to update your sources by only downloading the changes. This is the recommended way and saves you a lot of time. A connection to the internet is needed for this, but you don't need to be root.

Please note these instructions are for subversion, but there is also a Git mirror repository of Free Pascal Compiler and Lazarus: see Git mirror. You can also use git directly with the subversion server using git-svn link: see Lazarus git-svn.

Lazarus does not need any special permissions, neither during installation nor at runtime.

If you decide to use TortoiseSVN, remember to check "command line client tools" during its installation if you want Lazarus to show the SVN revision number in the About dialog.

Now get the Lazarus source:

 svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus

(replace the last lazarus with any other dir where you want to place your sources)

On subsequent occasions, to update simply type:

 svn update lazarus

For more information on Subversion, see: http://subversion.tigris.org/

Compiling and running

When you have checked out the source from svn, the next step is:

Compile Lazarus
 cd lazarus
 make bigide

If FPC is installed correctly, the compilation should work without problems. If not, see the Lazarus FAQ.

Start lazarus
./lazarus

The Lazarus IDE should start. If you started lazarus in a terminal, you can see some notes about missing settings. This is normal at first start. The IDE automatically tries to find out where the Free Pascal compiler and its sources are installed by searching in the most common directories.

Check the paths
Use the IDE menu to go to
Environment -> Environment Options -> Files

The 'FPC Source directory' should point to your fpc source directory. This directory normally ends with /fpc/ or /fpcsrc/ (e.g. /usr/src/fpcsrc or /home/username/freepascal/fpc) and contains directories like 'compiler', 'docs', 'fcl', 'rtl' and 'packages'.

See here for the documentation about this dialog: IDE Options.

Hint

To update lazarus you can use:

 svn update lazarus

then for either update path:

 make clean all bigide

This will rebuild Lazarus and create an IDE without your installed Lazarus packages. To link your installed packages do after the above:

./lazbuild --build-ide=

You may have to append other options if for example you use a custom config directory. See lazbuild.

Windows

The current releases of the Windows Lazarus binary packages install very easily, and should work 'out-of-the-box'. Upgrading is as simple as downloading the new installer and running it.

Win98 and WinME need a special flag to compile. You need to use make OPT="-dWIN9XPLATFORM" otherwise the lazarus.exe will not be able to run on these operating systems.

Installing Lazarus on Portable USB Drive

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 fpc.cfg file. It may also be necessary to keep the directory for test compilation on your portable drive.

<< 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?

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:

set THUMBDRIVE=%CD:~0,2%

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:

%SystemRoot%\system32\cmd.exe /k bin\setenv

so that when I click on that link when the thumb drive folder is diplayed after inserting it, it will open a command prompt at the thumb drive with the environment variables set from setenv.bat.

Also inside the bin directory is sed (the actual binary is one I obtained from the mingw distribution). So I created another batch file called fixlaz.bat 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 fixlaz.bat, not the current one of your USB drive which fixlaz.bat 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 editoroptions.xml and fpc.cfg files (fpc.cfg is the the fpc bin directory, which might be buried deep in the lazarus folder):

copy %THUMBDRIVE%\lazarus\environmentoptions.xml %THUMBDRIVE%\lazarus\environmentoptions.bak
sed -e 's/%1/%THUMBDRIVE%/g' %THUMBDRIVE%\lazarus\environmentoptions.bak > %THUMBDRIVE%\lazarus\environmentoptions.xml

So to use it, I would type at the command prompt of the USB drive:

fixlaz G:

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 setenv.bat). 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. >>

The binary package is available for Linux and Windows from http://sourceforge.net/project/showfiles.php?group_id=89339

Download the latest release and launch the application. You will be taken through a typical Windows installation, in which the FPC compiler and source libraries are installed within the same directory structure as Lazarus, and the IDE should launch and operate without significant problems, provided you have uninstalled(!!!) any previous version of Lazarus and/or FPC (often found in the C:\pp directory).

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.

From source on Windows

If you prefer to install from sources, then follow these instructions.

Please note these instructions are for SubVersion, but there is also a Git mirror repository of Free Pascal Compiler and Lazarus. See Git mirror for details. You can also use git directly with SubVersion server using git-svn link. See Lazarus git-svn for details.

Open a command prompt window. Start->Run...>CMD or choose MS-DOS icon. You will use this window to enter the commands below

You have to download the lazarus source from one of the snapshots servers. Then unzip it to c:\lazarus for example [below called $(LazarusDir)].

Or you use SVN (example for text mode SVN; adapt to GUI tools such as TortoiseSVN if you want to):

mkdir c:\lazarus
cd /d c:\lazarus
svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ c:\lazarus

You have to install at least the latests stable FPC version (e.g. FPC 3.0.4, but an FPC 3.1.1 snapshot is also possible).

Type (replace "YourLazarusDir" with the path you have unzipped/checked out Lazarus; replace

cd "YourLazarusDir"
rem Of course change the first path variable to
rem the path of your FPC compiler
set path=c:\freepascal\bin\x86_64-win64;%PATH%
make
  • Win9x/WinME: use make OPT="-dWIN9XPLATFORM" otherwise the lazarus.exe will not be able to run on this platform.

If this works, you can type: lazarus.exe.

You can compile examples also:

cd "YourLazarusDir"\examples
make

Installing from source starting with a stable release

An alternative version of the instructions above.

1> First of all install the latest stable Lazarus to obtain a good starting FPC, for example in C:\lazarus_1_4

2> Now use TortoiseSVN to checkout http://svn.freepascal.org/svn/lazarus/trunk/ into c:\lazarus

3> Make the following C:\lazarus\build.bat file:

Replace $(LazarusDir) with your Lazarus did and make sure the FPC version number matches

SET PATH=$(LazarusDir)\fpc\2.6.4\bin\i386-win32\
make bigide

Now create a shortcut in 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:

$(LazarusDir)\startlazarus.exe --pcp=$(LazarusDir)\configdir

Always start Lazarus from this shortcut, never directly from the executable. At the first time you start Lazarus configure you FPC dir, FPC sources dir and Lazarus dir.

Building Lazarus on Win98 and WinME

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".

What does the bigide make argument do?

The bigide make argument adds a bunch of packages to Lazarus that many find useful and accent dow 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