Plasma GitLab Archive
Projects Blog Knowledge

findlib.conf

Name

findlib.conf -- [Configuration of findlib/ocamlfind]

GENERAL

There are three possibilities to configure the findlib library:

Build time:

Before findlib is compiled, a "configure" script is invoked to figure out the settings that are most likely to work on the system. Most settings are simply entered into text files and can easily be changed after installation. The following properties cannot be changed later because they are compiled into the resulting binaries:

  • The default location of the configuration file findlib.conf. However, you can set a different location by the environment variable OCAMLFIND_CONF.

  • Whether the installed O'Caml version supports autolinking or not.

Configuration file findlib.conf:

An initial version of this file is generated by the configure script, but you are free to modify it later. Most important, this file contains the system-wide search path used to look up packages, and the default location where to install new packages.

All files with the suffix ".conf" found in the directory findlib.conf.d are also scanned for parameters.

Environment variables:

The settings of findlib.conf can be overridden by environment variables.

Last but not least, several settings can also be passed as command-line options, or by invoking the function Findlib.init.

findlib.conf

The directory containing findlib.conf is determined at build time (by running the configure script), the fallback default is /usr/local/etc. You can set a different location by changing the environment variable OCAMLFIND_CONF which must contain the absolute path of findlib.conf.

The file has the same syntax as META, i.e. it consists of a number of lines with the format

variable = "value"

Here is the list of allowed variables:

path

The search path for META files/package directories. The variable enumerates directories which are separated by colons (Windows: semicolons), and these directories are tried in turn to find a certain package. More exactly, if d is such a directory and p the searched package, the search algorithm will first check whether d/p/META exists. In this case, this META file is taken, and d/p is the package directory. Second, the algorithm tries d/META.p, but the package directory must be specified in this META.p file by a directory directive.

Note that the first found META file is taken, so the order of the directories in the search path counts.

This variable is required.

Example:

path = "/usr/local/lib/ocaml/site-lib:/usr/lib/ocaml/site-lib"

destdir

This variable determines the location where ocamlfind install puts the packages by default: If d is this directory, and p the package to install, a new subdirectory d/p will be created containing all the files of the package.

Example:

destdir = "/usr/local/lib/ocaml/site-lib"

This variable is required.

metadir

If set, the command ocamlfind install will put the META files of packages into this directory (files are named META.p where p=package name); otherwise the META files are put into the package directories like any other file.

Example:

metadir = "/var/lib/findlib/metaregistry"

This variable is optional. It is not used by default.

ocamlc, ocamlopt, ocamlcp, ocamlmktop, ocamldoc, ocamldep, ocamlbrowser

If you want to call other executables than "ocamlc", "ocamlopt", "ocamlcp", "ocamlmktop", "ocamldoc", "ocamldep", and "ocamlbrowser", you can set the names of the executables here. The command ocamlfind looks into these four variables to determine the names of the compilers to call.

Example:

ocamlc     = "ocamlc.opt"
ocamlopt   = "ocamlopt.opt"
ocamlcp    = "ocamlcp.opt"
ocamlmktop = "ocamlmktop.opt"

This variable is optional. It is not used by default.

stdlib

This variable determines the location of the standard library. This must be the same directory for which the O'Caml compilers are configured.

This variable is optional. It is not recommend to set this variable unless you know what you are doing!

ldconf

This variable determines the location of the ld.conf file. This must be the same file the O'Caml compilers read in; it is updated by ocamlfind when installing and removing packages. You can set this variable to the special value "ignore" to disable the automatic modification of the ld.conf file.

If not set, the ld.conf file is assumed to reside in the O'Caml standard library directory.

This variable is optional. It is not recommended to set this variable unless you know what you are doing!

Toolchains: It is possible to have variants of the original configuration. These variants are called "toolchains" because they are intended to select different compilers, e.g. patched compilers. In order to set a variable for a certain toolchain, use the syntax

variable(toolchain) = "value"
For example:
ocamlc(mypatch) = "ocamlc-mypatch"
When the toolchain "mypatch" is selected, this compiler will be used instead of the standard one.

In order to switch to a certain toolchain, use the -toolchain option of ocamlfind.

Environment

A number of environment variables modifies the behaviour of findlib/ocamlfind:

OCAMLFIND_CONF

This variable overrides the location of the configuration file findlib.conf. It must contain the absolute path name of this file.

OCAMLFIND_TOOLCHAIN

This variable sets the currently selected toolchain when a -toolchain option is not passed on the command line.

OCAMLPATH

This variable may contain an additional search path for package directories. It is treated as if the directories were prepended to the configuration variable path.

OCAMLFIND_DESTDIR

This variable overrides the configuration variable destdir.

OCAMLFIND_METADIR

This variable overrides the configuration variable metadir.

OCAMLFIND_COMMANDS

This variable overrides the configuration variables ocamlc, ocamlopt, ocamlcp, ocamlmktop, ocamldoc, ocamldep, and/or ocamlbrowser. Its value must conform to the syntax

ocamlc=name ocamlopt=name ocamlcp=name ocamlmktop=name ocamldoc=name ocamldep=name ocamlbrowser=name

Example:

ocamlc=ocamlc-3.00 ocamlopt=ocamlopt-3.00 ocamlcp=ocamlcp-3.00 ocamlmktop=ocamlmktop-3.00

CAMLLIB or OCAMLLIB

This variable overrides the configuration variable stdlib.

OCAMLFIND_LDCONF

This variable overrides the configuration variable ldconf.

OCAMLFIND_IGNORE_DUPS_IN

This variable instructs findlib not to emit warnings that packages or module occur several times. The variable must be set to the directory where the packages reside that are to be ignored for this warning.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml