Go to the first, previous, next, last section, table of contents.


Installing Ciao from the source distribution

Author(s): Manuel Carro, Daniel Cabeza, Manuel Hermenegildo.

Version: 1.10#7 (2006/4/26, 19:22:13 CEST)

Version of last change: 1.10#2 (2004/8/2, 19:25:49 CEST)

This describes the installation procedure for the Ciao Prolog system, including libraries and manuals, from a source distribution. This applies primarily to Unix-type systems (Linux, Mac OS X, Solaris, SunOS, etc.). However, the sources can also be compiled if so desired on Windows systems -- see section Installation and compilation under Windows for details.

If you find any problems during installation, please refer to section Troubleshooting (nasty messages and nifty workarounds). See also section Downloading new versions and section Reporting bugs.

Un*x installation summary

Note: it is recommended that you read the full installation instructions (specially if the installation will be shared by different architectures). However, in many cases it suffices to follow this summary:

  1. Uncompress and unpackage (using gunzip and tar -xpf) the distribution. This will put everything in a new directory whose name reflects the Ciao version.
  2. Enter the newly created directory (SRC). Edit SETTINGS and check/set the variables SRC, CIAOROOT (this defines where the installation will hang from) and DOCROOT (where the documentation will go, preferably a directory accessible via WWW). CIAOROOT is used to give values to BINROOT, LIBROOT, and INCLUDEROOT. You can give different values to these if you want.
  3. Type gmake install. This will build executables, compile libraries, and install everything in a directory LIBROOT/ciao and in BINROOT. Note that gmake refers to the GNU implementation of the make Un*x command, which is available in many systems (including all Linux systems and Mac OS X) simply as make. I.e., you can try simply typing make install if gmake install does not work. If typing make stops right away with error messages it is probably an older version and you need to install gmake.
  4. Make the following modifications in your startup scripts. This will make the documentation accessible, set the correct mode when opening Ciao source files in emacs, etc. Note that <LIBROOT> must be replaced with the appropriate value: If you are installing Ciao globally in a multi-user machine, make sure that you instruct all users to do the same. If you are the system administrator, the previous steps can be done once and for all, and globally for all users by including the lines above in the central startup scripts (e.g., in Linux /etc/bashrc, /etc/csh.login, /etc/csh.cshrc, /etc/skel, /usr/share/emacs/.../lisp/site-init.pl, etc.).
  5. Finally, if the (freely available) emacs editor/environment is not installed in your system, we highly recommend that you also install it at this point (see section Un*x full installation instructions for instructions). While it is easy to use Ciao with any editor of your choice, the Ciao distribution includes a very powerful application development environment which is based on emacs and which enables, e.g., source-level debugging, syntax coloring, context-sensitive on-line help, etc.
  6. You may want now want to check your installation (see section Checking for correct installation on Un*x) and read the documentation, which is stored in DOCROOT (copied from SRC/doc/reference) and can be easily accessed as explained in that same section. There are special "getting started" sections at the beginning of the manual.
  7. If you have any problems you may want to check the rest of the instructions. The system can be uninstalled by typing gmake uninstall.

Un*x full installation instructions

  1. Uncompress and unpackage: (using gunzip and tar -xpf) the distribution in a suitable directory. This will create a new directory called ciao-X.Y, where X.Y is the version number of the distribution. The -p option in the tar command ensures that the relative dates of the files in the package are preserved, which is needed for correct operation of the Makefiles.
  2. Select installation options: Edit the file SETTINGS and set the following variables: For network-based installations, it is of utmost importance that the paths given be reachable in all the networked machines. Different machines with different architectures can share the same physical SRC directory during installation, since compilations for different architectures take place in dedicated subdirectories. Also, different machines/architectures can share the same LIBROOT directory. This saves space since the architecture-independent libraries will be shared. See section Multiarchitecture support below.
  3. Compile Ciao: At the ciao top level directory type gmake all. Important: use GNU make ( gmake), not the standard UNIX make, as the latter does not support some features used during the compilation. It does not matter if the name of the executable is make or gmake: only make sure that it is GNU make. This will: This step can be repeated successively for several architectures in the same source directory. Only the engine and some small parts of the libraries (those written in C) differ from one architecture to the other. Standard Ciao Prolog code compiles into bytecode object files (.po) and/or executables which are portable among machines of different architecture, provided there is an executable engine accessible in every such machine. See more details below under section Multiarchitecture support.
  4. Check compilation: If the above steps have been satisfactorily finished, the compiler has compiled itself and all the distribution modules, and very probably everything is fine.
  5. Install Ciao: To install Ciao in the directories selected in the file SETTINGS during step 2 above, type gmake justinstall. This will:
  6. Set up user environments: In order to automate the process of setting the variables above, the installation process leaves the files LIBROOT/ciao/DOTcshrc (for csh-like shells), LIBROOT/ciao/DOTprofile (for sh-like shells), and LIBROOT/ciao/DOTemacs (for emacs) with appropriate definitions which will take care of all needed environment variable definitions and emacs mode setup. Make the following modifications in your startup scripts, so that these files are used (<LIBROOT> must be replaced with the appropriate value): If you are installing Ciao globally in a multi-user machine, make sure that you instruct all users to do the same. If you are the system administrator, the previous steps can be done once and for all, and globally for all users by including the lines above in the central startup scripts (e.g., in Linux /etc/bashrc, /etc/csh.login, /etc/csh.cshrc, /etc/skel, /usr/share/emacs/.../lisp/site-init.pl, etc.).
  7. Download and install Emacs (highly recommended): If the (freely available) emacs editor is not installed in your system, its installation is highly recommended (if you are installing in a multi-user machine, you may want to do it in a general area so that it is available for other users, even if you do not use it yourself). While it is easy to use Ciao with any editor of your choice, the Ciao distribution includes a very powerful application development environment which is based on emacs and which enables, e.g., source-level debugging, syntax coloring, context-sensitive on-line help, etc. The emacs editor (in all its versions: Un*x, Windows, etc.) can be downloaded from, for example, http://www.emacs.org/, and also from the many GNU mirror sites worldwide (See http://www.gnu.org/ for a list), in the gnu/emacs and gnu/windows/emacs directories. You can find answers to frequently asked questions (FAQ) about emacs in general at http://www.gnu.org/software/emacs/emacs-faq.text and about the Windows version at http://www.gnu.org/software/emacs/windows/ntemacs.html (despite the ntemacs name it runs fine also as is on Win9X and Win2000 machines).
  8. Check installation / read documentation: You may now want to check your installation (see section Checking for correct installation on Un*x) and read the documentation, which is stored in DOCROOT (copied from SRC/doc/reference) and can be easily accessed as explained that same section. There are special "getting started" sections at the beginning of the manual.

