Using/installing `num` library on `ocaml@4.12.0`

It would seem everytime i try to install a project depending on num in ocaml@4.12.0 I get this falling error:

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ βˆ— install num 1.4
└─

Anyone now what this is or how to use num on 4.12.0?

I see on the repository that its legacy now. GitHub - ocaml/num: The legacy Num library for arbitrary-precision integer and rational arithmetic.

Not sure what the next step is, though. Any guidance would be greatly appreciated.

Thank you.

I also tried pinning to a version I have used in esy based projects:

❯ opam pin add num https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713
[num.1.4] synchronised (git+https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713)
[WARNING] Failed checks on num package definition from source at
          git+https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713:
  warning 62: License doesn't adhere to the SPDX standard, see https://spdx.org/licenses/: "LGPL 2.1 with OCaml linking exception"
num is now pinned to git+https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713 (version 1.4)

The following actions will be performed:
  βˆ— install num 1.4*
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved num.1.4  (no changes)
[ERROR] The compilation of num.1.4 failed at "dune subst".

#=== ERROR while compiling num.1.4 ============================================#
# context     2.1.0 | macos/x86_64 | ocaml-system.4.12.0 | pinned(git+https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713#bdb2d765)
# path        ~/Github/CAAS/update-frontend/_opam/.opam-switch/build/num.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune subst
# exit-code   1
# env-file    ~/.opam/log/num-56006-d66f1c.env
# output-file ~/.opam/log/num-56006-d66f1c.out
### output ###
# Error: The project name is not defined, please add a (name <name>) field to
# your dune-project file.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build num 1.4
└─
╢─ No changes have been performed
[NOTE] Pinning command successful, but your installed packages may be out of sync.

~/Github/CAAS/update-frontend update-frontend                                                                                  ✘ 31 9s  3.0.1
❯ opam install num

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><>  🐫
[num.1.4] synchronised (no changes)

The following actions will be performed:
  βˆ— install num 1.4*

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved num.1.4  (no changes)
[ERROR] The compilation of num.1.4 failed at "dune subst".

#=== ERROR while compiling num.1.4 ============================================#
# context     2.1.0 | macos/x86_64 | ocaml-system.4.12.0 | pinned(git+https://github.com/dune-universe/num.git#bdb2d7653e927e142b701b51d89f393471279713#bdb2d765)
# path        ~/Github/CAAS/update-frontend/_opam/.opam-switch/build/num.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune subst
# exit-code   1
# env-file    ~/.opam/log/num-56473-9c6494.env
# output-file ~/.opam/log/num-56473-9c6494.out
### output ###
# Error: The project name is not defined, please add a (name <name>) field to
# your dune-project file.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build num 1.4
└─
╢─ No changes have been performed

but that does not seem to work either.

Can you show the output of opam show num ? Your pinned version shows errors while building with dune, but the official numpackage does not depend on dune, so I suspect you’re not installing the official package.

Hi, check out OCaml - Recently removed or moved libraries (Graphics, Bigarray, Num, LablTk)

HTH!

@yawaramin thank you, sir. So does that mean I am encouraged to find out which lib is depending on it and update that lib?

If possible, the best way forward is to replace num with zarith.

Is there an easy way to see which libs are depending on that package?

Opam probably has a command-line flag to print out the reverse-dependencies of a package. Perhaps an opam wizard can chime in…

opam list --depends-on num will list dependencies that depend on num. If you add the --recursive flag it will list all transitive dependencies as opposed to just direct dependencies.

2 Likes

What was the error log of that first installation?
I think I had a similar issue recently where num would failed to install because of the already existing (but empty) _opam/lib/num and _opam/lib/num-top (this was a local switch).
I have no idea why or how I ended up with these, but deleting folders solved the issue.

2 Likes