Logo C Logo G Logo A Logo L
[Computational Geometry Algorithms Library]


CGAL Installation Guide

Release 0.9, June 1997


This document describes how to install CGAL on your system. Besides that, you will find some information about the makefile structure of CGAL and the support for simultaneously using CGAL and LEDA.

Downloading CGAL

The CGAL library can be downloaded in two different ways: using ftp or using WWW. If you have a WWW connection, the easiest way to download CGAL is via the CGAL homepage:
      http://www.cs.ruu.nl/CGAL/
and go to the `Software' section. Just follow the instructions on this page to obtain your copy of the library. The CGAL library can also be downloaded using FTP. The library can be found at the following location:
      ftp.cs.ruu.nl
in the directory /pub/CGAL. This directory contains release 0.9 of the CGAL library. There is also a README file that contains descriptions of the files in this directory. An example of an FTP-session is given below.
      $ ftp ftp.cs.ruu.nl
      Name (ftp.cs.ruu.nl:<your username>): anonymous
      Password: <type your email address here>
      ftp> cd pub/CGAL
      ftp> get README
      ftp> binary
      ftp> get CGAL-0.9.tar.gz
      ftp> quit

Supported platforms

The current version of CGAL has been tested on the following platforms:

operating system compiler
IRIX 5.3 SGI Mips C++ 4.0
IRIX 6.2 SGI Mips C++ 7.1
IRIX 5.3 GNU g++ 2.7.2
SUN Solaris 2.5 SUN Pro C++ 4.1
SUN Solaris 2.5 SUN Pro C++ 4.2
SUN Solaris 2.5 GNU g++ 2.7.2

Extracting CGAL

After you have downloaded the file containing the CGAL library, you have to decompress it. For the zipfile use the command
      unzip <filename>.zip
and for the gzipped file use the commands
      gunzip <filename>.tar.gz
      tar xvf <filename>.tar
In both cases the directory CGAL-0.9 will be created. This directory contains the following subdirectories:

directory contents
doc_html documentation (HTML)
doc_ps documentation (PostScript)
examples example programs
include header files
lib (shared) object libraries
make files with platform dependent makefile settings
src source files

The install script

The directory CGAL-0.9 contains a Bourne shell script called install_cgal. You can execute this script by entering the command
      install_cgal
in the CGAL-0.9 directory. The script can be run in two modes: a menu-driven interactive mode (default) and a non-interactive mode. You should use the non-interactive mode only if there happen to be problems with the interactive mode.

The installation of CGAL is done in three steps. First you have to make some choices (which compiler, is LEDA used, etc.). Then the script will generate makefiles, based on these choices. Finally, the CGAL libraries are compiled.

The interactive mode

If you run the install_cgal script in the interactive mode, a menu will appear on your screen (the main menu). You first have to choose the option Choose Compiler from this menu. The script will try to locate all available compilers, so you just have to select one. After selecting a compiler you have to choose the option Setup Directories, also from the main menu. This will bring you in the `Directory Setup' menu. In this menu you can choose if you want to use LEDA (see here). You can also set the location for the STL directory here (the Standard Template Library see here). The STL library is required for CGAL. If the compiler has no built-in STL you must specify the STL directory. If you chose the GNU g++ 2.7.2 compiler, there is also an option for using a patch for runtime type information (see here). If you have installed the patch you should indicate this here. When you leave the Directory Setup menu, the script will perform some tests (to make sure that LEDA works, to determine which STL version you are using and to check if the rtti patch was applied successfully). If one of these tests fails, you will be notified. In this case it will not be possible to compile the library: you will have to enter different settings or make changes to the makefiles (see also here and here). If all worked out well you should finish the installation by choosing the option Make Libraries from the main menu. The script will then compile the CGAL libraries.

The non-interactive mode

The install_cgal script can be run in non-interactive mode using the following command
      install_cgal -ni <compiler>
where <compiler> is the full path to the compiler, e.g. /usr/local/bin/g++. Before you do this, you have to enter a number of variables manually at the beginning of the script. These are:
LEDA_EXT=
LEDA_INCL_DIR=
LEDA_LIB_DIR=
STL_STATUS=
STL_DIR=
CGAL_STL_VERSION=
GCC_RTTI_PATCH_EXT=
GCC_RTTI_PATCH_DIR=
See the documentation in the script for the values you can enter here. After running the script a makefile will be generated in the CGAL-0.9/make directory. In the non-interactive mode the CGAL libraries will not be compiled automatically. To do this go to the src directory. Then type make -f makefile_lib to compile the CGAL object library and make -f makefile_sharedlib to compile the CGAL shared object library. If you want to make changes to the makefiles first, see here for an explanation of the makefile structure of CGAL.

