# "Module is unavailable" error, when using new -I +str syntax \[SOLVED\]

**URL:** <https://discuss.ocaml.org/t/module-is-unavailable-error-when-using-new-i-str-syntax-solved/14988>\
**Category:** Learning\
**Created:** [July 18, 2024, 1:52pm UTC](https://discuss.ocaml.org/t/module-is-unavailable-error-when-using-new-i-str-syntax-solved/14988 "2024-07-18T13:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathandoyle](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jonathandoyle](https://discuss.ocaml.org/u/jonathandoyle)\
**Post date:** [July 18, 2024, 1:52pm UTC](https://discuss.ocaml.org/t/module-is-unavailable-error-when-using-new-i-str-syntax-solved/14988/1 "2024-07-18T13:52:00Z")

</div>

I recently switched from a \<5 OCaml compiler to a 5.1.1 version.  
I therefore need to take the following warning from `ocamlc` into account :

```auto
File "_none_", line 1:
Alert ocaml_deprecated_auto_include: 
OCaml's lib directory layout changed in 5.0. The str subdirectory has been
automatically added to the search path, but you should add -I +str to the
command-line to silence this alert (e.g. by adding str to the list of
libraries in your dune file, or adding use_str to your _tags file for
ocamlbuild, or using -package str for ocamlfind).

```

To consider a minimal example, suppose we have just one file `using_str.ml`  
which contains just the line `let bs = Str.bounded_split ;;`

My naive try at the new syntax works with partial, separate compilation (with the “-c” option)  
but not with full compilation (without the “-c” option) :

```auto
$ls
using_str.ml
$ocamlc -I +str -c using_str.ml
$ls
using_str.cmi using_str.cmo using_str.ml
$ocamlc -I +str using_str.ml
File "using_str.ml", line 1:
Error: Module `Str' is unavailable (required by `Using_str')

```

What is the correct syntax for the second call to `ocamlc` ?

Unless I missed something, this error “Module (…) is unavailable” is not documented  
in the OCaml manual. Section 13.4 only lists the most common errors which do not include this one.

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [July 18, 2024, 2:00pm UTC](https://discuss.ocaml.org/t/module-is-unavailable-error-when-using-new-i-str-syntax-solved/14988/2 "2024-07-18T14:00:34Z")

</div>

When linking, you need to provide the archives of the linked libraries:

```bash
$ ocamlc -I +str -c using_str.ml
$ ocamlc -I +str str.cma using_str.cmo -o using_str

```

or in one command:

```bash
$ ocamlc -I +str str.cma using_str.ml -o using_str

```