Other useful make targets are listed at the beginning of $(SRC)/Makefile.

If you have any problems you may want to check section Troubleshooting (nasty messages and nifty workarounds).

The system can be uninstalled by typing gmake uninstall in the top directory (the variables in SETTINGS should have the same value as when the install was performed, so that the same directories are cleaned).

Checking for correct installation on Un*x

If everything has gone well, several applications and tools should be available to a normal user. Try the following while logged in as a normal user (important in order to check that permissions are set up correctly):

Also, the following documentation-related actions should work:

Finally, if emacs is installed, after starting it (typing emacs) the following should work:

Note: when using emacs it is very convenient to swap the locations of the (normally not very useful) Caps Lock key and the (very useful in emacs) Ctrl key on the keyboard. How to do this is explained in the emacs frequently asked questions FAQs (see the emacs download instructions for their location).

Cleaning up the source directory

After installation, the source directory can be cleaned up in several ways:

Other useful make targets are listed at the beginning of $(SRC)/Makefile.

Multiarchitecture support

As mentioned before, Ciao applications (including the compiler and the top level) can run on several machines with different architectures without any need for recompiling, provided there is one Ciao engine (compiled for the corresponding architecture) accessible in each machine. Also, the Ciao libraries (installed in LIBROOT, which contain also the engines) and the actual binaries (installed in BINROOT) can themselves be shared on several machines with different architectures, saving disk space.

For example, assume that the compiler is installed as:

/usr/local/share/bin/ciaoc

and the libraries are installed under

/usr/local/share/lib

Assume also that the /usr/local/share directory is mounted on, say, a number of Linux and a number of Solaris boxes. In order for ciaoc to run correctly on both types of machines, the following is needed:

  1. Make sure you that have done gmake install on one machine of each architecture (once for Linux and once for Solaris in our example). This recompiles and installs a new engine and any architecture-dependent parts of the libraries for each architecture. The engines will have names such as ciaoengine.LINUXi86, ciaoengine.SolarisSparc, and so on.
  2. In multi-architecture environments it is even more important to make sure that users make the modifications to their startup scripts using <LIBROOT>/ciao/DOTcshrc etc. The selection of the engine (and architecture-dependent parts of libraries) is done in these scripts by setting the environment variable CIAOARCH, using the ciao_get_arch command, which is installed automatically when installing Ciao. This will set CIAOARCH to, say, LINUXi86, SolarisSparc, respectively, and CIAOENGINE will be set to ciaoengine.CIAOARCH. However, note that this is not strictly necessary if running on only one architecture: if CIAOARCH is not set (i.e., undefined), the Ciao executables will look simply for ciaoengine, which is always a link to the latest engine installed in the libraries. But including the initialization files provided has the advantage of setting also paths for the manuals, etc.

Installation and compilation under Windows

There are two possibilities in order to install Ciao Prolog on Windows machines:

In order to compile Ciao Prolog for Win32 environments you need to have the (public domain) Cygnus Win32 and development libraries installed in your system. Compilation should be performed preferably under Windows NT-type systems.

A further note regarding the executables generated by the Ciao compiler and top-level: the same considerations given in section Installing Ciao from a Win32 binary distribution apply regarding .bat files, etc. However, in a system in which Cygnus Win32 is installed these executables can also be used in a very simple way. In fact, the executables can be run as in Un*x by simply typing their name at the bash shell command line without any associated .bat files. This only requires that the bash shell which comes with Cygnus Win32 be installed and accessible: simply, make sure that /bin/sh.exe exists.

Porting to currently unsupported operating systems

If you would like to port Ciao to a currently unsupported platform, there are several issues to take into account. The main one is to get the engine to compile in that platform, i.e., the C code under the engine directory. The procedure currently followed by Ciao to decide the various flags needed to compile is as follows:

Once a working engine is achieved, it should be possible to continue with the standard installation procedure, which will try to use a completely static version of the standalone compiler (ciaoc.sta in the ciaoc directory) to compile the interactive top-level ( ciaosh) and a new version of the standalone compiler ( ciaoc). These in turn should be able to compile the Prolog libraries. You may also need to look at some libraries (such as, for example, sockets) which contain C code. If you do succeed in porting to a platform that is currently unsupported please send the mkf-CIAOARCH and any patches to ciao@clip.dia.fi.upm.es, and we will include them (with due credit, of course) in the next distribution.

Troubleshooting (nasty messages and nifty workarounds)

The following a list of common installation problems reported by users:


Go to the first, previous, next, last section, table of contents.