ocaml-graphql-server
ocaml-graphql-server copied to clipboard
issues with example?
platform: windows 10 Dune: version 2.1.2 Cygwin: CYGWIN_NT-10.0 YSG4206 3.1.2(0.340/5/3) 2019-12-21 15:25 x86_64 Cygwin
$ git clone https://github.com/andreas/ocaml-graphql-server.git
$ cd ocaml-graphql-server
$ dune exec examples/server.exe
ocaml-crunch graphql-cohttp/src/assets.ml (exit 1)
(cd _build/default/graphql-cohttp/src && D:\cygwin64\home\ysg4206\.opam
\ocaml-variants.4.07.1+mingw64c\bin\ocaml-crunch.exe -m plain assets -o assets.m
l)
Generating assets.ml
ocaml-crunch: internal error, uncaught exception:
End_of_file
Thanks for reporting this @DrYSG 😄 What version of crunch
do you have installed? Check with:
opam info crunch
I suspect it could be an issue of portability with crunch
. Could you please try the following and reply with the output (OCAMLRUNPARAM=b
enables backtraces):
$ export OCAMLRUNPARAM=b
$ dune exec examples/server.exe
This might be OBE, I found the this project, which uses esy, and it builds fine:
https://github.com/anmonteiro/reason-graphql-fullstack
opam info crunch
$ opam info crunch
<><> crunch: information on all versions ><><><><><><><><><><><><><><><><><><><>
name crunch
all-versions 1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.4.0 1.4.1 2.0.0 2.1.0 2.2.0 3.0.0
3.1.0 3.2.0
<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version 3.2.0
repository default
url.src: "https://github.com/mirage/ocaml-crunch/releases/download/v3.2.0/crunch-v3.2.0.tbz"
url.checksum:
"sha256=0a1a4ebb86ab643dd193b5c0046e4d168c6e1cb41e6e5e5b6fbd3b7492e8c6de"
"sha512=8666e4081c96b7e0820c621197cb02de2238ddc911e4e95f439c69a685a5791dd4f874ba1084f56c9b44d3d579b877b1ed1f7
b0421cd56d3f36ad39c669ee4eb"
homepage: "https://github.com/mirage/ocaml-crunch"
bug-reports: "https://github.com/mirage/ocaml-crunch/issues"
dev-repo: "git+https://github.com/mirage/ocaml-crunch.git"
authors: "Anil Madhavapeddy" "Thomas Gazagnaire" "Stefanie Schirmer" "Hannes Mehnert"
maintainer: "MirageOS team"
license: "ISC"
tags: "org:mirage" "org:xapi-project"
depends: "ocaml" {>= "4.05.0"}
"cmdliner"
"ptime"
"dune" {>= "1.0"}
"lwt" {with-test}
"mirage-kv" {with-test & >= "3.0.0"}
"mirage-kv-mem" {with-test & >= "3.0.0"}
conflicts: "mirage-kv" {< "3.0.0"}
synopsis Convert a filesystem into a static OCaml module
description `ocaml-crunch` takes a directory of files and compiles them into a standalone
OCaml module which serves the contents directly from memory. This can be
convenient for libraries that need a few embedded files (such as a web server)
and do not want to deal with all the trouble of file configuration.
output with backtraces:
$ dune exec examples/server.exe
ocaml-crunch graphql-cohttp/src/assets.ml (exit 1)
(cd _build/default/graphql-cohttp/src && D:\cygwin64\home\ysg4206\.opam\ocaml-variants.4.07.1+mingw64c\bin\oca
ml-crunch.exe -m plain assets -o assets.ml)
Generating assets.ml
ocaml-crunch: internal error, uncaught exception:
End_of_file
Raised at file "buffer.ml", line 189, characters 18-35
Called from file "src/crunch.ml", line 87, characters 2-33
Called from file "src/crunch.ml", line 49, characters 30-54
Called from file "src/crunch.ml", line 53, characters 17-25
Called from file "list.ml", line 117, characters 24-34
Called from file "src/main.ml", line 50, characters 4-113
Called from file "cmdliner_term.ml", line 25, characters 19-24
Called from file "cmdliner.ml", line 117, characters 32-39
ysg4206@YSG4206 /cygdrive/d/crime/ocaml-graphql-server
Since there's only one static file, it's pretty easy to use dune to generate assets.ml
instead of crunch
.
Can you try with the following branch:
git clone https://github.com/emillon/ocaml-graphql-server.git -b crunch-dune
If that fixes the problem I'll open a PR.
$ dune build
File "graphql-async/src/dune", line 7, characters 20-32:
7 | (libraries graphql async_kernel))
^^^^^^^^^^^^
Error: Library "async_kernel" not found.
Hint: try: dune external-lib-deps --missing @@default
ysg4206@YSG4206 /cygdrive/d/crime/ocaml-graphql-server
$ dune install
Error: The following <package>.install are missing:
- _build/default/graphql-async.install
Hint: try running: dune build @install
ysg4206@YSG4206 /cygdrive/d/crime/ocaml-graphql-server
$ dune build @install
File "graphql-async/src/dune", line 7, characters 20-32:
7 | (libraries graphql async_kernel))
^^^^^^^^^^^^
Error: Library "async_kernel" not found.
Hint: try: dune external-lib-deps --missing @install
ysg4206@YSG4206 /cygdrive/d/crime/ocaml-graphql-server
$ opam install async_kernel
[ERROR] No switch is currently set. Please use 'opam switch' to set or install
a switch
ysg4206@YSG4206 /cygdrive/d/crime/ocaml-graphql-server
$
I removed the opam switch, since I tend to use esy, and the switch compiler with dune was causing issues.
@DrYSG Please try dune exec examples/server.exe
instead of dune build
et al 😄
Yes. that branch works fine. Thank you.
I spoke too soon.
$ dune clean
$ dune exec examples/server.exe
listening on http://localhost:8080/graphql
Unhandled exception: End_of_file
Unhandled exception: End_of_file
Unhandled exception: End_of_file
Unhandled exception: End_of_file