Dependency problem to build ocsigen-start without dead buttons

Hi !
I opam installed ocsigen-start 2.7. I can build the app, but all buttons does not trigger anything when clicked (except for the main page linked which reload the page). It seems to be a js_of_ocaml problem since I can go to service http://localhost:8080/demo-popup when I type the url (and here again clicking the button does not trigger the popup).
Here is what I did, on a fresh 4.7.1 ocaml switch:

opam install ocsigen-start
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed conf-dbm.1.0.0
∗ installed conf-gmp.1
∗ installed conf-gmp-powm-sec.1
∗ installed conf-m4.1
∗ installed cmdliner.1.0.4
∗ installed conf-npm.1
∗ installed conf-perl.1
∗ installed conf-pkg-config.1.1
∗ installed conf-libpcre.1
∗ installed conf-libssl.1
∗ installed conf-zlib.1
∗ installed seq.base
∗ installed ocamlfind.1.8.1
∗ installed base-bytes.base
∗ installed dbm.1.2
∗ installed num.1.2
∗ installed ocamlbuild.0.14.0
∗ installed calendar.2.04
∗ installed ocamlify.0.0.1
∗ installed ocamlmod.0.0.9
∗ installed ppx_tools.5.1+4.06.0
∗ installed topkg.1.0.1
∗ installed astring.0.8.3
∗ installed react.1.2.1
∗ installed reactiveData.0.2.2
∗ installed uchar.0.0.2
∗ installed uutf.1.0.2
∗ installed jsonm.1.0.1
∗ installed xml-light.2.4
∗ installed zarith.1.9.1
∗ installed dune.1.11.4
∗ installed base64.3.2.0
∗ installed bigarray-compat.1.0.0
∗ installed cppo.1.6.6
∗ installed cryptokit.1.14
∗ installed cstruct.5.0.0
∗ installed csv.2.3
∗ installed dune-configurator.1.0.0
∗ installed easy-format.1.3.2
∗ installed hex.1.4.0
∗ installed jbuilder.transition
∗ installed biniou.1.2.1
∗ installed js_of_ocaml-ocamlbuild.3.5.0
∗ installed macaddr.4.0.0
∗ installed magic-mime.1.1.2
∗ installed mmap.1.1.0
∗ installed oasis.0.4.11
∗ installed ocaml-compiler-libs.v0.12.1
∗ installed ocplib-endian.1.0
∗ installed ppx_derivers.1.2.1
∗ installed re.1.9.0
∗ installed result.1.4
∗ installed rresult.0.6.0
∗ installed safepass.3.0
∗ installed sexplib0.v0.12.0
∗ installed ocaml-migrate-parsetree.1.4.0
∗ installed base.v0.12.2
∗ installed camlp4.4.07+1
∗ installed fieldslib.v0.12.0
∗ installed lwt.4.4.0
∗ installed lwt_react.1.1.3
∗ installed parsexp.v0.12.0
∗ installed lwt_camlp4.1.0.0
∗ installed pcre.7.4.1
∗ installed lwt_log.1.1.1
∗ installed ppx_tools_versioned.5.2.3
∗ installed lwt_ppx.1.2.4
∗ installed ppxfind.1.3
∗ installed ppx_deriving.4.4
∗ installed resource-pooling.1.1
∗ installed sexplib.v0.12.0
∗ installed ssl.0.5.9
∗ installed deriving.0.8.1
∗ installed lwt_ssl.1.1.3
∗ installed stdio.v0.12.0
∗ installed js_of_ocaml-camlp4.3.1.0
∗ installed stdlib-shims.0.1.0
∗ installed pgocaml.3.2
∗ installed fmt.0.8.8
∗ installed domain-name.0.3.0
∗ installed ipaddr.4.0.0
∗ installed stringext.1.6.0
∗ installed tyxml.4.3.0
∗ installed ppxlib.0.8.1
∗ installed macaque.0.7.4
∗ installed ocsigen-i18n.3.4.0
∗ installed uri.3.0.0
∗ installed yojson.1.7.0
∗ installed ppx_fields_conv.v0.12.0
∗ installed ppx_sexp_conv.v0.12.0
∗ installed ipaddr-sexp.4.0.0
∗ installed uri-sexp.3.0.0
∗ installed cohttp.2.4.0
∗ installed js_of_ocaml-compiler.3.5.0
∗ installed js_of_ocaml.3.5.0
∗ installed logs.0.7.0
∗ installed js_of_ocaml-ppx.3.5.0
∗ installed cohttp-lwt.2.4.0
∗ installed conduit.2.0.2
∗ installed js_of_ocaml-ppx_deriving_json.3.5.0
∗ installed js_of_ocaml-tyxml.3.5.0
∗ installed js_of_ocaml-lwt.3.5.0
∗ installed conduit-lwt.2.0.2
∗ installed conduit-lwt-unix.2.0.2
∗ installed cohttp-lwt-unix.2.4.0
∗ installed ocamlnet.4.1.6
∗ installed ocsigenserver.2.15.0
[ERROR] The compilation of eliom failed at
        "/home/milan/.opam/opam-init/hooks/sandbox.sh build make".

