User:Swen/Installing Lazarus

From Free Pascal wiki
Jump to navigationJump to search

This page is under construction.

Introduction

Lazarus System Requirements

Download locations

stable versions: Sourceforge

snapshots: http://www.hu.freepascal.org/lazarus

Installing under Linux

General

Ubuntu

The current version 9.10 contains a Lazarus package (version 0.9.26.2-2). This package can easily be installed via Synaptic. The provided fpc version is 2.2.4-3.

Alternatively the repository from www.hu.freepascal.org can be used (this repository is maintained by Vincent Snijders).

Short version: get Lazarus

In the sections that follow, there's a complete list of the commands you need to type at the console to download and install Lazarus on an Ubuntu system. If you're impatient, this section will just give you what you need to get it installed without going through every part of the process line by line.

Select and copy the following script, and save it as a file in your home directory named getlaz:

 #!/bin/sh
 gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 6A11800F
 gpg --export 6A11800F | apt-key add -
 echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe" \
     >/etc/apt/sources.list.d/lazarus.list
 apt-get update
 apt-get install lazarus

At the shell prompt, type this to prepare the script for execution, and to execute it (you can copy these lines and paste them into your shell using Shift+Insert):

 chmod +x getlaz
 sudo ./getlaz

The process will download around 100Mb of data from the Lazarus repository and the standard ones. It will take at least five minutes, even with a fast connection. Any time it stops to ask for confirmation of any step, answer "Y" for yes.

When it finishes and returns to the shell prompt, you're set. Look in the "Development" section of your Ubuntu menu; Lazarus will be there and functional.


Now, for completists, here's the same instruction step by step. You can ignore it if you followed the above instructions successfully. Please remember to come back to the wiki and put in any tested, reliable changes that might clarify this section!

Add the key

Download the key from the public key server:

 gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 6A11800F

Add it to the apt system:

 gpg --export 6A11800F | sudo apt-key add -

You can see the list of apt keys with:

 sudo apt-key list

Add the repository

You can use synaptic for this or edit the /etc/apt/sources.list directly. For the stable repository, add the line:

 deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe

Or using a console app. do:

 echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe">/etc/apt/sources.list.d/lazarus.list

For the testing repository:

 deb http://www.hu.freepascal.org/lazarus/ lazarus-testing universe

Or similarly, using a console app. do:

 echo "deb http://www.hu.freepascal.org/lazarus/ lazarus-testing universe">/etc/apt/sources.list.d/lazarus.list

Install Lazarus

Now you can install Lazarus with apt:

 apt-get update; apt-get install lazarus

The repository currently contains Lazarus version 0.9.28.2-0.

Other repository

There is an other repository, which provides a recent lazarus package. Add the following lines to your software sources:

deb http://ppa.launchpad.net/ximion/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/ximion/ppa/ubuntu karmic main

To get the key for this repository you can use

gpg --recv-keys 4BF17E057EC6E8C3 --keyserver hkp://wwwkeys.eu.pgp.net

The repository currently contains Lazarus version 0.9.28.2-7. But it also contains the packages libqt4pas5 and libqt4pas-dev, which are needed to build qt based applications (including a qt based Lazarus). Note: The last named packages probably will be contained in Ubuntu 10.10.

Mandriva (needs to be updated)

Lazarus 0.9.28 on Mandreva 2010.

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.

Lazarus 0.9.28 on Mandriva 2009 (2009.0) (i386) (GTK-2)

Not much has changed compared to Mandriva 2007. The following instruction shall not differ for an x86_64 architecture.

1/ Do not install FPC from Drake. If you have done so, desinstall it. Since Mandriva does not provide the complete set of tools (FPC+sources+documentation+Lazarus) it is better, in my opinion, to have complete control on all of them through rpms.

