Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here



Subscribe to updates I use ocamlbuild

Statistics on ocamlbuild

Number of watchers on Github 71
Number of open issues 116
Average time to close an issue 8 days
Main language OCaml
Average time to merge a PR 2 days
Open pull requests 10+
Closed pull requests 6+
Last commit over 1 year ago
Repo Created over 3 years ago
Repo Last Updated over 1 year ago
Size 1.19 MB
Organization / Authorocaml
Latest Release0.12.0
Page Updated
Do you use ocamlbuild? Leave a review!
View open issues (116)
View ocamlbuild activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating ocamlbuild for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


OCamlbuild is a generic build tool, that has built-in rules for building OCaml library and programs.

OCamlbuild was distributed as part of the OCaml distribution for OCaml versions between 3.10.0 and 4.02.3. Starting from OCaml 4.03, it is now released separately.

Your should refer to the OCambuild manual for more informations on how to use ocamlbuild.

Automatic Installation

With opam:

opam install ocamlbuild

If you are testing a not yet released version of OCaml, you may need to use the development version of OCamlbuild. With opam:

opam pin add ocamlbuild --kind=git ""

Compilation from source

We assume GNU make, which may be named gmake on your system.

  1. Configure. make configure

The installation location is determined by the installation location of the ocaml compiler. You can set the following configuration variables (make configure VAR=foo):

  • OCAMLBUILD_{PREFIX,BINDIR,LIBDIR} will use opam or ocaml/ocamlfind's settings by default; see configure.make for the precise initialization logic.

  • OCAML_NATIVE: should be true if native compilation is available on your machine, false otherwise

  1. Compile the sources.

  2. Install.

    make install

You can also clean the compilation results with make clean, and uninstall a manually-installed OCamlbuild with make uninstall.

ocamlbuild open issues Ask a question     (View All Issues)
  • almost 3 years MPR#7406: Failure : Link list cannot be empty
  • almost 3 years Textual description of error cases
  • almost 3 years define single-hook dispatchers
  • almost 3 years Installation with 4.03 as system compiler: ERROR: Preinstalled ocamlbuild detected at /usr/lib64/ocaml/ocamlbuild
  • almost 3 years Include dirs and ocaml dependencies
  • about 3 years When compiling a program with two .cmo/.cmx, how to order them ?
  • about 3 years cmxs files are always rebuilt for some libraries?
  • about 3 years compilation fails on cygwin
  • about 3 years Publish a manual that corresponds to the currently released version
  • about 3 years track dependencies on files installed by ocamlfind packages
  • about 3 years Escaping problems on windows
  • over 3 years Colors for ocaml >= 4.03
  • over 3 years non-termination
  • over 3 years ocamlbuild deletes student's source files (misplaced in _build)
  • over 3 years cmxs rule with packed modules
  • over 3 years compute path equivalence correctly
  • over 3 years .odocl files: allow to specify files that are simply copied over
  • over 3 years MPR#6789: Debugging byte code and profiling native code documentation
  • over 3 years OCAMLLIB overrides `ocamlbuild -where`, which is no longer correct in OPAM environment
  • over 3 years unix.cmxa included twice when is present
  • over 3 years Old ocamlbuild path still hardcoded inside ocaml_specific
  • over 3 years Native windows support
  • over 3 years ocamlbuild 4.03 has more restrictive hygiene rules?
  • over 3 years upgrading/downgrading ocamlfind breaks ocamlbuild?
  • over 3 years some opam packages with C stubs don't build with OCaml 4.03.0+beta1 (No such file or directory)
  • over 3 years Bug in [Ocaml_utils.ocaml_lib]?
  • over 3 years Ocamlbuild / Coq general issue
  • over 3 years summarise the `-package` arguments
  • over 3 years Use ocamlfind by default
  • over 3 years lib.mllib with lib.mli but no doesn't build
ocamlbuild open pull requests (View All Pulls)
  • configure: template with no hardcoded version number
  • .o -> .clib rule to build C libraries out of single C stubs
  • [RFC] warn on second call to the dispatch function
  • Multi parametrized tags
  • quick windows fixes for 4.03
  • Weird behaviour for pack mlis, breaking on 4.04
  • install the ocamlbuild.1 man page
  • extend cc/cclib/ccopt to apply to OCaml files as well
  • Provide `-project` command line option to avoid recursive traversal hint
  • Addition of a build specification working together with Autoconf and Automake
