janestreet / bonsai

A library for building dynamic webapps, using Js_of_ocaml
MIT License
368 stars 39 forks source link

Can't build the hello_world example. #24

Open joanimato opened 2 years ago

joanimato commented 2 years ago

Hi,

I'm trying to get started with the hello_world example, but when I try to build it I'm getting the following error

dune build ./main.bc.js

Entering directory 'path/to/bonsai'
File "web/dune", line 4, characters 18-47:
4 |   bonsai_protocol incr_dom.javascript_profiling)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Library "incr_dom.javascript_profiling" not found.
-> required by library "bonsai.web" in _build/default/web
-> required by executable main in examples/hello_world/dune:1
-> required by _build/default/examples/hello_world/main.bc.js

As far as I can tell, incr_dom is installed. I've also tried adding the janestreet repository to my current opam switch, but the same error persists.

I'm using Ocaml 4.13 on WSL/Windows. Opam list: https://gist.github.com/joanimato/55207a2352daa16c142b052342b8231a

TyOverby commented 2 years ago

could you make an empty switch, add the janestreet repository to it, and then install bonsai again?

joanimato commented 2 years ago

Sorry for the late reply. For some reason I'm not receiving notifications on these....

Still not working. I even tried it on a Mac this time and got a similar error.

List of commands:

opam switch create ./ --empty
opam repo add janestreet-bleeding https://ocaml.janestreet.com/opam-repository
opam install bonsai
dune build ./main.bc.js

the output that I got was:

Entering directory 'path/to/bonsai'
File "web/dune", line 4, characters 18-47:
4 |   bonsai_protocol incr_dom.javascript_profiling)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Library "incr_dom.javascript_profiling" not found.
Hint: try:
  dune external-lib-deps --missing ./main.bc.js

I tried the command in the hint and it doesn't seem to do anything.

joanimato commented 2 years ago

I was able to resolve the issue by using the standard opam repository with Ocaml 4.13 installed. I was initially confused because I expected the build folder to be inside the hello_world directory, but it actually appears at the root folder of the repository. Once I figured that out, the hello_world example compiles fine.

Some of the examples still gave me dependency issues (like "bonsai_web_ui_panels_experimental" or "piecewise_linear_kernel" not found...), but I was able to build most of them.

crackcomm commented 1 year ago

I was trying to build dygraph example but I can't find Piecewise_linear_kernel.Make_invertible anywhere, where can I find it to build this example?