# Ocamlbuild error for a module that is installed

**URL:** <https://discuss.ocaml.org/t/ocamlbuild-error-for-a-module-that-is-installed/959>\
**Category:** Learning\
**Created:** [October 14, 2017, 2:53pm UTC](https://discuss.ocaml.org/t/ocamlbuild-error-for-a-module-that-is-installed/959 "2017-10-14T14:53:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uno](https://avatars.discourse-cdn.com/v4/letter/u/59ef9b/32.png) [@Uno](https://discuss.ocaml.org/u/Uno)\
**Post date:** [October 14, 2017, 2:53pm UTC](https://discuss.ocaml.org/t/ocamlbuild-error-for-a-module-that-is-installed/959/1 "2017-10-14T14:53:57Z")

</div>

hi,

To be honest, I’m not too fond of ocamlbuild. It seems to me that a lot of magic is going on in the background, so when stuff is not working its hard to figure out the reason. In this case ocamlbuild complains about a missing Ocb\_stubblr module even it is installed.

$ ocamlfind list | grep ocb

```
ocb-stubblr (version: 0.1.1)
ocb-stubblr.topkg (version: 0.1.1)

```

The thing I’d like to build is the tests of the ‘tsdl’ package ([GitHub - dbuenzli/tsdl: Thin bindings to SDL for OCaml](https://github.com/dbuenzli/tsdl))

$ ocamlbuild -use-ocamlfind tests.otarget

> - ocamlfind ocamlopt unix.cmxa -I /Users/bkb/.opam/4.02.3/lib/ocaml/ocamlbuild /Users/bkb/.opam/4.02.3/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild .ml /Users/bkb/.opam/4.02.3/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild  
> File “myocamlbuild .ml”, line 2, characters 5-16:  
> Error: Unbound module Ocb\_stubblr  
> Command exited with code 2.  
> Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.

Any ideas?

---

<div class="post-metadata">

**Author:** ![gasche](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/gasche/32/4_2.png) [@gasche](https://discuss.ocaml.org/u/gasche)\
**Post date:** [October 14, 2017, 6:27pm UTC](https://discuss.ocaml.org/t/ocamlbuild-error-for-a-module-that-is-installed/959/2 "2017-10-14T18:27:57Z")

</div>

As far as I can tell, the test line documented in the README is wrong for two reasons:

- you need to tell ocamlbuild that `myocamlbuild.ml` needs to be compiled with the `ocb-stubblr` package by passing the `-plugin-tag 'package(ocb-stubblr)'` command-line option
- the target `tests.otarget`needs a file `test.itarget` listing the test programs to build, and this file does not seem to exist in the repository

The following line works:

```
ocamlbuild -use-ocamlfind -plugin-tag 'package(ocb-stubblr)' test/test_audio_queue.native

```

(cc @dbuenzli)

Note that the `-plugin-tag` option, and in general the build process for `myocamlbuild.ml` files, is documented in the ocamlbuild manual: [3.1 how `myocamlbuild.ml` is used](https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#how-code-myocamlbuild-ml-code-is-used).

---

<div class="post-metadata">

**Author:** ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Post date:** [October 15, 2017, 8:45pm UTC](https://discuss.ocaml.org/t/ocamlbuild-error-for-a-module-that-is-installed/959/3 "2017-10-15T20:45:48Z")

</div>

> [@gasche](#):
>
> As far as I can tell, the test line documented in the README is wrong

Yes it’s outdated. Simply use `topkg build`, `topkg test --list` will give you the list of tests that you can run by using the same command.
