Many years ago, I wrote a simple script using the Stdlib streams library. When trying to compile it nowadays, I get the message:
Alert deprecated: module Stdlib.Stream
Use the camlp-streams library instead.
So I installed the camlp-streams library, and told ocamlc to use it:
ocamlc -I +camlp-streams camlp_streams.cma x.ml
However, I still get the very same error message about Stdlib.streams being deprecated. So how do I teach ocamlc to use camlp_streams and not Stdlib.streams?
If you installed camlp-streams using OPAM, it is not installed in the compiler directory but in the OPAM package directory, so the include directory to pass using -I is not +camlp-streams but one under your OPAM switch, eg:
ocamlc -I $(opam var camlp-streams:lib) camlp_streams.cma x.ml
seems to fit my setup, but the result is still the same (Alert deprecated: module Stdlib.Stream. Use the camlp-streams library instead)
I do not use opam, but the Ubuntu package libcamlp-streams-ocaml. Therefore the camlp_streams library is in /usr/lib/ocaml/camlp-streams/camlp_streams.cma
To sum up, I tried
ocamlfind ocamlc -g -linkpkg -package camlp-streams x.ml
ocamlc -I +camlp-streams camlp_streams.cma x.ml
ocamlc -I /usr/lib/ocaml/camlp-streams camlp_streams.cma x.ml
Also the various exact versions of the compiler and library you are using. It seems work was done at some point for “exporting without deprecation” perhaps you don’t have that commit.
I can’t reproduce with OCaml 4.14.2 and opam’s camlp-streams:
> ocaml --version
The OCaml toplevel, version 4.14.2
> opam info -f version camlp-streams
5.0.1
> cat x.ml
let () =
let c = Stream.of_channel in
ignore (c)
> ocamlfind ocamlc x.ml
File "x.ml", line 2, characters 10-27:
2 | let c = Stream.of_channel in
^^^^^^^^^^^^^^^^^
Alert deprecated: module Stdlib.Stream
Use the camlp-streams library instead.
> ocamlfind ocamlc -linkpkg -package camlp-streams x.ml
>
(My gut feeling would be that there is something wrong with the system camlp-streams install)