This chapter covers:
The master server for GNU Pascal is `agnes.dida.physik.uni-essen.de'. Official and beta releases of the compiler with sources and binaries for many platforms as well as other GNU Pascal related files can be found in
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/
You can find binary distributions for many platforms in the subdirectory `binary'. The archive files are named `gpc-version.platform.extension' -- for example `gpc-2.1.alpha-unknown-linux-gnu.tar.gz' for GPC version 2.1 on an Alpha workstation running the Linux kernel with GNU C Library, or `gpc-20000616.i586-pc-djgppv201.zip' for GPC version 20000616 on an i586 PC running DOS with DJGPP version 2.01.
After you have downloaded the correct archive file for your platform, please read the installation notes on how to install such a binary distribution.
If you are running Dos or MS Windows, you will need additional tools -- see @localuref{#WhatElse,"What else to download and where"} below.
GNU Pascal is subject to steady development. You can download the current snapshot (source only, use at your own risk) via anonymous FTP from:
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/alpha/gpc-20010310.tar.gz
CVS root: :pserver:anonymous@agnes.dida.physik.uni-essen.de:/usr/local/cvsroot Password: anonymous Command: checkout gpc
Please read the installation notes on how to compile the source from a distribution or a CVS checkout.
@anch{WhatElse,@subheading What else to download and where}
When you are using GNU Pascal on a DOS system, you will need either the DJGPP or the EMX development environment (see below). On an OS/2 system, you will need EMX. On an MS Windows 95/98/NT system you will need either the CygWin or the mingw32 environment.
GNU Pascal uses the compiler back-end from the GNU Compiler Collection, GNU CC or GCC. If you want to compile GPC, you will need the source of GCC, version version 2.95.x, as well as the source of GPC itself. Please download it from the same place as GPC, or from any GNU FTP mirror. (See the list on the GNU home page, http://www.gnu.org/gnu/order/ftp.html, for the site closest to you.)
@anch{libs,@subheading Libraries}
For some of GPC's units, you will need some standard libraries. In particular:
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/libs/@anch{DJGPP,@subheading DJGPP} DJGPP is available from any SimTel mirror in the `gnu/djgpp' subdirectory; for FTP addresses look into the DJGPP FAQ. For using GNU Pascal you need at least
http://www.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/index.htmlTo develop EMX programs with GNU Pascal you need at least
http://www.cygnus.com/cygwin/@anch{mingw32,@subheading mingw32} The Minimalists' GNU Win32 environment, mingw32, allows a large number of Unix programs -- including GPC and GCC -- to run under MS Windows 95/98/NT using native MS libraries. mingw32 ressources can be found at:
http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/ http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
To install a binary distribution, cd to the root directory and
unpack the archive while preserving the stored directory structure. Under
a Unix compatible system with GNU tar installed, the following
(performed as `root') will do the job:
# cd / # tar xzf archive.tar.gz
If you are using a `tar' utility other than GNU tar, it
might be necessary to do the above in an explicit pipe:
# cd / # gzip -c -d archive.tar.gz | tar xf -
If you want to install a GPC binary distribution in another directory than it was prepared for (for example, if you do not have root access to the computer and want to install GPC somewhere under your home directory), you can do the following:
install-gpc-binary, available from
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/current/binary/.
To install a ZIP archive under DOS with `PKunzip', `cd' the the appropriate directory (usually `\' for EMX, `\DJGPP' for DJGPP), then call `PKunzip' with the `-d' option:
C:\> cd djgpp C:\DJGPP> pkunzip -d archive.zip
where `archive.zip' is the name of the distribution file.
For DJGPP you must edit your `djgpp.env' in the `DJGPP' directory to complete the installation: Please copy the entries from `[gcc]' to create a new `[gpc]' section. The result may look as follows:
[gcc] COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib [gpc] COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib
If you are using the DJGPP version of GPC but do not have a `DJGPP' directory, please download and install DJGPP (see section Where and what to download).
Binary distributions include `libgcc.a' and `specs', files that are normally part of GCC. If you have GCC installed, they will be replaced unless you manually install the archive.
The preferred way to distribute GNU software is distribution of the source code. However, it can be a non-trivial exercise to build GNU Pascal on some non-Unix systems, so we also provide ready-to-run binaries for a number of platforms. (See section Installation instructions for a GPC binary distribution for how to install a binary distribution.)
GPC is based on the GNU Compiler Collection, GNU CC or GCC. You will
need the GCC sources to build it. It must be the same version as the
one GPC is implemented with -- version 2.95.x as of this
writing. Although you need GCC to build the GNU Pascal compiler, you
don't need GCC to compile Pascal programs once GNU Pascal is
installed. (However, using certain libraries will require compiling
C wrappers, so it is a good idea to install the C compiler as well.)
Because GNU Pascal shares its back-end with GCC, it should run on any system supported by GCC. A full list of platforms supported by GCC can be found in section `Chapter 4' in "Using and Porting GNU CC".
The GCC source can be obtained from any mirror of the GNU FTP site, ftp://ftp.gnu.org/gnu/gcc/. The "core" distribution is sufficient for GPC.
Here is the generic procedure for installing GNU Pascal on a Unix system. See section Compilation notes for specific platforms for extra information needed to install GPC on DOS-like platforms.
% cd /home/fred % gzip -c -d gcc-core-2.95.1.tar.gz | tar xf - % gzip -c -d gpc-20000535.tar.gz | tar xf -`cd' to the GPC directory and move the contents (a subdirectory `p') to the subdirectory `gcc' of the GCC directory:
% cd /home/fred/gpc-20000535 % mv p /home/fred/gcc-2.95.1/gcc/It is recommended, though not required, to use a separate directory for building the compiler, rather than compiling in the source directory. In this example, let us create `/home/fred/gpc-build' for this purpose:
% mkdir /home/fred/gpc-buildIf you use a separate directory, you do not need to write into the GCC source directory once you have patched the GCC source (see below), and can build GPC for more than one platform from the same source tree. In case you are re-using a directory where you have already built GCC and/or GPC for a different target machine, do `make distclean' to delete all files that might be invalid. One of the files this deletes is `Makefile'; if `make distclean' complains that `Makefile' does not exist, it probably means that the directory is already suitably clean.
% cd /home/fred/gpc-build % /home/fred/gcc-2.95.1/configure --enable-languages=pascalThis creates all the necessary config files, links and Makefile in the GCC object directory. Note 1: The configuration will prompt you for patching the GCC source for GPC support, so you need write access to that directory. All changes to GCC are surrounded by `#ifdef GPC ... #endif', so they should not interfere when you build a C compiler from this source tree. Note 2: The `--enable-languages=pascal' option means that we only want to build the Pascal compiler and not, for instance, the C++ compiler. Note 3: The standard base directory for installing GCC and GPC is `/usr/local'. If you want to install files to an alternate directory dir, specify `--prefix=dir' when you run `configure'.
PATH environment variable such that the necessary GNU tools come
before the standard system tools.
% makeNotice that this procedure will build the C compiler (and maybe some other compilers) too, because that is used to compile the GPC runtime library. Optionally, you may supply CFLAGS, LDFLAGS or RTSFLAGS. CFLAGS is used for compiler and RTS, RTSFLAGS are for RTS only, i.e.: `make CFLAGS="-O2" RTSFLAGS=-Wall'
% make -n installTo complete the installation, run the command `make install'. You need write access to the target directories (`/usr/local/bin', `/usr/local/lib', `/usr/local/info', `/usr/local/doc', and `/usr/local/man' in this example), so this is usually done as `root':
% su -c "make install"If you want to install only the Pascal compiler (for example if you already have the correct version of GCC installed), `cd' to the `gcc' subdirectory of the build directory (e.g. `/home/fred/gpc-build/gcc') and run `make pascal.install'. This installation process does not overwrite existing copies of `libgcc.a' or `specs', should they exist. Also from the `gcc' subdirectory you can do some more "exotic" builds. For instance, you can build the GPC WWW pages by typing `make pascal.html' or a binary distribution by typing `make pascal.bindist'. See the `Makefile' in that directory for more examples.
The only compiler that is capable of compiling the GNU Compiler Collection (GNU CC or GCC) under MS-DOS is GCC itself. In order to compile GPC or GCC for MS-DOS with DJGPP you will therefore need either a working copy of DJGPP installed, or you will have to cross-build from a non-MS-DOS system.
Building GPC under MS-DOS with DJGPP follows the same scheme as building GPC under a Unix-like system: Place the `p' subdirectory in the `gcc' directory and follow the instructions for compiling GCC. This requires `bash' and many other tools installed, and you must be very careful at many places to circumvent the limitations of the DOS platform.
Our preferred way to build GPC for DJGPP is to cross-build it from a Unix-like platform -- which is much easier. For instructions, see section Building and Installing a cross-compiler and section Crossbuilding a compiler..
EMX is a free 32-bit DOS extender which adds some properties of Unix to MS-compatible DOS and IBM's OS/2 operating systems.
As of this writing, we are not aware of current versions of GCC for EMX, and EMX support in GPC has not been maintained. Please contact us if you know about recent development in EMX and are interested in continuing EMX support in GPC.
There are two ports of the GNU development tools to MS Windows 95/98/NT: CygWin and mingw32.
The CygWin environment implements a POSIX layer under MS Windows, giving it large parts of the functionality of Unix. Thus, compiling GCC and GPC under the CygWin environment can be done following the instructions for compiling it under a Unix-like system (see section Compiling GPC).
The Minimalists' GNU Win32 environment, mingw32, uses the native `crtdll.dll' library of MS Winodws. It is much smaller than CygWin, but it is not self-hosting and must be crossbuilt from another system (see section Crossbuilding a compiler.).
GNU Pascal can function as a cross-compiler for many machines. Information about GNU tools in a cross-configuration can be found at `ftp://ftp.cygnus.com/pub/embedded/crossgcc/'.
Since GNU Pascal generates assembler code, you need a cross-assembler that GNU Pascal can run, in order to produce object files. If you want to link on other than the target machine, you need a cross-linker as well. It is straightforward to install the GNU binutils to act as cross-tools -- see the installation instructions of the GNU binutils for details.
You also need header files and libraries suitable for the target machine that you can install on the host machine. Please install them under `prefix/platform/include/', for instance `/usr/local/i386-pc-msdosdjgpp/include/' for a cross-compiler from a typical Unix-like environmant to MS-DOS with DJGPP.
Configuration and compilation of the compiler can then be done using the scripts `cfgpc' and `mkgpc' which are included in the source distribution in the subdirectory `p/script'. Please call them with the `-h' option for instructions.
Using a cross-compiler to build GNU Pascal results in a compiler binary that runs on the cross-target platform. This is called "crossbuilding". A possible reason why anybody would want to do this, is when the platform on which you want to run the GNU Pascal compiler is not self-hosting. An example is mingw32.
To crossbuild GNU Pascal, you have to install a cross-compiler for your target first, see section Building and Installing a cross-compiler.
As when building a cross-compiler, configuration and compilation of the compiler can be done using the scripts `cfgpc' and `mkgpc' which are included in the source distribution in the subdirectory `p/script'. Please call them with the `-h' option for instructions.
Go to the first, previous, next, last section, table of contents.