1

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.

Theo Deep
  • 666
  • 4
  • 15
  • 1
    You're missing the actual error message. In your output. The message that you show is just the default opam's message that the mission failed. To get to the interesting stuff you need to scroll up. Given that it fails on installing system packages, I would suggest you to install Homebrew and make sure that it works fine, then try again. – ivg May 17 '21 at 15:35
  • Completely. I have updated the message, with the whole message. Also, I already have homebrew, so I have done ```brew install camlp5```, which has been successfully installed. Then I have opened the toplevel writing ```ocaml```. Then, I have both done ```open Quotation``` and ```open Camlp5``` but no one works. – Theo Deep May 17 '21 at 18:45

1 Answers1

4

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
ivg
  • 34,431
  • 2
  • 35
  • 63
  • Hi! I have done both commands and at least one of the dependencies seem to be fixed (you can see it on the Edit), thanks a lot! I will keep trying. – Theo Deep May 17 '21 at 20:09
  • Well, 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```. Now I will see if the modules work, but seems good. – Theo Deep May 17 '21 at 20:18
  • I am not capable to make the modules run (i.e. ```open Quotation``` is not working, but it seems to be a more complex loading), but anyway, the problem that I post here is solved (EDIT 2 of the question). – Theo Deep May 17 '21 at 20:33
  • 1
    Just to add that if you select `local::lib` in the `cpan` setup as @TheoDeep has done, then `sudo` is not needed. – corwin.amber Jul 08 '21 at 15:02