ocaml-multicore / eio_js

Eio for JavaScript environments
ISC License
7 stars 1 forks source link

getting started clues? #1

Open dckc opened 3 months ago

dckc commented 3 months ago

Hi. I'm interested to try this out, but my working knowledge of ocaml tooling has faded.

Starting from a basic Ubuntu installation, how would I run the example in the README?

p.s. I'd actually prefer to start from nix, but I suspect that complicates things.

talex5 commented 3 months ago

Based on the old instructions at https://github.com/ocaml-multicore/eio/pull/680#issuecomment-1964599741, the example should build with:

git clone https://github.com/ocaml-multicore/eio_js.git
cd eio_js
opam install --deps-only -t .
opam install js_of_ocaml-ppx
dune build @default

The run a web-server (e.g. docker run --rm -it -p8080:80 -v (pwd)/_build/default/lib_js_of_ocaml_eio/examples/boulderdash/:/usr/share/nginx/html:ro nginx) and browse to http://localhost:8080.

For me, it then fails with runtime.caml_domain_dls_compare_and_set is not a function, but that's probably because I'm using a beta release of OCaml.

dckc commented 3 months ago

neglected to Activate the opam switch

the opam stuff worked, but I got...

$ dune build @default
Command 'dune' not found

ah...

$ eval $(opam env)

mdx not automatically installed?

next hiccup:

$ dune build @default
File "lib_eio_js_backend/tests/dune", line 1, characters 0-70:
1 | (mdx
2 |   (package eio_js_backend)
3 |   (deps
4 |     (package eio_js_backend)))
Error: Library "mdx.top" not found.
-> required by _build/default/lib_eio_js_backend/tests/mdx_gen.bc
-> required by alias lib_eio_js_backend/tests/all
-> required by alias lib_eio_js_backend/tests/default
File "lib_eio_js_backend/tests/dune", line 1, characters 0-70:
1 | (mdx
2 |   (package eio_js_backend)
3 |   (deps
4 |     (package eio_js_backend)))
Error: Program ocaml-mdx not found in the tree or in PATH
 (context: default)
Hint: opam install mdx
Warning: integer overflow: integer 0xe9846af9b1a615d (1051668233026429277) truncated to 0x9b1a615d (-1692769955); the generated code might be incorrect.
Warning: integer overflow: integer 0xe9846af9b1a615d (1051668233026429277) truncated to 0x9b1a615d (-1692769955); the generated code might be incorrect.

ok... let's try the opam install mdx hint... worked.

winning

image

image

Thanks!

IOU a PR to add something like this to the README