ocamlfind query [-help | other options] package_name ... or: ocamlfind ocamlc [-help | other options] file ... or: ocamlfind ocamlcp [-help | other options] file ... or: ocamlfind ocamlmktop [-help | other options] file ... or: ocamlfind ocamlopt [-help | other options] file ... or: ocamlfind use [-p prefix] package_name ... (DEPRECATED) or: ocamlfind install package_name file ... or: ocamlfind remove package_name
ocamlfind query [ -predicates p | -format f | -long-format | -i-format | -l-format | -a-format | -o-format | -prefix p | -separator s | -suffix s | -descendants | -recursive ] package ...
This command looks packages up, sorts them optionally, and prints attributes of them. If the option -recursive is not specified, exactly the packages given on the command line are looked up; if -recursive is present, the packages and all their ancestors, or if -descendants is present, too, all their descendants are printed.
Package lookup and the selection of the attributes of the packages can be modified by specifying predicates; without a -predicates option the empty set of predicates is used. Note that even the lookup is influenced by the set of actual predicates as the "requires" variables may be conditional.
What is printed about a package depends on the specified format; there are a number of options that modify the format. Some formats denote sets of values (such as -format %a), in which case multiple output records are printed for every package. (It is even possible to specify formats denoting the Cartesian product of sets, such as -format %a%o, but this does not make sense.) Before the first output record the prefix is printed, and the suffix after the last record. Between two records the separator is printed.
Sets the set of actual predicates. The argument p is a list of predicate names separated by commas and/or whitespace. If multiple -predicates options are given, the union of all specified sets is effectively used.
Sets the format to the string f. Characters preceded by a percent sign are interpreted as placeholders; all other characters mean themselves. The defined placeholders are listed below. The default format is "%d".
Sets the format such that all relevant variables are printed.
Same as -format "-I %d", i.e. directory options for ocamlc are printed.
Same as -format "-ccopt -L%d", i.e. directory options for the linker backend are printed.
Same as -format "%a", i.e. archive file names are printed.
Same as -format "%o", i.e. linker options are printed.
Sets the prefix that is printed before the first output record to the given string. The default prefix is the empty string.
Sets the suffix that is printed after the last output record to the given string. The default suffix is the empty string.
Sets the separator that is printed between output records to the given string. The default separator is a linefeed character.
Not only the packages given on the command line are queried but also all ancestors or descendants. If the option -descendants is specified, too, the descendants are printed, otherwise the ancestors. The packages are topologically sorted.
This option has only an effect if -recursive is turned on, too. In this case, instead of the ancestors the descendants of the given packages are queried.
Replaced by the package name
Replaced by the package directory
Replaced by the version string
Replaced by the archive filename. If there is more than one archive, a separate output record is printed for every archive.
Replaced by the list of archive filenames.
Replaced by one linker option. If there is more than one option, a separate output record is printed for every option.
Replaced by the list of linker options.
ocamlfind ( ocamlc | ocamlcp | ocamlopt | ocamlmktop ) [ -package package-name-list | -linkpkg | -predicates pred-name-list | -dontlink package-name-list | -passopt arg | standard-option ] file ...
These subcommands are drivers for the compilers with the same names, i.e. "ocamlfind ocamlc" is a driver for "ocamlc", and so on. The subcommands understand all documented options of the compilers (here called standard-options), but also a few more options. If these subcommands are invoked only with standard options, they behave as if the underlying compiler had been called directly. The extra options modify this.
Internally, these subcommands transform the given list of options and file arguments into an invocation of the driven compiler. This transformation only adds options and files, and the relative order of the options and files passed directly is unchanged.
If there are -package options, additional directory search specifiers will be included ("-I", and "-ccopt -I"), such that files of all named packages and all ancestors can be found.
The -linkpkg option causes that the packages listed in the -package options and all necessary ancestors are linked in. This means that the archive files implementing the packages are inserted into the list of file arguments.
As the package database is queried a set of predicates is needed. Most predicates are set automatically, see below, but additional predicates can be given by a -predicates option.
Here, only the additional options not interpreted by the compiler but by the driver itself, and options with additional effects are explained.
Adds the listed package names to the set of included packages. The package names may be separated by commas and/or whitespace. In the transformed command, for every package of the set of included packages and for any ancestor a directory search option is inserted after the already given options. This means that "-I" and "-ccopt -I" options are added for every package directory.
Causes that in the transformed command all archives of the packages specified by -packages and all their ancestors are added to the file arguments. More precisely, these archives are inserted before the first given file argument. Furthermore, "-ccopt -L" options for all package directories, and the linker options of the selected packages are added, too. Note that the archives are inserted in topological order while the linker options are added in reverse toplogical order.
Adds the given predicates to the set of actual predicates. The predicates must be separated by commas and/or whitespace.
This option modifies the behaviour of -linkpkg. Packages specified here and all ancestors are not linked in. Again the packages are separated by commas and/or whitespace.
The argument arg is passed directly to the underlying compiler. This is needed to specify undocumented compiler options.
This standard option is interpreted by the driver, too.
This standard option causes that the predicate "mt" is added to the set of actual predicates.
This standard option of "ocamlopt" causes that the predicate "gprof" is added to the set of actual predicates.
The "byte" predicate means that one of the bytecode compilers is used. It is automatically included into the predicate set if the "ocamlc", "ocamlcp", or "ocamlmktop" compiler is used.
The "native" predicate means that the native compiler is used. It is automatically included into the predicate set if the "ocamlopt" compiler is used.
The "toploop" predicate means that the toploop is available in the linked program. It is automatically included into the predicate set if the "ocamlmktop" compiler is used.
The "mt" predicate means that the program is multi-threaded. It is automatically included into the predicate set if the -thread option is given.
The "mt_posix" predicate means that in the case "mt" is set, too, the POSIX libraries are used to implement threads. "mt_posix" is automatically included into the predicate set if the variable "type_of_threads" in the META description of the "threads" package has the value "posix". This is normally the case if "findlib" is configured for POSIX threads.
The "gprof" predicate means that in the case "native" is set, too, the program is compiled for profiling. It is automatically included into the predicate set if "ocamlopt" is used and the -p option is in effect.
The "autolink" predicate means that ocamlc is able to perform automatic linking. It is automatically included into the predicate set if ocamlc knows automatic linking (from version 3.00), but it is not set if the -noautolink option is set.
As there is a special module Topfind[Module to load packages into toploops] that supports loading of packages in scripts, the "ocamlmktop" subcommand can add initialization code for this module. This extra code is linked in if "findlib" is in the set of effectively linked packages.
This subcommand installs a new package at the default location. This means that a new package directory is created and that the given files are copied to this directory.
Note that package directories should be flat (no subdirectories). Existing packages are never overwritten. It is not possible to install package at a different location than the default location; you have to invoke "mkdir" and "cp" commands yourself.
The given package is removed if it is installed at the default location.
Note that package directories should be flat (no subdirectories); this subcommand cannot remove deep package directories. It is not possible to remove a package at a different location than the default location; you have to invoke "rm" commands yourself.