#1111165 ben: Building template fails: Error: Unbound module "Ben_frontends"

Package:
src:ben
Source:
src:ben
Submitter:
Bas Couwenberg
Date:
2025-08-21 06:21:02 UTC
Severity:
normal
Tags:
#1111165#5
Date:
2025-08-15 08:36:22 UTC
From:
To:
Dear Maintainer,

Building a custom template fails:

 $ bash -x debian/build-template.sh
 + '[' -z '' ']'
 + TEMPLATE=debiangis
 ++ dirname debian/build-template.sh
 + DEBIANDIR=debian
 ++ dirname debian
 + PACKAGEDIR=.
 + TEMPLATEDIR=./templates
 + cd ./templates
 + ocamlbuild -pkg ben debiangis.cmx
 + /usr/bin/ocamlc.opt -c -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/ben -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/bigarray -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/dynlink -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/extlib -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/fileutils -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/ocamlgraph -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/parmap -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/postgresql -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/re -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/seq -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/stdlib-shims -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/threads -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/tyxml -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/tyxml/functor -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/unix -I /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/uutf -o debiangis.cmo debiangis.ml
 File "debiangis.ml", line 30, characters 2-43:
 30 |   Ben_frontends.Templates.register_template
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 Error: Unbound module "Ben_frontends"
 Command exited with code 2.
 Hint: Recursive traversal of subdirectories was not enabled for this build,
   as the working directory does not look like an ocamlbuild project (no
   '_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
   you should add the option "-r" or create an empty '_tags' file.

   To enable recursive traversal for some subdirectories only, you can use the
   following '_tags' file:

       true: -traverse
       <dir1> or <dir2>: traverse

 Compilation unsuccessful after building 3 targets (0 cached) in 00:00:00.

#1111165#10
Date:
2025-08-15 10:15:56 UTC
From:
To:
Using dune seems to work after adding the new template to templates/dune:

  dune build templates/debiangis.cmxs

This does require installing libppx-yojson-conv-ocaml-dev which was not pulled in via the libben-ocaml-dev dependencies.

Copying the .cmxs file to /usr/lib/ben/templates no longer works.

This did work:

  su -c "mkdir /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/ben/templates/debiangis"
  su -c "cp -v _build/default/templates/debiangis.* /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/ben/templates/debiangis/"

What is the recommended way to build & install a custom template?

Kind Regards,

Bas

#1111165#15
Date:
2025-08-20 10:18:03 UTC
From:
To:
Hello,

Le 15/08/2025 à 12:15, Sebastiaan Couwenberg a écrit :

Good idea.

This way, you might rebuild the whole ben, hence you may need all its
build-dependencies including this one.

Even after setting BEN_TEMPLATES_DIR? Its default value is $(ocamlc
-where)/ben/templates, as you've figured out.

There is no "recommended" way, the way you did seems fine.

If you do not want to fiddle with ben sources:

https://salsa.debian.org/debian/ben/-/tree/master/examples/custom-template


Cheers,

#1111165#20
Date:
2025-08-20 10:49:00 UTC
From:
To:
Setting BEN_TEMPLATES_DIR didn't work, possibly because a subdirectory with the template name was not used.

Should this replace the "HTML Templates" section in the reference manual?

https://debian.pages.debian.net/ben/#_html_templates

Those instructions no longer work, but I'm not sure what to replace it with.

Kind Regards,

Bas

#1111165#25
Date:
2025-08-20 11:31:26 UTC
From:
To:
Le 20/08/2025 à 12:49, Sebastiaan Couwenberg a écrit :

I completely forgot about these instructions... I've updated them.


Cheers,

#1111165#30
Date:
2025-08-20 11:43:18 UTC
From:
To:
Thanks. With that we can consider this issue fixed.

Kind Regards,

Bas

#1111165#35
Date:
2025-08-21 06:18:53 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
ben, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1111165@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stéphane Glondu <glondu@debian.org> (supplier of updated ben package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 21 Aug 2025 08:00:31 +0200
Source: ben
Architecture: source
Version: 1.10
Distribution: unstable
Urgency: medium
Maintainer: Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org>
Changed-By: Stéphane Glondu <glondu@debian.org>
Closes: 1111165
Changes:
 ben (1.10) unstable; urgency=medium
 .
   * Add a custom template example (Closes: #1111165)
   * Remove mips64el from defaults and examples
Checksums-Sha1:
 486de9f1b41db1da5eca113c02554871b40c1dc2 1898 ben_1.10.dsc
 e464f9f20f18f2df0c1b3805dc9e5886ef26c7d3 75376 ben_1.10.tar.xz
Checksums-Sha256:
 98539346c5380b757d9922f18af7c1bbcc2d69588e66407c0add2a6e43afea2d 1898 ben_1.10.dsc
 9bf9eb27343cd2886ff3e948bb218014a05e35d4c031eb40bdbf56cd66dbc476 75376 ben_1.10.tar.xz
Files:
 5877cd61777152d1c8ed3ab0418897cd 1898 devel optional ben_1.10.dsc
 03cba45e3bbf0ea2c12974958ac7b340 75376 devel optional ben_1.10.tar.xz
-----BEGIN PGP SIGNATURE-----

iQFGBAEBCgAwFiEEbeJOl+yohsxW5iUOIbju8bGJMIEFAmimtvcSHGdsb25kdUBk
ZWJpYW4ub3JnAAoJECG47vGxiTCBCnYIALDav+5g6aZ+2v+vPH8XvfSebDjhzEKo
o0QTJNb1+ClDmChb553bYBx0QpxY1a17cPU5S/i7nX7/q3qFh+NggqFkdva9aTiK
Iyz0ElwT9qRcuHip/TqwKs56asclxgSUbxXpshGbqRYex+IwXiZk5Fgw5OsEleEe
SgZ04o7qrgjTyBLrrYV27CCDgUDrfOr3mTpHGpyLwAedtaDudk5x2Yx/jgqhoGNw
FKN0b7Mt3Wu3bNHHqUrlE2fzuYAITu1hI3vUBR989mE5nIDh2TxtcC8/BRgQfMuY
ZA4VKgdoLHbraNMfMn9O5zNNY0AtubacYkNvhGCWFDGfQrEsqcWznPA=
=j6KP
-----END PGP SIGNATURE-----