yojson icon indicating copy to clipboard operation
yojson copied to clipboard

need help in compiling YoJson on Debian/Sid or Ubuntu/23 (x86-64)

Open bstarynk opened this issue 2 years ago • 2 comments

Thanks for this JSON parsing library. I (Basile Starynevitch, in France, email [email protected]) am considering using it within the RefPerSys open source inference engine project for Linux (see some GPLv3+ code on github...).

However, installation on a Ubuntu 23 desktop (x86-64 processor) fails with:

rimski.x86_64 /usr/src/Libs 11:14 .0 % git clone [email protected]:ocaml-community/yojson.git
Cloning into 'yojson'...
X11 forwarding request failed on channel 0
remote: Enumerating objects: 2195, done.
remote: Counting objects: 100% (596/596), done.
remote: Compressing objects: 100% (198/198), done.
remote: Total 2195 (delta 431), reused 514 (delta 391), pack-reused 1599
Receiving objects: 100% (2195/2195), 771.24 KiB | 2.06 MiB/s, done.
Resolving deltas: 100% (1080/1080), done.
rimski.x86_64 /usr/src/Libs 11:14 .0 % cd yojson 
rimski.x86_64 src/Libs/yojson 11:14 .0 % ls
bench	    CODEOWNERS	  examples    Makefile	 test.json
bin	    doc		  lib	      README.md  yojson-bench.opam
CHANGES.md  dune-project  LICENSE.md  test	 yojson.opam
rimski.x86_64 src/Libs/yojson 11:14 .0 % make
File "bench/dune", line 6, characters 3-23:
6 |    core_bench.internals sexplib))
       ^^^^^^^^^^^^^^^^^^^^
Error: Library "core_bench.internals" not found.
Hint: try:
  dune external-lib-deps --missing @install @examples
Done: 192/199 (jobs: 1)make: *** [Makefile:3: all] Error 1
rimski.x86_64 src/Libs/yojson 11:14 .2 % ls
bench	CHANGES.md  dune-project  LICENSE.md  test		 yojson.opam
bin	CODEOWNERS  examples	  Makefile    test.json
_build	doc	    lib		  README.md   yojson-bench.opam
rimski.x86_64 src/Libs/yojson 11:15 .0 % less README.md 
rimski.x86_64 src/Libs/yojson 11:17 .0 % make
File "bench/dune", line 6, characters 3-23:
6 |    core_bench.internals sexplib))
       ^^^^^^^^^^^^^^^^^^^^
Error: Library "core_bench.internals" not found.
Hint: try:
  dune external-lib-deps --missing @install @examples
Done: 0/0 (jobs: 0)make: *** [Makefile:3: all] Error 1
rimski.x86_64 src/Libs/yojson 11:17 .2 % dune external-lib-deps --missing @install @examples
Done: 0/0 (jobs: 0)Error: The following libraries are missing in the default context:
- core
- core_bench
- core_bench.internals
- core_unix.command_unix
Hint: try:
  opam install core core_bench core_unix
rimski.x86_64 src/Libs/yojson 11:22 .1 % opam install core core_bench core_unix
[ERROR] No package named core_unix found.
opam install core core_bench core_unix  3.51s user 1.90s system 60% cpu 8.927 total

With ocaml --version giving The OCaml toplevel, version 4.13.1. It is in $HOME/.opam/default/bin/ocaml

Your help is appreciated. Feel free to contact me (Basile Starynkevitch) by email to [email protected]

Contributors to RefPerSys are also welcome.

bstarynk avatar Sep 28 '23 09:09 bstarynk

You are missing some dependencies.

It is strange that core_unix is not found. Try opam update ?

A handy command is opam install . --deps-only to install all dependencies of a git-cloned opam package.

You can also build and install yojson directly with opam: opam install yojson.

panglesd avatar Sep 28 '23 10:09 panglesd

There is also the option to avoid core_bench by just picking the main Yojson package and not building the benchmarks:

$ dune build --only-packages yojson

Leonidas-from-XIV avatar May 31 '24 09:05 Leonidas-from-XIV

Since #189 removed core_bench as a dependency, the dependency situation should be significantly simpler going forward. Therefore closing the ticket.

Leonidas-from-XIV avatar Apr 25 '25 12:04 Leonidas-from-XIV