2/ Collect fresh rpms on sourceforge (http://sourceforge.net/project/showfiles.php?group_id=89339): select the RPM version of the latest lazarus release compatible with your architecture and download fpc, fpc-src, fpc-docs and lazarus RPMs.

3/ Browse the directory where you downloaded the RPMs (with Nautilus or whatever file browser your using) and double click on the RPMs in this ordrer:

  (a) fpc-<version>-<arch>.rpm
  (b) fpc-docs-<version>-<arch>.rmp
  (c) fpc-src-<version>-<arch>.rpm
  (d) lazarus-<version>-<arch>.rpm

4/ It is possible that the Drake (the software that will manage your RPMs) will complain about missing libraries or tools. Use Drake to collect them. For instance, you shall have installed developpement tools such as "GNU Make". Search and if necessary install "GNU Make". You might be missing the ld (the linkage utility), you can install for instance the "gcc" package.

5/ As before, it is possible to search for and install "galaxy-gnome" and "gtk-switch" with Drake. Nonetheless, they are not required for Lazarus to work properly. Gnome Galaxy are a set of cool themes you can use in the System menu->Preferences->Themes.

6/ Lazarus might complain about the FPC sources that are not correctly set. Go to Configuration->Environement then set the FPC sources directory to your local installation (it should be /usr/local/fpcsrc/<version>/).

7/ When launched, the libcanberra-module-gtk might not be found. I tried to build a symlink (ln -s) but if Lazarus manages to find this library... it crashes. It might be safer to ignore this error.

8/ Have fun with the coolest RAD of the Free World.

Lazarus 0.9.26 on Mandriva 2007 (2007.0) (i386) (GTK-1)

Installation in Mandriva is very easy. However, there are a few points to check as the installation proceeds. Here is a typical installation using the .tar modules (see the trick for the theme at the end of the procedure!):

- During the Mandriva installation, select the "Gnome desktop" group. Although you will use lazarus in KDE or other desktop, this will install some GTK modules needed by the lazarus environment.

- Install the FPC 2.2.2 compiler using either the .rpm or .tar, modules. Using the .tar modules you would type: "sh install.sh" then RETURN many times. I do this in superuser mode.

- Install the compiler source code. just untar the file "fpc-src-2.2.4.source.tgz" in the folder /usr/local/src/fpc/ then rename the created folder "fpc" to "2.2.2" . When complete, you have the folder /usr/local/src/fpc/2.2.2/ that contains all the source code. The source code is only needed by lazarus editor, but you can recompile FPC and have an optimized version of the libraries, and show that everything is working well:

- If you want to compile FPC (optional), then go to the FPC source directory (/usr/local/src/fpc/2.2.4/) and type "./configure", "make clean","make all","make install","make clean". FPC is now installed. Check the content of "/etc/fpc.cfg". This file has to be modified when the make fails.

- Lazarus can be installed in user mode: just unzip/untar the file "lazarus-0.9.26.0.tar.gz" in your user directory. Then just type "make clean all" in the user mode. The last phase of the process (link) usually fails due to missing library files:

- Check in the directory /usr/lib/ for the following symbolic links:

libglib.so -> libglib-1.2.so.0

libgtk.so -> libgtk-1.2.so.0.9.1

libgdk.so -> libgdk-1.2.so.0.9.1

libgdk_pixbuf.so -> libgdk_pixbuf.so.2.0.0

The file "libgdk_pixbuf.so.2.0.0" is included in the module "libgdk_pixbuf-2.0.22.0-10mdv2007.0.rpm" This file name is critical. In particular, DO NOT use "libgdk_pixbuf-2.0.so.0" (misleading isn't!).

After all the links have been fixed, the "Linking ../lazarus" stage will not crash any more and the "./lazarus" command should start the program!

- Go to the "environment/environment options" menu and change the "FPC source directory" to /user/local/src/fpc/2.2.4

USEFUL TO KNOW:

- The last step is to fix the theme. The package "galaxy-gnome-1.0.4-3mdv2007.0" is available in the Mandriva control center. Install it.

- The package "gtk-theme-switch-1.0.1-4mdv2007.0.i586.rpm" is available on the web! (strangely it did not show in the control center) Install it manually by typing "rpm -iv --test gtk-theme-switch-1.0.1-4mdv2007.0.i586.rpm" then retype the line without the "--test" in my case there was a warning message related to the signature. I decided to ignore it!

- in the USER MODE, type "switch", then chose "galaxy" theme.

The Lazarus / FPC tool is now installed!

Lazarus 0.9.28 on Mandriva 2007/or -2006 32 bit

Write this urpmi-command as root:

urpmi http://surfnet.dl.sourceforge.net/sourceforge/lazarus/lazarus-0.9.28-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-2.2.4-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-docs-2.2.4-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-src-2.2.4-0.i386.rpm

Lazarus 0.9.28 depends on fpc 2.2.4 and Mandriva 2007 is shipped with fpc-2.1.1-0.2mdk.i586. To prevent your system to upgrade to fpc-2.1.1 or newer in the future, when you run commands as urpmi --auto-select, you can write fpc in /etc/urpmi/skip.list.

Lazarus 0.9.28 on Mandriva 2009 32 bit

Installation needs similar action as above. Because the distribution comes with fpc-2.2.4-1, it is necessary to uninstall this package. Write following commands as root:

rpm -e fpc
urpmi http://surfnet.dl.sourceforge.net/sourceforge/lazarus/lazarus-0.9.28-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-2.2.4-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-docs-2.2.4-0.i386.rpm http://surfnet.dl.sourceforge.net/sourceforge/lazarus/fpc-src-2.2.4-081004.i386.rpm

And place fpc in /etc/urpmi/skip.list.

Lazarus untested snapshot on Mandriva 2007 32 bit

urpmi $(for RPM in $(lynx --source http://michael-ep3.physik.uni-halle.de/Lazarus/ | grep i386.rpm | cut -d '"' -f 4-4) ; do echo -n http://michael-ep3.physik.uni-halle.de/Lazarus/$RPM ' '; done )

Installing Lazarus + fpc For Mandriva X86_64

This has worked for Mandriva 2007.0 X86_64 (AMD X2 4800+).

fpc-2.2.4-0.x86_64.rpm
fpc-src-2.2.4-091006.x86_64.rpm
lazarus-0.9.28-0.x86_64.rpm
  • To download and install the current snapshot:

urpmi $(for RPM in $(lynx --source http://michael-ep3.physik.uni-halle.de/Lazarus/ | grep 64.rpm | cut -d '"' -f 4-4) ; do echo -n http://michael-ep3.physik.uni-halle.de/Lazarus/$RPM ' '; done )
You might have to install lynx and make first: urpmi lynx make.

  • Once the RPMs have been installed. Run lazarus for the first time. It will pop up a dialog complaining that the "/usr/bin/ppc386" and "/usr/lib/lazarus" are not valid. Accept ("OK") the alternate choices it suggests.
  • When compiling your first project, you may find that lazarus complains of missing libs (e.g. gdk, glib, etc.). Install the necessary libs as needed, I installed these (that I recall, YMMV):
glib-devel
lib64gtk+1.2-devel
lib64gtk+2.0_0-devel
lib64gdk-pixbuf2
lib64gdk-pixbuf2-devel

Slackware

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.

Please note that you will NOT be able to install lazarus on gtk, therefore you MUST use the "LCL_PLATFORM=gtk2" statement. Slackware only provides the KDE enviroment, but the gtk2 type panels are fully supported (no extra installation required). At most, there is one or two symbolic link to add!

Installing Lazarus 0.9.28, for Slackware 12.0 users

This have worked in Slackware-12.0 on a Pentium-3 computer:

  • The Free Pascal Compiler (FPC) is installed in SUPERUSER mode
  • 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
  • The GTK-2 widget set is used ("LCL_PLATFORM=gtk2")

-- Download "fpc-2.2.4.i386-linux.tar" in a user folder and install it. Go to this folder and type:

 bash-3.1$ tar -xvf fpc-2.2.4.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.2.4 [] for i386 
 Copyright (c) 2008 ...
 ...
 ...

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.2.4.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:

 bash-3.1$ tar -xvzf fpc-2.2.4.source.tar.gz
 bash-3.1$ cd fpc-2.2.4
 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.2.4 [...] for i386 
 Copyright (c) 2008 ...
 ...
 ...

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.2.4.source.tar.gz" again and I copy it to the /usr/local/src/FPC folder:

 bash-3.1$ su
 bash-3.1$ password: xxxxxxxx
 bash-3.1# cp fpc-2.2.4.source.tar.gz /usr/local/src/
 bash-3.1# cd /usr/local/src/
 bash-3.1# tar -xvzf fpc-2.2.4.source.tar.gz
 bash-3.1# rm fpc-2.2.4.source.tar.gz
 bash-3.1# exit

The version number is included in the folder name "fpc-2.2.4". 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.28-0.tar.gz" file, but here we can also get the latest development version from the SVN server:

  bash-3.1$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

This is for the first time you load it. Next time you will only need to type:

  bash-3.1$ svn update

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:

  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

-- At this point you have the folder "~/lazarus" containing the source code. You should compile it very simply:

  bash-3.1$ make clean all LCL_PLATFORM=gtk2

The "LCL_PLATFORM=gtk2" means of course that you will develop your applications in GTK-2. The default widget set for lazarus is GTK-1 but you will not be able to use it in Slackware 12.0. I strongly recommend that you use the "LCL_PLATFORM=gtk2" option now. After a few minutes, the compiler stops:

  ...
  ...
  Linking ../Lazbuild
  987 linescompiled ...
  make [2] leaving ...
  make [1] leaving ...
  bash-3.1$

-- Just type:

  bash-3.1$ ./lazarus

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->Environment_Options->Files". As explained earlier, on my computer this should point to "/usr/local/src/fpc-2.2.4". Note that when you change this folder, you should click on "Environment / Rescan_FPC_source_directory".

Voila!

Suse (needs to be updated)

Installing Lazarus 0.9.28. For openSUSE 11.1 users

Free Pascal Compiler requires:
- Gnu binutils (gnu as, gnu ld, gnu make) These utils can be installed by:

 zypper in -t pattern devel_basis

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:

 zypper -n install gtk2 glib2

Download these binary files (RPM)

  • fpc-2.2.4-0.i386.rpm (yes i586 and not i386)
  • fpc-src-2.2.4-0.i386.rpm
  • lazarus-0.9.28.2-0.i586.rpm

install them opening a terminal session (mouse's right button -> Menu: Open in terminal)

 rpm -Uvh fpc-2.2.4-0.i386.rpm
 rpm -Uvh fpc-src-2.2.4-0.i386.rpm
 rpm -Uvh lazarus-0.9.28.2-0.i586.rpm

Fedora

Lazarus is part of the standard Fedora-repositories since Fedora version 9. You can install it using the command-line ('yum install lazarus') or by using the 'add/remove software' wizard. If you want to install Lazarus during the installation of Fedora, you have to enable the additional repositories during install.

Once installed you can find Lazarus in the 'Applications/Programming' menu.

Note that if you want to develop gtk2 applications, you also have to install 'gtk2-devel'.

Fedora Core 11

Needed packages:

gtk2-devel glibc-devel binutils

Useful packages for development:

subversion wget gcc bison rpm-build

Debian (needs to be updated)

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.

Another way to install Lazarus under Debian

Added by User:Kirkpatc.

Simple Lazarus Installation in Debian

(assume new Debian installation, without development libraries loaded)

From sourceforge repository, download latest fpc, fpclib and lazarus releases; follow links from http://lazarus.freepascal.org, click the "downloads" button on the left, then click on "binaries" then "linux" then "Current Lazarus RPM". This will bring you to

http://sourceforge.net/project/showfiles.php?group_id=89339

then download the following files (or more recent, if available)

  • fpc-2.0.0-0.i586.rpm
  • fpcsrc-2.0.0-0.i386.rpm
  • lazarus-0.9.8-fpc_2.0.0_0.i386.rpm

cd to the directory where these files are stored, then become root (su) and type:

alien -c fpc*     //this will convert both the fpc and fpcsrc files to debian format and convert the install scripts
alien -c laz*

then install the generated Debian (.deb) packages by (as root):

dpkg -i fpc*.deb laz*.deb

or use kpackage or a similar utility to install the generated fpc, fpcsrc and lazarus .deb files.

And if you do not have alien type:

apt-get install alien 

Please note that, on Linux distributions like Ubuntu, you'll have to add 'sudo' in front of all commands. In Ubuntu previous command would be

sudo apt-get install alien

You need to produce a configuration file, which will reside in /etc/fpc.cfg. Still as root, cd to the main fpc directory /usr/lib/fpc/2.0.0 and then type

sh ./samplecfg /usr/lib/fpc/2.0.0 /etc

Check the contents of your new configuration file (cat /etc/fpc.cfg) and make any changes you want using vi or another text editor. Also make sure that there are no old configuration files in for example your home directory (~/.fpc.cfg).

You need to install the development packages of the GTK and pixbuf libraries, so

apt-get install libgtk2.0-dev
apt-get install libgdk-pixbuf-dev

Then you should be ready to start programming!

Installing under Windows

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 - the release contains the current versions of the FreePascal compiler and the FreePascal libraries as well as the lazarus IDE. If you want to install from sources, read on!

You can get the installer zip for fpc 2.4.0 at Free Pascal's download section http://www.freepascal.org/download.html, 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 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.html 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:

 C:\Source> svn co http://svn.freepascal.org/svn/svn/trunk fpc

Hint: To download/update the latest changes you can simply do

 C:\> cd Source\FPC
 C:\Source\FPC> svn up

ToDo: Write me.

See: http://www.freepascal.org/down/i386/win32.var . You can find a list of mirrors at http://www.freepascal.org/down/source/sources.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) -> Enviroment Variables -> System Variables -> Edit "PATH", Add "C:\pp\bin\bin\win32" there.

Then restart windows.

ToDo: Explain how to download fpc sources and build the compiler

Using TortoiseSVN for Windows

TortoiseSVN integrates itself with Windows Explorer. After installation, all commands are available from inside Windows Explorer through right-clicking on a directory or file.

Check out a working copy using TortoiseSVN, go to Run and paste the command below:

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

To get Lazarus for the first time:

  • Open Windows Explorer
  • Create a directory where you want to put the files from the SVN server
  • Right click on the newly created directory
  • Select SVN Checkout... on the popup menu

TortoiseSVN Main Menu.png

  • In the next dialog you enter the URL for Lazarus server source:
http://svn.freepascal.org/svn/lazarus/trunk
  • Watch how TortoiseSVN imports the file tree from the server. This can take some time to complete.


To update Lazarus sources:

  • Open Windows Explorer
  • Right click on the source directory
  • Select SVN Update on the popup menu

TortoiseSVN Main Menu Update.png

Installing under BSD (needs to be updated)

FreeBSD 5+

The latest version of Lazarus into FreeBSD port tree is 0.9.22. We can to install lazarus using FreeBSD ports.

[]# cd /usr/ports/editors/lazarus && make install clean clean-depends

If you get the messages about missing source files, go to [menu bar >> 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

Good luck, that worked for me. --Jrmarino 21:29, 4 Jan 2006 (CET)

PC-BSD 1.0rc1+

You can install Lazarus on PB-BSD by simply downloading the Lazarus PBI from 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 under Mac OS X

Apple Developer Tools

You need the Apple Developer tools. They can be installed from the original OSX installation CDs or downloaded from the Apple Developer Connection (ADC), which requires free registration: http://developer.apple.com/.

Install Packages / Released version

Installation from disk images

Download and install the three packages FPC, FPCSrc and Lazarus in this order: https://sourceforge.net/project/showfiles.php?group_id=89339

This is the easiest way to install Lazarus on Mac OS X. The FPC sources are installed under /usr/local/share/fpcsrc.

Installation using fink

Installing lazarus using fink, a package manager for Mac OS X, offers easy installation of a huge number of additional open source libraries as well as the clean removal of packages. At the moment, the choice is between an Aqua and a gtk2 look of lazarus:

$ fink install lazarus-aqua

or

$ fink install lazarus-gtk2

When asked to install some required packages, such as fpc, simply answer with RETURN or yes.

After installation, Lazarus can then be started from the folder /Applications/Fink/

With both looks, the following widgetsets for your program are supported:

carbon, gtk2, nogui

After the additional installation of the lazarus-common-gtk1 package, gtk1 legacy projects are also supported, but only on 10.4 and 10.5. On 10.6 gtk1 is deprecated.

On IntelMacs the following additional widgetsets are supported: carbon for powerpc, win32 and wince.

Installation using SVN

To get the current development version see below.

Install from Source / Development version

You need the latest stable released FPC installed in order to compile the development version.

Download and install a compiler

Download and install the FPC package: https://sourceforge.net/project/showfiles.php?group_id=89339

There are two development versions of the compiler: 2.4.x is stable version without new features - only bug fixes. And the unstable 2.5.x with lots of new features and bugs. The 2.2.0 version has a bug and can not be used to compile the 2.2.4 nor 2.5.1. Best is to download and install fpc 2.2.4. Some daily snapshots can be found here. Keep in mind that these are daily snapshots and that you can have bad luck and get a buggy version. The probability is about 1:30. So if the version is buggy try another day or use the released packages instead.

Download the sources via svn

The sources are kept in a version control system called subversion or short svn:

  • 10.5 already installs svn. Users of earlier versions must install SVN for Mac OS X: A good package is provided by Martin Ott. You can also use fink. SVN clients with GUI (graphical user interface) are available from Versiontracker. A quite handy client, which integrates in Finder, is SCPlugin.

Create a directory, where you would like to put the sources. You don't need to be root to do this. Any normal user can do this. First create a directory for fpc

(e.g. /Users/username/freepascal)

then open a terminal and do the following:

[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc

This will create a directory called 'fpc', which can be later used in the IDE. Hint: To download/update the latest changes you can simply do

[]$ cd /Users/username/freepascal/fpc
[]$ svn up

Building fpc

[]$ make clean all
[]$ sudo make install

Then download lazarus

[]$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

This will create a directories called 'fpc', which can be later used in the IDE. Hint: To download/update the latest changes you can simply do

[]$ cd /Users/username/freepascal/lazarus
[]$ svn up

Building lazarus

[]$ make clean all

Then start lazarus either via command line or by double click in the finder:

 ./lazarus.app/Contents/MacOS/lazarus

Make targets

Following compiling targets can be specified for the make tool:

  • clean

The command will clean all compiled LCL and IDE units. Warning, this might make your project uncompilable (even though IDE still run, since binary is not deleted)

For example:

 make clean 
  • bigide - the command rebuilds LCL and IDE with additional packages.

For example:

 make bigide
  • lcl - the command rebuild LCL only. IDE is left untouched. The command is very useful if you're making changes to LCL and need to test the changes on your project without breaking Lazarus. Rebuild LCL only is faster than rebuilding both LCL and IDE

For example:

 make lcl
  • components
  • packager/registration
  • ideintf
  • packager
  • bigidecomponents
  • ide
  • idepkg
  • idebig
  • bigide
  • starter - the command rebuilds startlazarus binary.
  • lazbuilder
  • tools
  • all
  • cleanide
  • purge
  • examples - the command rebuilds examples lazarus
  • install
  • lazbuild

If no target is specified LCL and IDE Lazarus (with basic set of components) is rebuilt.

Make parameters

There're also additional parameters, can be used for 'making' Lazarus.

  • OPT=%compiler_switches

the %compiler_switches is passed to each fpc call. The option is useful for specifying defines

For example:

 make bigide OPT="-dNoGdkPixBufLib -gw2" 

makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.

  • LCL_PLATFORM=%platform

%platform is the target Widgetset. It can be win32, gtk, gtk2, qt, carbon or cocoa.

For example:

 make LCL_PLATFORM=gtk2

Rebuilds LCL and IDE for gtk2 widgetset

  • FPC=%compiler_path

%compiler_path is the path to a custom compiler binary you want to build the target with.

Additional experiences and advices

On linux, getting Lazarus to work can be complicated if you have an older version installed. If you have already installed earlier versions of FPC and/or Lazarus, you have to take great care that the PATHS are adjusted so that only your new versions are called.

Pitfalls that I have experienced in various attempts with SuSE linux include:

The rpm versions often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib.

If you perform a make install on a source version or use a .tar.gz, the compiler is usually installed in /usr/local/bin with the libraries in /usr/local/lib.

So if earlier versions have been installed from rpm, make sure all links are changed to reflect the directory structure of your new compiler. The place to make the changes is in /etc/fpc.cfg ; make sure there are no remnant configuration files in your home directory or in your FPC download directory. Typically they are found in ~/.fpc.cfg

Make sure the links in /etc/fpc.cfg point to the correct versions of the libraries (particularly if you have older versions still lurking around).

In /usr/local/bin or /usr/bin there is a file called fpc ; this is the executable that is called when you invoke the compiler. One of the first things it does is to open ppc386 in the same directory. This has to be the same version as the fpc file, or can be a link pointing to the true ppc386 in some other directory (such as a library directory, or the fpc directory in your own development space); be sure to update your link if you install a newer version of the compiler.

Try running the compiler from the command line using one of the simple example programs or one which you wrote yourself.

Turning to Lazarus:

If you use a downloaded snapshot (.tar.gz) or get the source from CVS, enter your lazarus directory and type

make
./lazarus 

and hopefully the IDE should load. There may be a message saying it 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 FreePascal 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.

You may find further problems when you start programming or compiling; most of these will be related to PATH selection.

Many of the difficulties are dealt with in the Lazarus FAQ, found either on this WiKi site, or a more complete list on the main Lazarus site

http://www.lazarus.freepascal.org/modules.php?op=modload&name=FAQ&file=index

From the top menu select Run -> Compiler Options (or Project -> Compiler Options in more recent releases of Lazarus) and select the Paths tab on the resulting dialog. There are several boxes for entry of paths for Unit files, Include files, Other source files, Libraries etc. For each of these, it is worth pressing the ... (ellipsis) button on the right, and you will be given a blank window for inserting path information, and a lower window giving some suggestions. Select as many as you like (or ALL!) and press the ADD button to transfer the selections to the upper window. When your selection is complete, press OK and move on to the next box. If you know of other paths which need to be followed, press the Browse button associated with each box, and insert the additional paths.

When you think you have got your paths right, try to compile your application. If there are further path-related errors ('can't find unit .......') then go back and check your paths, both in /etc/fpc.cfg and in your Run -> Compiler Options dialog (or Project -> Compiler Options depending on your version).

Once you have got the environment and PATHS correct, it is worth saving the settings to a file, otherwise you will have to go through this process for each new project. In the Run -> Compiler options dialog there is a Load/Save button; select this and then save the setings to the filename of your choice: mine is ~/FreePascal/default.cfg. Then each time I start a new project, I can go to the Run -> Compiler Options dialog (or Project -> Compiler Options), select Load/Save, and load my default.cfg file to the new project. You can, of course, modify the options for each new project if you so desire.

Contributors

  • Initially imported and formatted. VlxAdmin 9/22/2003
  • Changed Joe's part for Windows to require fpc 1.0.10. Vincent 9/25/2003
  • Updated "What is required for lazarus". AndrewJohnson 10/1/2003
  • Finished formatted the InstallingLazarus page VlxAdmin 2/22/2004
  • Posted some notes about Installing FPC and Lazarus: mostly reflecting experiences in trying to get the PATHS right in Linux. 3/11/2004 User:Kirkpatc
  • Copied the contents of my note into the main InstallingLazarus section, edited it slightly. I don't know how to remove the original note. 3/12/2004 User:Kirkpatc
  • Removed the original note. Tidied the wiki and formatting a bit. VlxAdmin
  • Corrected a couple of typos - 3/12/2004 User:Kirkpatc
  • Added link for daily snapshot deb packages - 3/27/2004 Vincent
  • Fixed links in GettingLazarus (downloading binaries) and several other pages. 22 July 2004 User:Kirkpatc
  • Added link for lazarus deb packages - 19 August 2004 VincentSnijders
  • Added a short note on installing in Debian - 23 Nov 2004 User:Kirkpatc
  • Considerable re-write and re-organization of installation section - 11 Dec 2004 User:Kirkpatc
  • Fixed broken link - 9 Oct 2005 User:Avantman42
  • Install Under Slackware - 10/02/2008 User:Amiso