Thicket data repository for the EEG
1{
2 "id": "https://www.tunbury.org/2025/07/24/tarides-website",
3 "title": "Tarides Website",
4 "link": "https://www.tunbury.org/2025/07/24/tarides-website/",
5 "updated": "2025-07-24T00:00:00",
6 "published": "2025-07-24T00:00:00",
7 "summary": "Bella was in touch as the tarides.com website is no longer building. The initial error is that cmarkit was missing, which I assumed was due to an outdated PR which needed to be rebased.",
8 "content": "<p>Bella was in touch as the tarides.com website is no longer building. The initial error is that <code>cmarkit</code> was missing, which I assumed was due to an outdated PR which needed to be rebased.</p>\n\n<div><div><pre><code><span>#20 [build 13/15] RUN ./generate-images.sh</span>\n<span>#20 0.259 + dune exec -- src/gen/main.exe file.dune</span>\n<span>#20 2.399 Building ocaml-config.3</span>\n<span>#20 9.486 File \"src/gen/dune\", line 7, characters 2-9:</span>\n<span>#20 9.486 7 | cmarkit</span>\n<span>#20 9.486 ^^^^^^^</span>\n<span>#20 9.486 Error: Library \"cmarkit\" not found.</span>\n<span>#20 9.486 -> required by _build/default/src/gen/main.exe</span>\n<span>#20 10.92 + dune build @convert</span>\n<span>#20 18.23 Error: Alias \"convert\" specified on the command line is empty.</span>\n<span>#20 18.23 It is not defined in . or any of its descendants.</span>\n<span>#20 ERROR: process \"/bin/sh -c ./generate-images.sh\" did not complete successfully: exit code: 1</span>\n</code></pre></div></div>\n\n<p>The site recently moved to Dune Package Management, so this was my first opportunity to dig into how that works. Comparing the current build to the last successful build, I can see that <code>cmarkit</code> was installed previously but isn’t now.</p>\n\n<div><div><pre><code>#19 [build 12/15] RUN dune pkg lock && dune build @pkg-install\n#19 25.39 Solution for dune.lock:\n...\n#19 25.39 - cmarkit.dev\n...\n</code></pre></div></div>\n\n<p>Easy fix, I added <code>cmarkit</code> to the <code>.opam</code> file. Oddly, it’s in the <code>.opam</code> file as a pinned depend. However, the build now fails with a new message:</p>\n\n<div><div><pre><code><span>#21 [build 13/15] RUN ./generate-images.sh</span>\n<span>#21 0.173 + dune exec -- src/gen/main.exe file.dune</span>\n<span>#21 2.582 Building ocaml-config.3</span>\n<span>#21 10.78 File \"src/gen/grant.ml\", line 15, characters 5-24:</span>\n<span>#21 10.78 15 | |> Hilite.Md.transform</span>\n<span>#21 10.78 ^^^^^^^^^^^^^^^^^^^</span>\n<span>#21 10.78 Error: Unbound module \"Hilite.Md\"</span>\n<span>#21 10.81 File \"src/gen/blog.ml\", line 142, characters 5-24:</span>\n<span>#21 10.81 142 | |> Hilite.Md.transform</span>\n<span>#21 10.81 ^^^^^^^^^^^^^^^^^^^</span>\n<span>#21 10.81 Error: Unbound module \"Hilite.Md\"</span>\n<span>#21 10.82 File \"src/gen/page.ml\", line 52, characters 5-24:</span>\n<span>#21 10.82 52 | |> Hilite.Md.transform</span>\n<span>#21 10.82 ^^^^^^^^^^^^^^^^^^^</span>\n<span>#21 10.82 Error: Unbound module \"Hilite.Md\"</span>\n<span>#21 10.94 + dune build @convert</span>\n<span>#21 19.46 Error: Alias \"convert\" specified on the command line is empty.</span>\n<span>#21 19.46 It is not defined in . or any of its descendants.</span>\n<span>#21 ERROR: process \"/bin/sh -c ./generate-images.sh\" did not complete successfully: exit code: 1</span>\n</code></pre></div></div>\n\n<p>Checking the <a href=\"https://opam.ocaml.org/packages/hilite/hilite.0.5.0/\">hilite</a> package, I saw that there had been a new release last week. The change log lists:</p>\n\n<ul>\n <li>Separate markdown package into an optional hilite.markdown package</li>\n</ul>\n\n<p>Ah, commit <a href=\"https://github.com/patricoferris/hilite/commit/529cb756b05dd15793c181304f438ba1aa48f12a\">aaf60f7</a> removed the dependency on <code>cmarkit</code> by including the function <code>buffer_add_html_escaped_string</code> in the <code>hilite</code> source.</p>\n\n<p>Pausing for a moment, if I constrain <code>hilite</code> to 0.4.0, does the site build? Yes. Ok, so that’s a valid solution. How hard would it be to switch to 0.5.0?</p>\n\n<p>I hit a weird corner case as I was unable to link against <code>hilite.markdown</code>. I chatted with Patrick, and I recreated my switch, and everything worked.</p>\n\n<div><div><pre><code>File \"x/dune\", line 3, characters 20-35:\n3 | (libraries cmarkit hilite.markdown))\n ^^^^^^^^^^^^^^^\nError: Library \"hilite.markdown\" not found.\n-> required by library \"help\" in _build/default/x\n-> required by _build/default/x/.help.objs/native/help__X.cmx\n-> required by _build/default/x/help.a\n-> required by alias x/all\n-> required by alias default\n</code></pre></div></div>\n\n<p>Talking with Jon later about a tangential issue of docs for optional submodules gave me a sudden insight into the corner I’d found myself in. The code base depends on <code>hilite</code>, so after running <code>opam update</code> (to ensure I would get version 0.5.0), I created a new switch <code>opam switch create . --deps-only</code>, and opam installed 0.5.0. When I ran <code>dune build</code>, it reported a missing dependency on <code>cmarkit</code>, so I dutifully added it as a dependency and ran <code>opam install cmarkit</code>. Do you see the problem? <code>hilite</code> only builds the markdown module when <code>cmarkit</code> is installed. If both packages are listed in the opam file when the switch is created, everything works as expected.</p>\n\n<p>The diff turned out to be pretty straightforward.</p>\n\n<div><div><pre><code> <span>let</span> <span>html_of_md</span> <span>~</span><span>slug</span> <span>body</span> <span>=</span>\n <span>String</span><span>.</span><span>trim</span> <span>body</span>\n <span>|></span> <span>Cmarkit</span><span>.</span><span>Doc</span><span>.</span><span>of_string</span> <span>~</span><span>strict</span><span>:</span><span>false</span>\n<span>-</span> <span>|></span> <span>Hilite</span><span>.</span><span>Md</span><span>.</span><span>transform</span>\n<span>+</span> <span>|></span> <span>Hilite_markdown</span><span>.</span><span>transform</span>\n <span>|></span> <span>Cmarkit_html</span><span>.</span><span>of_doc</span> <span>~</span><span>safe</span><span>:</span><span>false</span>\n <span>|></span> <span>Soup</span><span>.</span><span>parse</span>\n <span>|></span> <span>rewrite_links</span> <span>~</span><span>slug</span>\n</code></pre></div></div>\n\n<p>Unfortunately, the build still does not complete successfully. When Dune Package Management builds <code>hilite</code>, it does not build the markdown module even though <code>cmarkit</code> is installed. I wish there was a <code>dune pkg install</code> command!</p>\n\n<p>I tried to split the build by creating a .opam file which contained just <code>ocaml</code> and <code>cmarkit</code>, but this meant running <code>dune pkg lock</code> a second time, and that caused me to run straight into <a href=\"https://github.com/ocaml/dune/issues/11644\">issue #11644</a>.</p>\n\n<p>Perhaps I can patch <code>hilite</code> to make Dune Package Management deal with it as opam does? Jon commented earlier that <code>cmarkit</code> is listed as a <code>with-test</code> dependency. opam would use it if it were present, but perhaps Dune Package Management needs to be explicitly told that it can? I will add <code>cmarkit</code> as an optional dependency.</p>\n\n<div><div><pre><code>depends: [\n \"dune\" {>= \"3.8\"}\n \"mdx\" {>= \"2.4.1\" & with-test}\n \"cmarkit\" {>= \"0.3.0\" & with-test}\n \"textmate-language\" {>= \"0.3.3\"}\n \"odoc\" {with-doc}\n]\ndepopts: [\n \"cmarkit\" {>= \"0.3.0\"}\n]\n</code></pre></div></div>\n\n<p>With my <a href=\"https://github.com/mtelvers/hilite/tree/depopts\">branch</a> of <code>hilite</code>, the website builds again with Dune Package Management.</p>\n\n<p>I have created a <a href=\"https://github.com/patricoferris/hilite/pull/27\">PR#27</a> to see if Patrick would be happy to update the package.</p>\n\n<p>Feature request for Dune Package Management would be the equivalent of <code>opam option --global archive-mirrors=\"https://opam.ocaml.org/cache\"</code> as a lengthy <code>dune pkg lock</code> may fail due to a single <code>curl</code> failure and need to be restarted from scratch.</p>",
9 "content_type": "html",
10 "author": {
11 "name": "Mark Elvers",
12 "email": "mark.elvers@tunbury.org",
13 "uri": null
14 },
15 "categories": [
16 "tarides"
17 ],
18 "source": "https://www.tunbury.org/atom.xml"
19}