installation - In Ocaml Camlp5 is not installing (and it is necessary to use Quotations)
问题描述
In Ocaml 4, I have to use the Quotation
module, on its Quotation.add
and Quotation.ExStr
functions. It seems I have to install the Camlp5
library (seems to be a preprocessor) to do so. Found lots of info about Camlp, like:
- Camlp5: https://camlp5.readthedocs.io/en/latest/intro.html
- Camlp5: https://camlp5.github.io/doc/html/index.html
- Camlp4: https://caml.inria.fr/pub/docs/tutorial-camlp4/tutorial004.html
But no installation guides, so I tried: opam install camlp5
with the result:
┌─ The following actions failed
│ λ build conf-perl-ipc-system-simple 1
│ λ build conf-perl-string-shellquote 1
└─
╶─ No changes have been performed
So some dependencies seem not to be there, and I have tried: opam depext --install camlp5
with the result:
┌─ The following actions failed
│ λ build conf-perl-ipc-system-simple 1
│ λ build conf-perl-string-shellquote 1
└─
╶─ No changes have been performed
# Run eval $(opam env) to update the current shell environment
So does not seem to work.
The error diagnosis is the same for both commands:
The following actions will be performed:
∗ install conf-perl-string-shellquote 1 [required by camlp5]
∗ install conf-perl-ipc-system-simple 1 [required by camlp5]
∗ install camlp5 8.00.01
===== ∗ 3 =====
Do you want to continue? [Y/n] y
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>
[camlp5.8.00.01] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of conf-perl-ipc-system-simple failed at
"/Users/.../.opam/opam-init/hooks/sandbox.sh build perl
-MIPC::System::Simple -e 1".
[ERROR] The compilation of conf-perl-string-shellquote failed at
"/Users/.../.opam/opam-init/hooks/sandbox.sh build perl
-MString::ShellQuote -e 1".
#=== ERROR while compiling conf-perl-string-shellquote.1 ======================#
# context 2.0.8 | macos/x86_64 | ocaml-base-compiler.4.10.2 | https://opam.ocaml.org#ff95b837
# path ~/.opam/4.10.2/.opam-switch/build/conf-perl-string-shellquote.1
# command ~/.opam/opam-init/hooks/sandbox.sh build perl -MString::ShellQuote -e 1
# exit-code 2
# env-file ~/.opam/log/conf-perl-string-shellquote-1585-1872ec.env
# output-file ~/.opam/log/conf-perl-string-shellquote-1585-1872ec.out
### output ###
# Can't locate String/ShellQuote.pm in @INC (you may need to install the String::ShellQuote module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras[...]
# BEGIN failed--compilation aborted.
#=== ERROR while compiling conf-perl-ipc-system-simple.1 ======================#
# context 2.0.8 | macos/x86_64 | ocaml-base-compiler.4.10.2 | https://opam.ocaml.org#ff95b837
# path ~/.opam/4.10.2/.opam-switch/build/conf-perl-ipc-system-simple.1
# command ~/.opam/opam-init/hooks/sandbox.sh build perl -MIPC::System::Simple -e 1
# exit-code 2
# env-file ~/.opam/log/conf-perl-ipc-system-simple-1585-d2c37b.env
# output-file ~/.opam/log/conf-perl-ipc-system-simple-1585-d2c37b.out
### output ###
# Can't locate IPC/System/Simple.pm in @INC (you may need to install the IPC::System::Simple module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extra[...]
# BEGIN failed--compilation aborted.
I have been trying similars and alternatives for some hours, and cannot achieve it. Any help?
PS1: I am working in MAC.
PS2: If someone wants, my context for this problem is that I want to use the functions of one directory -which is a black box for me-, and all the examples are written with the parser, like <<y+2=5>>
so I do not know the grammar and have to achieve to make the parser run.
EDIT 1 (The solution proposed by Ivg)
After trying both commands of the proposed solution by Ivg (answering local::lib
in one of the questions and yes
on the others), the second of the errors seem to be corrected, when doing opam install camlp5
:
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build conf-perl-ipc-system-simple 1
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install conf-perl-string-shellquote 1
└─
Where the whole terminal has been:
... ~ % opam install camlp5
The following actions will be performed:
∗ install conf-perl-string-shellquote 1 [required by camlp5]
∗ install conf-perl-ipc-system-simple 1 [required by camlp5]
∗ install camlp5 8.00.01
===== ∗ 3 =====
Do you want to continue? [Y/n] y
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>
[camlp5.8.00.01] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of conf-perl-ipc-system-simple failed at
"/Users/.../.opam/opam-init/hooks/sandbox.sh build perl
-MIPC::System::Simple -e 1".
∗ installed conf-perl-string-shellquote.1
#=== ERROR while compiling conf-perl-ipc-system-simple.1 ======================#
# context 2.0.8 | macos/x86_64 | ocaml-base-compiler.4.10.2 | https://opam.ocaml.org#ff95b837
# path ~/.opam/4.10.2/.opam-switch/build/conf-perl-ipc-system-simple.1
# command ~/.opam/opam-init/hooks/sandbox.sh build perl -MIPC::System::Simple -e 1
# exit-code 2
# env-file ~/.opam/log/conf-perl-ipc-system-simple-20351-1872ec.env
# output-file ~/.opam/log/conf-perl-ipc-system-simple-20351-1872ec.out
### output ###
# Can't locate IPC/System/Simple.pm in @INC (you may need to install the IPC::System::Simple module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4/darwin-thread-multi-2level /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2le[...]
# BEGIN failed--compilation aborted.
EDIT 2 (Solved, repeating)
Suddenly it worked. I wrote once again sudo cpan IPC::System::Simple
(there was no questions now) and after that, opam install conf-perl-ipc-system-simple
.
Anyway, the Quoation
module is not opening for me.
解决方案
The error messages are indicating that your perl installation is missing two modules, String::ShellQuote
and IPC::System::Simple
. Since opam
don't know how to do this on macOS (there are too many options) it just indicates that those modules are missing and required for camlp5 installation so it can't proceed. It is now your move and you need to figure out how to make those two modules available for your perl installation.
You can try and use CPAN for that, e.g., (sudo
might not be necessary, depending on your configuration)
sudo cpan IPC::System::Simple
sudo cpan String::ShellQuote
推荐阅读
- mysql - 如何查询行/列中的数据
- c# - 使用 linq 而不是 foreach 从列表中获取所有值
- javascript - 设置对象属性:!object.propety volatile 吗?
- angular - Ionic 4订阅仅在页面直接加载时触发
- javascript - How to call javascript on F5 key press
- python - 在实现逻辑回归梯度下降的矢量化 + 正则化版本时遇到问题
- python - python - 从完整地址获取邮政编码
- linux - bash 中 dd/mm/yyyy 格式到特定日期的总天数
- java - 拥有多个具有相同依赖项的嵌套类还是具有更大范围的嵌套类更好?
- javascript - 表中的动态表在保存/加载时不会保留它们的值