GNU Pascal Compiler


The GNU Pascal Compiler (GPC) is a member of the GNU Compiler Collection. Its back-end is compatible with the GNU C Compiler (GCC) and all the other members of the collection.

GPC Home Introduction to GPC and the GPC Manual. The links to binary distributions are out of date, as are some of the links to the source code. There are instructions for compiling sources on Unix-like platforms, and we used these ourselves.

There are two ways to install GPC. One is to download the source code for the compiler, compile it yourself with GCC, and install the binaries you create. Another is to download pre-compiled binaries. The former is more arduous but at the same time more reliable. The latter is easier, but the resulting installation may be incompatible with your system, especially if you are working on Linux.

Install from Sources Generic instructions for compiling the GPC source code.

If you're working on MacOS or Windows, the following sites make installation of GPC straightforward, whether you want to compile the sources yourself or install binaries directily.

GPC for MacOS Binaries and Sources for MacOS. This site makes it easy for you to download binaries and install them on MacOS for PPC and Intel. He also makes it easy for you to compile and install GPC from the source code. (Maintained by Adriaan van Os.)

GPC for Windows+Cygwin Binaries and sources ready to install within the Cygwin UNIX-like environment on Windows. (Maintained by The African Chief.)

GPC for Windows+Mingw Binaries and sources ready to install within the Mingw UNIX-like environment on Windows. (Maintained by The African Chief.)

If you are working on Linux, there is no universal binary distribution. We have done what we can to make it easier for you here. We built the latest version of GPC on an old version of Scientific Linux (3.0.9). You can download our binary distribution, which includes the GCC libraries required by GCC, with the following link.

Linux Binary GPC Linux binary compiled on Scientific Linux 3.0.9 using GPC 3.4.6. The file is called gpc-20070904-with-gcc.i686-pc-linux-gnu.tar.gz, indicating that it is the 20070904 version of GPC, compiled for an i686 processor running GNU-compatible Linux.

To install the Linux binary, extract with the following command. You will be prompted for the root password because the files will be installed in the root file system.

sudo tar -zxvf gpc-20070904-with-gcc.i686-pc-linux-gnu.tar.gz

The extraction will install the Pascal compiler in usr/local, using usr/local/bin for the commands, usr/local/lib for libraries. Test the compiler first by entering gpc at the command line. If the command does not exist, fix your default path:

PATH=$PATH:/usr/local/bin

When you run gpc, you should get a page of text describing your installation. You can now test the compiler on some Pascal source code.

Example: Download the latest LWDAQ zip archive from here, extract the LWDAQ directory, and cd to Build. Type make to build our lwdaq.so library.

On the other hand, your gpc may report that it cannot find certain libraries. If that's the case, then our binary distribution is incompatible with your Linux system. You may be able to install GPC directly from your Linux version's home page, or using yum, rpm, or up2date. Otherwise, you will have to compile GPC yourself.

When we compiled GPC, we followed the generic GPC installation instructions. Before you can run the GPC configure script, you need to have several utilities installed in your system. We list these below, and in several cases we provide links to local copies of the source code for the utilities, which you can download, extract, configure and install.

  1. bash
  2. bzip2
  3. GNU sed
  4. GNU awk
  5. GNU m4
  6. bison
  7. flex
  8. autoconf
  9. texinfo
  10. help2man

In order to get help2man to install, you may need the Perl module called "Locale::gettext". Download gettext and extract. Change directory into the gettext directory and run the following commands to install the module.

perl Makefile.PL
make
make test
make install

With gettext installed, you can configure help2man. Once all the necessary utilities are installed, download the following two files. One is a version of GCC that you will use to compile the GPC sources, and the other is the GPC sources themselves. You must have some version of GCC pre-installed on your system so you can compile this new version of GCC.

GCC 3.4.6 The compiler we use to compile the GPC sources.

GPC 20070904 The GPC sources.

Now follow the GPC installation instructions. You configure and make the GPC libraries. When it comes to installing, we recommend that you install GPC with its own copy of GCC. Enter the gcc directory in your build area and type:

make pascal.install-with-gcc

We made our own with-gcc binary distribution with:

make pascal.bindist-with-gcc

You can set this binary distribution aside and give it to other users of the same Linux version. They will be able to extract it directly into their root file structure and run the compiler.


Kevan Hashemi
Physics Department
Brandeis University
phone: (781) 736-2819 USA
email: hashemi@brandeis.edu