In Ocaml Camlp5 is not installing (and it is necessary to use Quotations)

384 views Asked by At

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:

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.

1

There are 1 answers

4
ivg On BEST ANSWER

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