使用 WSL (UBUNTU) 在 Windows 10 上安装 OCAML。 bwrap (BubbleWrap) 的问题

Installing OCAML on Windows 10 using WSL (UBUNTU). Problems with bwrap (BubbleWrap)

我是 Linux 和 OCAML 的新手。我认为让 OCaml 在 Windows 上工作并不简单。我找到这个 link:

https://www.cs.umd.edu/class/spring2018/cmsc330/ocamlInstallationGuide.pdf#page=14&zoom=100,0,96

但是,我怀疑这是过时的,因为他们指的是 4.04 是最新的 OCaml 版本,目前有一个 4.07。我进一步怀疑 OCaml 现在需要 bwrap,这是我的问题和问题的根源。

我强调我只想让 OCaml 在 Windows 上工作。如果有比使用 WSL(Linux 的 Windows 子系统)更简单的方法,我会很乐意这样做。

创建开关时:

opam switch create ocaml-base-compiler.4.07.0,

我收到以下错误:

bwrap: Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems.

我想我需要 bwrap 并尝试了各种命令,例如:

wget https://mirrors.edge.kernel.org/ubuntu/pool/main/b/bubblewrap/bubblewrap_0.3.1-2_amd64.deb

其次是:

sudo dpkg -i bubblewrap_0.3.1-2_amd64.deb

安装似乎很顺利,但我仍然遇到错误。我必须承认我不知道 bwrap must be installed setuid on such systems 是什么意思。

1) 我应该如何安装 bwrap?

这个网站:

https://github.com/projectatomic/bubblewrap/issues/139

似乎表明可能无法在 Windows 期间使 bwrap 工作: "Flatpak and bubblewrap require Linux. WSL is not Linux, it's Windows pretending to be Linux, and it does not have the full feature-set of a modern Linux kernel. As far as I am aware, it doesn't implement namespaces, so you are out of luck."

2) 我可以使用 WSL 在 Windows 上启动 OCaml 和 运行 还是有更好的方法?

最后,我不拘泥于Ubuntu。如果有 better/easier 发行版与 WSL 一起使用以安装 OCAML,我可以更改!

谢谢, 戴夫

以下是我为使事情正常进行所做的工作。基于此评论:

"I can work around this by wiping out ~/.opam/config, I think, and using opam init --disable-sandboxing, but that's somewhat less than an ideal user-experience."

https://github.com/ocaml/opam/issues/3505

和这条指令:

“确实,WSL 不支持 bwrap(参见本期)。 为了能够在您的情况下使用 opam,您可以使用 --disable-sandboxing 选项禁用沙盒(谨慎使用)以进行新的 opam 初始化或通过 opamrc。对于初始化的 opam,您不能使用此选项,而是通过删除/清空 wrap-*-commandfields 直接在配置文件中更改配置。 有关详细信息,请参阅此常见问题解答条目。 我在这里重复警告:"Use [sanbdoxing disable option] wisely, broken Makefiles that run rm -rf / do happen.""

来自:

https://opam.ocaml.org/doc/FAQ.html#Why-does-opam-require-bwrap

我清除了 .opam 目录并做了

opam init --disable-sandboxing

在做这件事之前我做了一个:

rm -r .opam

我将再次提及所有关于关闭沙盒的危险警告(参见链接)。

我现在使用的是 OCaml 4.07.0!!!

希望这对某人有所帮助

可以在 Jane Street Install OCaml repo.

上找到更多现代指南(在 WSL2 Ubuntu 20.04 上测试)