我在这里有一个问题,这真的让我疯狂。 我从未与OCaml合作过,对此一无所知或工作原理。
问题:我需要安装camlidl库。我是通过opam(opam install camlidl
)来完成的。
正如我之前所说,我不知道OCaml。 ocamlfind list
,未显示包列表。搜索网络 - 发现运行eval $'opam config eval'
有帮助。
奇怪(我不知道为什么)ocamlfind在执行此命令后能够看到包,但是如果我运行sudo ocamlfind list
它会显示没有此包的列表。
任何人都可以帮助我理解为什么会发生这种情况以及如何解决这个问题? 我需要编译需要camlidl的东西,它必须在sudo下完成。
提前谢谢你!
执行ocamlfind list
bigarray (version: [distributed with Ocaml])
bytes (version: [OCaml strictly before 4.02])
camlidl (version: 1.05)
camlp4 (version: [distributed with Ocaml])
camlp4.exceptiontracer (version: [distributed with Ocaml])
camlp4.extend (version: [distributed with Ocaml])
camlp4.foldgenerator (version: [distributed with Ocaml])
camlp4.fulllib (version: [distributed with Ocaml])
camlp4.gramlib (version: [distributed with Ocaml])
camlp4.lib (version: [distributed with Ocaml])
camlp4.listcomprehension (version: [distributed with Ocaml])
camlp4.locationstripper (version: [distributed with Ocaml])
camlp4.macro (version: [distributed with Ocaml])
camlp4.mapgenerator (version: [distributed with Ocaml])
camlp4.metagenerator (version: [distributed with Ocaml])
camlp4.profiler (version: [distributed with Ocaml])
camlp4.quotations (version: [distributed with Ocaml])
camlp4.quotations.o (version: [distributed with Ocaml])
camlp4.quotations.r (version: [distributed with Ocaml])
camlp4.tracer (version: [distributed with Ocaml])
compiler-libs (version: [distributed with Ocaml])
compiler-libs.bytecomp (version: [distributed with Ocaml])
compiler-libs.common (version: [distributed with Ocaml])
compiler-libs.optcomp (version: [distributed with Ocaml])
compiler-libs.toplevel (version: [distributed with Ocaml])
dynlink (version: [distributed with Ocaml])
findlib (version: 1.5.5)
graphics (version: [distributed with Ocaml])
labltk (version: [distributed with Ocaml])
num (version: [distributed with Ocaml])
num-top (version: 1.5.5)
num.core (version: [internal])
oUnit (version: 2.0.0)
oUnit.advanced (version: 2.0.0)
oUnit.threads (version: 2.0.0)
ocamlbuild (version: [distributed with Ocaml])
ocamlgraph (version: 1.8.6)
stdlib (version: [distributed with Ocaml])
str (version: [distributed with Ocaml])
threads (version: [distributed with Ocaml])
threads.posix (version: [internal])
threads.vm (version: [internal])
unix (version: [distributed with Ocaml])
执行sudo ocamlfind list
bigarray (version: [distributed with Ocaml])
camlp4 (version: [distributed with Ocaml])
camlp4.exceptiontracer (version: [distributed with Ocaml])
camlp4.extend (version: [distributed with Ocaml])
camlp4.foldgenerator (version: [distributed with Ocaml])
camlp4.fulllib (version: [distributed with Ocaml])
camlp4.gramlib (version: [distributed with Ocaml])
camlp4.lib (version: [distributed with Ocaml])
camlp4.listcomprehension (version: [distributed with Ocaml])
camlp4.locationstripper (version: [distributed with Ocaml])
camlp4.macro (version: [distributed with Ocaml])
camlp4.mapgenerator (version: [distributed with Ocaml])
camlp4.metagenerator (version: [distributed with Ocaml])
camlp4.profiler (version: [distributed with Ocaml])
camlp4.quotations (version: [distributed with Ocaml])
camlp4.quotations.o (version: [distributed with Ocaml])
camlp4.quotations.r (version: [distributed with Ocaml])
camlp4.tracer (version: [distributed with Ocaml])
compiler-libs (version: [distributed with Ocaml])
compiler-libs.bytecomp (version: [distributed with Ocaml])
compiler-libs.common (version: [distributed with Ocaml])
compiler-libs.optcomp (version: [distributed with Ocaml])
compiler-libs.toplevel (version: [distributed with Ocaml])
dynlink (version: [distributed with Ocaml])
findlib (version: 1.4.1)
graphics (version: [distributed with Ocaml])
labltk (version: [distributed with Ocaml])
num (version: [distributed with Ocaml])
num-top (version: 1.4.1)
num.core (version: [internal])
oUnit (version: 2.0.0)
oUnit.advanced (version: 2.0.0)
oUnit.threads (version: 2.0.0)
ocamlbuild (version: [distributed with Ocaml])
ocamlgraph (version: 1.8.5)
stdlib (version: [distributed with Ocaml])
str (version: [distributed with Ocaml])
threads (version: [distributed with Ocaml])
threads.posix (version: [internal])
threads.vm (version: [internal])
unix (version: [distributed with Ocaml])
执行opam
Installed packages for system:
base-bigarray base Bigarray library distributed with the OCaml compiler
base-threads base Threads library distributed with the OCaml compiler
base-unix base Unix library distributed with the OCaml compiler
camlidl 1.05 Stub code generator for OCaml
ocamlfind 1.5.5 A library manager for OCaml
ocamlgraph 1.8.6 A generic graph library for OCaml
ounit 2.0.0 Unit testing framework loosely based on HUnit. It is similar to JUnit, and other XUnit testing frameworks
执行sudo -i opam list
Installed packages for system:
base-bigarray base Bigarray library distributed with the OCaml compiler
base-threads base Threads library distributed with the OCaml compiler
base-unix base Unix library distributed with the OCaml compiler
camlidl 1.05 Stub code generator for OCaml
答案 0 :(得分:0)
eval $(opam config env)
使用变量填充您的环境,这有助于ocamlfind
在Python中查找库,c.f。,PIP的虚拟环境。
在用户帐户下评估此命令时,只为用户填充环境,以便其他用户(包括root用户)无法看到该环境。此外,通常,您在用户本地模式下安装ocaml软件包,而不是在系统范围内。
为了解决您的问题,我没有深入研究OCaml基础设施,我建议如下,
如果可能,请不要使用sudo
。实际上,我没有看到使用sudo
进行编译的原因。它可能只需要安装。因此,请使用make
和sudo make install
。如果您已经意外地使用make
运行sudo
,则可能会在root所有权下创建文件,因此您需要删除所有内容并从头开始。
如果不可能(包构建系统如此破碎),则尝试在root用户下安装opam,并以root身份执行所有操作,例如,使用{{1}切换到root模式并继续正常。