ocamlbuild questions on Stackoverflow (View All Questions)
  • ocamlopt and ocamlbuild give an Unbound module error despite ocamlfind seeing the required module
  • Ignore OCaml interfaces with OCamlbuild
  • Is there a way to tell ocamlbuild to run my file instead of just produce an executable?
  • Compiling with ocamlbuild and camlp5
  • How to compile a jocaml file with ocamlbuild and include a package?
  • Ocamlbuild copy over dependencies to _build
  • SOLVED: Ocamlbuild plugin: build dynamic dependencies only if the target has changed
  • Ocamlbuild doesn't take in account the included folders
  • How to tell _oasis or OCamlbuild to generate annotations?
  • How to prevent warnings ocamlbuild/oasis warnings?
  • ocamlbuild specify output location/name
  • Generate dump/explain files of Menhir when using ocamlbuild
  • Using ocamlbuild to build SDL and OpenGL application
  • oasis picks up wrong ocamlbuild
  • OCamlbuild not resolving subdirectory dependency
  • Building library with ocamlbuild, installing it with ocamlfind - what's the best practice?
  • Linking a library via ocamlbuild/ocamlfind
  • How to pass -S flag to ocamlopt with ocamlbuild?
  • Telling ocamlbuild to use Core
  • Module packs with ocamlbuild
  • How to make OCamlbuild compile and link a C file into an OCaml project?
  • ocamlbuild and OUnit
  • Building C++ code with ocamlbuild
  • Add build tool to ocamlbuild project (Ragel)
  • ocamlbuild include extra packages
  • Building llvm bindings with ocamlbuild in Ocaml
  • ocamlbuild: build plugin with options
  • Making ocamlbuild pass both .ml and .mli files to ocamldoc
  • Ocamlbuild and Packages installed via Opam
  • Using Batteries in .mly file with ocamlbuild
ocamlbuild list of languages used
ocamlbuild latest release notes
0.12.0 OCamlbuild 0.12.0

OCamlbuild 0.12.0 is a maintenance release containing mostly bugfixes and a few user-contributed features.

  • 227: install signatures.{mli,cmi,cmti} to help documentation tools

    (Daniel Bnzli and Gabriel Scherer)

  • 232: fix Windows install rules

    (David Allsopp)

  • 234: add afl_instrument and afl_inst_ratio flags for corresponding

    ocamlopt options. (Jeremy Yallop)

  • 237: extend cc/ccopt/cclib flags to apply to ocaml compilation as well,

    as tweaking the C linker can be required for pure-OCaml projects -- see #236 (Gabriel Scherer, report by Nathan Rebours)

  • 253: only run native tests if ocamlopt is available.

    (Ximin Luo, review by whitequark and Gabriel Scherer)

  • 256, #258: pass -keep-docs and -keep-locs when using -pack

    (Gabriel Scherer, report by Vincent Jacques)

  • 257, #259: add _opam to the list of directories ignored by default;

    it is used for package-local opam switches (Gabriel Scherer, request by Edwin Trk)

0.11.0 OCamlbuild 0.11.0

OCamlbuild 0.11.0 introduces a change to the way .cmxs files are produced when no .mldylib file is absent: it will now use the exact same semantics as .cmxa and .mllib file -- in particular, it should not be necessary anymore to have identical foo.{mllib,mldylib} files, only foo.mllib should suffice. See the detailed changelog below for details.

  • 111: added nostdlib flag for corresponding ocaml{c,opt} options

    (Thomas Wood)

  • 115: add node_modules to the list of directories ignored by default

    (.svn/, CVS/, .bzr/, .hg/, .git/, _darcs/, node_modules/) (Yunxing Dai)

  • 125, #160: added -toolchain option for corresponding ocamlfind option.


  • 127, #137, #138: install ocamlbuild's man pages, missing since 4.02

    (Adam Sampson and Gabriel Scherer)

  • 130: make sure that -just-plugin always stops after the plugin-build phase

    (Gabriel Scherer, report by whitequark)

  • 132, #159: remove the rule .cmx -> .cmxs

    Previously, there was a .cmx -> .cmxa rule that would pull a module and its dependencies in a .cmxa, and a separate .cmx -> .cmxs rule that would pull only a module as a .cmxs.

The latter is a reasonable default choice, the idea being that a module's dependencies may often be statically linked with the program instead of being dynamically linked. But it conflicts with the presence of a rule .cmxa -> .cmxs as soon as the library has the same name as one of the modules it contains.

The reason why the rule .cmxa -> .cmxs matter is that it can be composed with the rule .mllib -> .cmxa to build .cmxs files from .mllib files, without having to copy each .mllib file into a separate .mldylib file.

In other terms, the previous behaviour would, by default (in absence of .mldylib file who always takes priority), only link the module in the .cmxs file, and people wishing otherwise would have to write a list of modules in a .mldylib file. The new behavior will, by default, take the .mllib file or the module dependencies (as for .cmxa) to build a .cmxs file, and people wishing otherwise will have to write just the module name in a .mldylib file.

It is unclear whether this change will break some projects on which users relied on the previous semantics. It seems equally likely that the previous semantics, when it applied, was a source of bugs (the .cmxs files didn't have the expected modules) that would not be discovered by people not testing dynamic linking. Such bugs have been found and fixed in the following cases:

(Daniel Bnzli, Jrmie Dimino, Armal Guneau, Gabriel Scherer, whitequark)

  • 124, #136: do not explicitly pass -shared when building shared libraries;

    let the compiler decide what to build. (whitequark)

  • 143-171: migration of Mantis bugtracker issues to the github issue tracker

    (Damien Doligez)

  • 172-175, #177: setting up Continuous Infrastructure (CI) testsuite checks


  • 202: install license, changes and readme in opam's docdir for odig

    (Gabriel Scherer, request and review by Daniel Bnzli)

  • noautolink tag for ocaml{c,opt} (Gabriel Scherer)

Other projects in OCaml