OCaml 不安全字符串选项不可用

OCaml unsafe-string option is not available

我正在尝试创建一个在其编译命令中将 -unsafe-string 作为参数的项目。 我收到的信息是 ocamlc.opt: OCaml has been configured with -froce-safe-string: -unsafe-string is not avaiable 运行 ocamlc.opt -unsafe-string

时的相同消息

运行 ocamlc.opt --help 我得到 safe-string: (was set when configuring the compiler) 我没有找到任何关于如何更改这些配置的资源。

我使用的ocaml版本是4.07.0 我使用的 opam 版本是 2.0.8

您使用的编译器禁用了 -unsafe-string 选项。除了使用不同的编译器之外,这不是您可以解决的问题。你不会说你使用的是什么系统,你从哪里得到编译器等等。但是 opam 可以使用任何选择的配置构建一个新的编译器。

你可以试试这个:

$ opam switch create 4.07.0

之后你应该会看到这样的东西:

$ which ocaml
/home/rami/.opam/4.07.0/bin/ocaml

我相信 4.07.0 的默认配置将允许 -unsafe-string 选项。 (我刚刚试过了,它对我有用。)所以你应该能够用这个新的编译器构建你的项目。