Subsections


2 Installing the compiler

1 Before Installation : Requirements

1 System requirements

The compiler needs at least the following hardware:
  1. An Intel 80386 or higher processor (for the intel version). A coprocessor is not required, although it will slow down your program's performance if you do floating point calculations without a coprocessor, since emulation will be used.
  2. 4 Megabytes of free memory.
  3. At least 3 Megabytes free disk space.

2 Software requirements

1 Under DOS

The DOS distribution contains all the files you need to run the compiler and compile pascal programs.

2 Under UNIX

Under UNIX systems (such as LINUX) you need to have the following programs installed :
  1. GNU as, the GNU assembler.
  2. GNU ld, the GNU linker.
  3. Optionally (but highly recommended) : GNU make. For easy recompiling of the compiler and Run-Time Library, this is needed.

3 Under Windows

The WINDOWS distribution contains all the files you need to run the compiler and compile pascal programs. However, it may be a good idea to install the mingw32 tools or the cygwin development tools. Links to both of these tools can be found on http://www.freepascal.org

4 Under OS/2

While the Free Pascal distribution comes with all necessary tools, it is a good idea to install the EMX extender in order to compile and run programs with the Free Pascal compiler. The EMX extender can be found on:
http://www.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/index.html

2 Installing the compiler.

The installation of Free Pascal is easy, but is platform-dependent. We discuss the process for each platform separately.

1 Installing under DOS or Windows

1 Mandatory installation steps.

First, you must get the latest distribution files of Free Pascal. They come as zip files, which you must unzip first, or you can download the compiler as a series of separate files. This is especially useful if you have a slow connection, but it is also nice if you want to install only some parts of the compiler distribution. The distribution zip file contains an installation program INSTALL.EXE. You must run this program to install the compiler.

The first screen of the installation program looks like this:

install1.png

And the second screen looks like

install2.png

The program allows you to select:

In order to run Free Pascal from any directory on your system, you must extend your path variable to contain the C:\PP\BIN directory. Usually this is done in the AUTOEXEC.BAT file. It should look something like this :

  SET PATH=%PATH%;C:\PP\BIN
(Again, assuming that you installed in the default location).

2 Optional Installation: The coprocessor emulation

For people who have an older CPU type, without math coprocessor (i387) it is necessary to install a coprocessor emulation, since Free Pascal uses the coprocessor to do all floating point operations.

The installation of the coprocessor emulation is handled by the installation program (INSTALL.EXE) under DOS and WINDOWS.

2 Installing under Linux

1 Mandatory installation steps.

The LINUX distribution of Free Pascal comes in three forms: All of these packages contain a ELF version of the compiler binaries and units. the older aout binaries are no longer distributed, although you still can use the comiler on an aout system if you recompile it.

If you use the .rpm format, installation is limited to

rpm -i fpc-pascal-XXX.rpm
(XXX is the version number of the .rpm file)

If you use Debian, installation is limited to

dpkg -i fpc-XXX.deb
Here again, XXX is the version number of the .deb file.

You need root access to install these packages. The .tar file allows you to do an installation if you don't have root permissions.

When downloading the .tar file, or the separate files, installation is more interactive.

In case you downloaded the .tar file, you should first untar the file, in some directory where you have write permission, using the following command:

tar -xvf fpc.tar
We supposed here that you downloaded the file fpc.tar somewhere from the Internet. (The real filename will have some version number in it, which we omit here for clarity.)

When the file is untarred, you will be left with more archive files, and an install program: an installation shell script.

If you downloaded the files as separate files, you should at least download the install.sh script, and the libraries (in libs.tar.gz).

To install Free Pascal, all that you need to do now is give the following command:

./install.sh
And then you must answer some questions. They're very simple, they're mainly concerned with 2 things :
  1. Places where you can install different things.
  2. Deciding if you want to install certain components (such as sources and demo programs).
The script will automatically detect which components are present and can be installed. It will only offer to install what has been found. because of this feature, you must keep the original names when downloading, since the script expects this.

If you run the installation script as the root user, you can just accept all installation defaults. If you don't run as root, you must take care to supply the installation program with directory names where you have write permission, as it will attempt to create the directories you specify. In principle, you can install it wherever you want, though.

At the end of installation, the installation program will generate a configuration file (fpc.cfg) for the Free Pascal compiler which reflects the settings that you chose. It will install this file in the /etc directory or in your home directory (with name .fpc.cfg) if you do not have write permission in the /etc directory. It will make a copy in the directory where you installed the libraries.

The compiler will first look for a file .fpc.cfg in your home directory before looking in the /etc directory.

3 Optional configuration steps

On any platform, after installing the compiler you may wish to set some environment variables. The Free Pascal compiler recognizes the following variables :

These locations are, however, set in the sample configuration file which is built at the end of the installation process, except for the PPC_CONFIG_PATH variable, which you must set if you didn't install things in the default places.

4 Before compiling

Also distributed in Free Pascal is a README file. It contains the latest instructions for installing Free Pascal, and should always be read first.

Furthermore, platform-specific information and common questions are addressed in the FAQ. It should be read before reporting any bug.

5 Testing the compiler

After the installation is completed and the optional environment variables are set as described above, your first program can be compiled.

Included in the Free Pascal distribution are some demonstration programs, showing what the compiler can do. You can test if the compiler functions correctly by trying to compile these programs.

The compiler is called

To compile a program (e.g demo\hello.pp) simply type :
  fpc hello
at the command prompt. If you don't have a configuration file, then you may need to tell the compiler where it can find the units, for instance as follows:
fpc -Fuc:\pp\units\go32v2\rtl hello
under DOS, and under LINUX you could type
fpc -Fu/usr/lib/fpc/NNN/units/linux/rtl hello
(replace NNN with the version number of Free Pascal that you are using). This is, of course, assuming that you installed under C:\PP or /usr/lib/fpc/NNN, respectively.

If you got no error messages, the compiler has generated an executable called hello.exe under DOS, OS/2 or WINDOWS, or hello (no extension) under UNIX and most other operating systems.

To execute the program, simply type :

  hello
If all went well, you should see the following friendly greeting:
Hello world




2002-04-25