gfngfn / SATySFi

A statically-typed, functional typesetting system
GNU Lesser General Public License v3.0
1.16k stars 83 forks source link

`opam init --comp 4.10.0` doesn't work #244

Closed TonalidadeHidrica closed 3 years ago

TonalidadeHidrica commented 3 years ago

As a OCaml & SaTySFi beginner, I had a trouble even in initializing opam. When I tried opam init --comp 4.10.0, after several interaction, opam claims [ERROR] Compiler selection '4.10.0' is ambiguous. matching packages: { ocaml-base-compiler.4.10.0, ocaml-system.4.10.0 }. Is it my fault or the official document is incomplete? Thanks in advance.

na4zagin3 commented 3 years ago

It's not your fault. The message meant β€œYou already have OCaml 4.10.0 installed in your system. Do you want OPAM to use the system OCaml compiler (ocaml-system.4.10.0) or to build a new OCaml compiler (ocaml-base-compiler.4.10.0)?”

You can specify either opam init --comp ocaml-base-compiler.4.10.0 or opam init --comp ocaml-system.4.10.0 instead of opam init --comp 4.10.0.

TonalidadeHidrica commented 3 years ago

Ok, now I understood why: I've already installed OCaml 4.10.0 via brew, and now I'm trying to install once more via opam. I didn't know the difference between system and base-compiler, but the former means that I'll just use the already-installed one, while the latter means I'll build a new compiler again, right? Thanks for your help. I'm now closing this issue.

TonalidadeHidrica commented 3 years ago

Now I have another problem: it fails to install num with the following message. But, it's also related with my existing ocaml right? Would you mind telling me how can I fix this as well?

$  opam install satysfi                                                                                                23:30:27

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><>  🐫
[satysfi.0.0.5] no changes from git+file:///path/to/SATySFi#master

The following actions will be performed:
  βˆ— install num         1.3     [required by batteries]
  βˆ— install sexplib     v0.14.0 [required by core_kernel]
  βˆ— install batteries   3.1.0   [required by satysfi]
  βˆ— install core_kernel v0.14.0 [required by satysfi]
  βˆ— install satysfi     0.0.5*
===== βˆ— 5 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
[batteries.3.1.0] found in cache
[core_kernel.v0.14.0] found in cache
[num.1.3] found in cache
[sexplib.v0.14.0] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
[ERROR] The installation of num failed at "make findlib-install".

#=== ERROR while installing num.1.3 ===========================================#
# context     2.0.7 | macos/x86_64 | ocaml-system.4.10.0 | https://opam.ocaml.org#f1589d4f
# path        ~/.opam/default/.opam-switch/build/num.1.3
# command     ~/.opam/opam-init/hooks/sandbox.sh install make findlib-install
# exit-code   2
# env-file    ~/.opam/log/num-60435-d6d332.env
# output-file ~/.opam/log/num-60435-d6d332.out
### output ###
# [ERROR] It appears that the num library was previously installed to your system
#         compiler's lib directory, probably by a faulty opam package.
#         You will need to remove arith_flags.*, arith_status.*, big_int.*,
#         int_misc.*, nat.*, num.*, ratio.*, nums.*, libnums.* and
#         stublibs/dllnums.* from /usr/local/lib/ocaml.
# make: *** [findlib-install] Error 1

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ βˆ— install num 1.3
└─
╢─ No changes have been performed
na4zagin3 commented 3 years ago

I didn't know the difference between system and base-compiler, but the former means that I'll just use the already-installed one, while the latter means I'll build a new compiler again, right?

Exactly

# [ERROR] It appears that the num library was previously installed to your system
#         compiler's lib directory, probably by a faulty opam package.
#         You will need to remove arith_flags.*, arith_status.*, big_int.*,
#         int_misc.*, nat.*, num.*, ratio.*, nums.*, libnums.* and
#         stublibs/dllnums.* from /usr/local/lib/ocaml.

Hmm, it looks that the num package had already installed by homebrew or something.

Using ocaml-base-compiler.4.10.0 instead of ocaml-system.4.10.0 can probably be the quickest solution.

TonalidadeHidrica commented 3 years ago

You're right, ocaml-num formula was installed in my system. I've tried $ opam switch create ocaml-base-compiler.4.10.0 and watching if it works.

TonalidadeHidrica commented 3 years ago

It works! Thanks for your support.