#=== ERROR while compiling eliom.6.7.0 ========================================#
# context     2.0.4 | linux/x86_64 | ocaml-base-compiler.4.07.1 | https://opam.ocaml.org/#c2d5ce87
# path        ~/.opam/ocigen_start_trial_new_release/.opam-switch/build/eliom.6.7.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code   2
# env-file    ~/.opam/log/eliom-5321-ef1fc2.env
# output-file ~/.opam/log/eliom-5321-ef1fc2.out
### output ###
# [...]
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -package js_of_ocaml.ppx -package js_of_ocaml-ppx.deriving,lwt_ppx,js_of_ocaml-lwt[...]
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -modules src/lib/client/eliom_config.mli > src/lib/client/eliom_config.mli.depends
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -modules src/lib/client/eliom_content_core.mli > src/lib/client/eliom_content_core[...]
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -package js_of_ocaml.ppx -package js_of_ocaml-ppx.deriving,lwt_ppx,js_of_ocaml-lwt[...]
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -package js_of_ocaml.ppx -package js_of_ocaml-ppx.deriving,lwt_ppx,js_of_ocaml-lwt[...]
# ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -package js_of_ocaml.ppx -package js_of_ocaml-ppx.deriving,lwt_ppx,js_of_ocaml-lwt[...]
# + ocamlfind ocamldep -package js_of_ocaml-ppx.deriving -package react,js_of_ocaml,reactiveData -package lwt_react,tyxml.functor,js_of_ocaml.tyxml,js_of_ocaml-lwt,js_of_ocaml-lwt.logger -package deriving.runtime,js_of_ocaml.deriving -package ocsigenserver.cookies,ocsigenserver.polytables,ocsigenserver.baselib.base -package js_of_ocaml.ppx -package js_of_ocaml-ppx.deriving,lwt_ppx,js_of_ocaml-l[...]
# File "src/lib/eliom_cookies_base.shared.ml", line 21, characters 28-39:
# Error: Deriver json does not support inline notation
# Command exited with code 2.
# Makefile:7: recipe for target 'all' failed
# make: *** [all] Error 10



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build eliom 6.7.0
└─ 

As eliom installation aborted, I installed it with:

$ opam install eliom
[NOTE] It seems you have not updated your repositories for a while. Consider
       updating them with:
       opam update

The following actions will be performed:
  ↘ downgrade js_of_ocaml                   3.5.0 to 3.4.0 [required by eliom]
  ↻ recompile logs                          0.7.0          [uses js_of_ocaml]
  ↘ downgrade js_of_ocaml-ppx_deriving_json 3.5.0 to 3.4.0 [required by eliom]
  ↘ downgrade js_of_ocaml-ppx               3.5.0 to 3.4.0 [required by eliom]
  ↻ recompile conduit                       2.0.2          [uses logs]
  ↻ recompile cohttp-lwt                    2.4.0          [uses logs]
  ↘ downgrade js_of_ocaml-tyxml             3.5.0 to 3.4.0 [required by eliom]
  ↘ downgrade js_of_ocaml-lwt               3.5.0 to 3.4.0 [required by eliom]
  ↻ recompile conduit-lwt                   2.0.2          [uses conduit]
  ∗ install   eliom                         6.9.1
  ↻ recompile conduit-lwt-unix              2.0.2          [uses conduit-lwt]
  ↻ recompile cohttp-lwt-unix               2.4.0          [uses logs]