When this is finished it would be a good idea to print and read the `Getting Started with CGAL' document that can be found in the doc_ps directory.

WARNING. If you want to use the compiler GNU g++ 2.7.2, or if you want to use LEDA in combination with CGAL, there are some compatibility issues that need to be addressed first. See here and here for more information about this.

The CGAL makefile structure

The CGAL distribution contains three makefiles:

All these makefiles are generic: they can be used for more than one platform. To achieve this, the first section of each makefile contains an include statement that looks as follows:

      CGAL_MAKEFILE = /users/jannes/CGAL-0.9/make/makefile_<extension>
      include $(CGAL_MAKEFILE)

The file CGAL_MAKEFILE is an include file with platform dependent makefile settings. The abbreviation <extension> is used to identify the operating system and compiler for which the settings hold. For example, the file makefile_mips_IRIX_5.3_CC_4.0 contains makefile settings for the IRIX 5.3 operating system and the SGI MIPSpro C++ 4.0 compiler. These include files are generated by the install script and they are all located in the CGAL-0.9/make directory. If you want to compile an application or an object library for a different platform, the only thing you need to do is select another include file from this directory.

The three makefiles also contain sections with compiler and/or linker flags. You may add your own flags here. For example, you might want to add the flag -DCGAL_NO_PRECONDITIONS to turn off precondition checking. The flags $(CGAL_CXXFLAGS) and $(CGAL_LDFLAGS) should never be removed.

The default extension for CGAL source files is .C. The last section of the makefiles contains a suffix rule that tells the compiler how to create a .o-file from a .C-file. If you want to use the default rule that is defined by the make utility, you may want to remove this suffix rule. However, note that it may then be necessary to also rename the makefile variables CGAL_CXX and CXXFLAGS.

Using CGAL and LEDA

The CGAL library can be used independently from LEDA. However, there is support in CGAL for using CGAL and LEDA simultaneously. For example, there are wrappers for the LEDA number types integer, rational and real, and there is a compiler flag to switch on LEDA memory management. If you are going to combine CGAL and LEDA, you need some additional compiler and linker flags, and you may have to recompile the CGAL libraries (when you use the LEDA bool). To simplify this, for every file makefile_<os>_<compiler> in the directory CGAL-0.9 there is a file makefile_<os>_<compiler>_L that contains additional LEDA flags. In this file you can set the compiler flags CGAL_USE_LEDA_BOOL. and CGAL_USE_LEDA_HANDLE that determine if the LEDA bool and the LEDA memory management are used.

Unfortunately, there is a conflict between most STL implementations and LEDA 3.4/3.5. The type bool is in STL usually defined as int, which is prohibited by LEDA. If you are going to use LEDA and CGAL together, you have to resolve this problem somehow. There are two approaches: modifying the file bool.h of STL (which is the easiest solution) or modifying the file <LEDA/bool.h>. For more information about this see the file CGAL-0.9/include/CGAL/bool.h.

Using the GNU g++ 2.7.2 compiler

The CGAL library uses runtime type information at certain places. As a consequence, CGAL programs need to be compiled with the compiler flag -frtti. The problem is that g++ 2.7.2 doesn't handle runtime type information properly. The best way to solve these problems is to install a patch. This patch can be found in the directory CGAL-0.9/auxiliary under the name libg++-2.7.2-rtti-patch.tar.gz. Note that this patch involves recompilation of the g++ standard libraries!

If you do not want (or if you do not have the possibility) to install this patch, the compiler flag -D_STDEXCEPT will be set to avoid a name conflict when including the file <math.h>. When you don't install the patch you will not be able to use fstreams, since this will make the programs crash! Note that there may be several other problems.

The Standard Template Library

For using the CGAL library, the Standard Template Library is required. Some compilers (e.g. g++) provide an implementation of STL. There are also free implementations. For example on ftp://butler.hpl.hp.com/stl you can find the original HP implementation. Silicon Graphics also maintains a site, http://www.sgi.com/Technology/STL/, where you can find documentation, references to other STL sources and two implementations; one for newer compilers that and one for older compilers that support less features.

The install script tries to find out which STL is used. This is necessary to work around some limitations and bugs. In case the right version is not recognised, you can fill it in in the script or in the makefiles generated by the script. The variable CGAL_STL_VERSION can take the following values:

CGAL_STL_GCC STL version that comes with gcc-2.7.2
CGAL_STL_HP Free HP version
CGAL_STL_SGI_WWW Free new SGI implementation
CGAL_STL_SGI_WWW_OLD Free SGI implementation for older compilers
CGAL_STL_SGI_WWW_OLD Free SGI implementation for older compilers
CGAL_STL_SGI_CC SGI implementation that comes with their 7.x compilers
CGAL_STL_WITH_ITERATOR_TRAITS STL implementation that relies on iterator traits

Most STL libraries consist of only header files. An exception is HP's STL, which also has source files random.cpp and tempbuf.cpp. The generated makefiles do not take care of this.