===== ∗ 1   ↻ 6   ↘ 5 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[cohttp-lwt.2.4.0] found in cache
[cohttp-lwt-unix.2.4.0] found in cache
[conduit.2.0.2] found in cache
[conduit-lwt.2.0.2] found in cache
[conduit-lwt-unix.2.0.2] found in cache
[eliom.6.9.1] found in cache
[js_of_ocaml.3.4.0] found in cache
[js_of_ocaml-lwt.3.4.0] found in cache
[js_of_ocaml-ppx.3.4.0] found in cache
[js_of_ocaml-ppx_deriving_json.3.4.0] found in cache
[js_of_ocaml-tyxml.3.4.0] found in cache
[logs.0.7.0] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⊘ removed   cohttp-lwt-unix.2.4.0
⊘ removed   cohttp-lwt.2.4.0
⊘ removed   conduit-lwt-unix.2.0.2
⊘ removed   conduit-lwt.2.0.2
⊘ removed   conduit.2.0.2
⊘ removed   js_of_ocaml-lwt.3.5.0
⊘ removed   js_of_ocaml-ppx_deriving_json.3.5.0
⊘ removed   js_of_ocaml-tyxml.3.5.0
⊘ removed   js_of_ocaml-ppx.3.5.0
⊘ removed   logs.0.7.0
⊘ removed   js_of_ocaml.3.5.0
∗ installed js_of_ocaml.3.4.0
∗ installed js_of_ocaml-ppx_deriving_json.3.4.0
∗ installed logs.0.7.0
∗ installed js_of_ocaml-ppx.3.4.0
∗ installed conduit.2.0.2
∗ installed cohttp-lwt.2.4.0
∗ installed js_of_ocaml-lwt.3.4.0
∗ installed js_of_ocaml-tyxml.3.4.0
∗ installed conduit-lwt.2.0.2
∗ installed conduit-lwt-unix.2.0.2
∗ installed cohttp-lwt-unix.2.4.0
∗ installed eliom.6.9.1
Done.
~$ opam install ocsigen-start
[NOTE] It seems you have not updated your repositories for a while. Consider
       updating them with:
       opam update

The following actions will be performed:
  ∗ install ocsigen-toolkit 2.3.2 [required by ocsigen-start]
  ∗ install ocsigen-start   2.7.0
===== ∗ 2 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocsigen-start.2.7.0] found in cache
[ocsigen-toolkit.2.3.2] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed ocsigen-toolkit.2.3.2
∗ installed ocsigen-start.2.7.0
Done.

So you can see I could install succesfully eliom 6.9.1 and then ocsigen-start 2.7. I installed external dependencies:

$ opam depext ocsigen-start
# a few debugs...
# OS packages installation successful

An finally, I could build the project with

eliom-distillery -name os27 -template os.pgocaml
cd os27
make db-init
make db-create
make db-schema
make test.byte

And then I got the result I explained at the beginning. I checked downloaded ocsigen-start was written with Js_of_ocaml 3.4 syntax.
What do you think is going wrong ?
Thanks in advance for your help :slight_smile:

Indeed if buttons do not work it means that the client side program failed.
Either the js file cannot be found or an exception is raised.
Have a look in the browser console to get more information.

1 Like

Hi Vincent_balat, thanks for your answer !

Indeed I could have mention this. Js file is included, and their is one single error printed on console: TypeError: a is undefined

To be more accurate if it is relevant, here is the details from that error:

TypeError: a is undefined os27_b6cccceeef0af3815bb9981c395d225e.js:1425:16
    caml_compare_val_tag http://localhost:8080/os27_b6cccceeef0af3815bb9981c395d225e.js:1425
    caml_compare_val http://localhost:8080/os27_b6cccceeef0af3815bb9981c395d225e.js:1448
    caml_equal http://localhost:8080/os27_b6cccceeef0af3815bb9981c395d225e.js:3644
    <anonyme> http://localhost:8080/os27_b6cccceeef0af3815bb9981c395d225e.js:44780
    <anonyme> http://localhost:8080/os27_b6cccceeef0af3815bb9981c395d225e.js:70118

And here is kind of a traceback I can give following given links:

function caml_compare_val_tag(a)
     {if...
     else
            if(a.caml_custom)
             return 1255;

function caml_compare_val(a,b,total)
	 ...
	 var tag_b=caml_compare_val_tag(b);

function caml_equal(x,y){return + (caml_compare_val(x,y,false) == 0)}

caml_equal
     (function(t9,param){return t9.__eliom_appl_process_info}(window,_LN_),
      undefined$0);

(function(){return this}()));

It does not mean anything to me. I remember I encountered such error on a 2.4 ocsigen-start after I added never called code (with a db-request and a functor), but I could not identify accurately the source of the bug. Any idea on a direction I could explore ?

Ok thank you. Indeed it is an incompatibility between you version of js_of_ocaml and eliom.
Just upgrade to the very last versions and it should be ok.

The very last version of Eliom ?
Thank you a lot !

Yes, last versions of everything.
The best way to avoid compatibility problems is to stay up-to-date.
Otherwise some libraries may change and become incompatible.

1 Like

Indeed a simple opam update followed by an opam upgrade made it work perfectly fine.
Thanks again for your help !
Have a very good day

1 Like