Thicket data repository for the EEG
at main 6.0 kB view raw
1{ 2 "id": "https://www.tunbury.org/2025/04/22/ocaml-fedora-gcc", 3 "title": "OCaml &lt; 4.14, Fedora 42 and GCC 15", 4 "link": "https://www.tunbury.org/2025/04/22/ocaml-fedora-gcc/", 5 "updated": "2025-04-22T00:00:00", 6 "published": "2025-04-22T00:00:00", 7 "summary": "Late last week, @MisterDA added Fedora 42 support to the Docker base image builder. The new base images attempted to build over the weekend, but there have been a few issues!", 8 "content": "<p>Late last week, @MisterDA added Fedora 42 support to the <a href=\"https://images.ci.ocaml.org\">Docker base image builder</a>. The new base images attempted to build over the weekend, but there have been a few issues!</p>\n\n<p>The code I had previously added to force Fedora 41 to use the DNF version 5 syntax was specifically for version 41. For reference, the old syntax was <code>yum groupinstall -y 'C Development Tools and Libraries’</code>, and the new syntax is <code>yum group install -y 'c-development'</code>. Note the extra space.</p>\n\n<div><div><pre><code><span>let</span> <span>c_devtools_libs</span> <span>:</span> <span>(</span><span>t</span><span>,</span> <span>unit</span><span>,</span> <span>string</span><span>,</span> <span>t</span><span>)</span> <span>format4</span> <span>=</span>\n <span>match</span> <span>d</span> <span>with</span>\n <span>|</span> <span>`Fedora</span> <span>`V41</span> <span>-&gt;</span> <span>{</span><span>|</span><span>\"c-development\"</span><span>|</span><span>}</span>\n <span>|</span> <span>`Fedora</span> <span>_</span> <span>-&gt;</span> <span>{</span><span>|</span><span>\"C Development Tools and Libraries\"</span><span>|</span><span>}</span>\n <span>|</span> <span>_</span> <span>-&gt;</span> <span>{</span><span>|</span><span>\"Development Tools”|}\n...\nlet dnf_version = match d with `Fedora `V41 -&gt; 5 | _ -&gt; 3\n</span></code></pre></div></div>\n\n<p>To unburden ourselves of this maintenance in future releases, I have inverted the logic so unmatched versions will use the new syntax.</p>\n\n<div><div><pre><code><span>let</span> <span>(</span><span>dnf_version</span><span>,</span> <span>c_devtools_libs</span><span>)</span> <span>:</span> <span>int</span> <span>*</span> <span>(</span><span>t</span><span>,</span> <span>unit</span><span>,</span> <span>string</span><span>,</span> <span>t</span><span>)</span> <span>format4</span> <span>=</span>\n <span>match</span> <span>d</span> <span>with</span>\n <span>|</span> <span>`Fedora</span>\n <span>(</span> <span>`V21</span> <span>|</span> <span>`V22</span> <span>|</span> <span>`V23</span> <span>|</span> <span>`V24</span> <span>|</span> <span>`V25</span> <span>|</span> <span>`V26</span> <span>|</span> <span>`V27</span> <span>|</span> <span>`V28</span> <span>|</span> <span>`V29</span>\n <span>|</span> <span>`V30</span> <span>|</span> <span>`V31</span> <span>|</span> <span>`V32</span> <span>|</span> <span>`V33</span> <span>|</span> <span>`V34</span> <span>|</span> <span>`V35</span> <span>|</span> <span>`V36</span> <span>|</span> <span>`V37</span> <span>|</span> <span>`V38</span>\n <span>|</span> <span>`V39</span> <span>|</span> <span>`V40</span> <span>)</span> <span>-&gt;</span>\n <span>(</span><span>3</span><span>,</span> <span>{</span><span>|</span><span>\"C Development Tools and Libraries\"</span><span>|</span><span>})</span>\n <span>|</span> <span>`Fedora</span> <span>_</span> <span>-&gt;</span> <span>(</span><span>5</span><span>,</span> <span>{</span><span>|</span><span>\"c-development\"</span><span>|</span><span>})</span>\n <span>|</span> <span>_</span> <span>-&gt;</span> <span>(</span><span>3</span><span>,</span> <span>{</span><span>|</span><span>\"Development Tools\"</span><span>|</span><span>})</span>\n</code></pre></div></div>\n\n<p>Fedora 42 also removed <code>awk</code>, so it now needs to be specifically included as a dependency. However, this code is shared with Oracle Linux, which does not have a package called <code>awk</code>. Fortunately, both have a package called <code>gawk</code>!</p>\n\n<p>The next issue is that Fedora 42 is the first of the distributions we build base images for that has moved to GCC 15, specifically GCC 15.0.1. This breaks all versions of OCaml &lt; 4.14.</p>\n\n<p>The change is that the code below, which previously gave no information about the number or type of parameters. (see <code>runtime/caml/prims.h</code>)</p>\n\n<div><div><pre><code><span>typedef</span> <span>value</span> <span>(</span><span>*</span><span>c_primitive</span><span>)();</span>\n</code></pre></div></div>\n\n<p>Now means that there are no parameters, aka:</p>\n\n<div><div><pre><code><span>typedef</span> <span>value</span> <span>(</span><span>*</span><span>c_primitive</span><span>)(</span><span>void</span><span>);</span>\n</code></pre></div></div>\n\n<p>This is caused by a change of the default compilter language version. See <a href=\"https://gcc.gnu.org/gcc-15/changes.html\">GCC change log</a></p>\n\n<blockquote>\n <p>C23 by default: GCC 15 changes the default language version for C compilation from <code>-std=gnu17</code> to <code>-std=gnu23</code>. If your code relies on older versions of the C standard, you will need to either add <code>-std=</code> to your build flags, or port your code; see the porting notes.</p>\n</blockquote>\n\n<p>Also see the <a href=\"https://gcc.gnu.org/gcc-15/porting_to.html#c23\">porting notes</a>, and <a href=\"https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118112\">this bug report</a>.</p>\n\n<p>This is <em>not</em> an immediate problem as OCaml-CI and opam-repo-ci only test against OCaml 4.14.2 and 5.3.0 on Fedora. I have opened <a href=\"https://github.com/ocurrent/docker-base-images/issues/320\">issue#320</a> to track this problem.</p>", 9 "content_type": "html", 10 "author": { 11 "name": "Mark Elvers", 12 "email": "mark.elvers@tunbury.org", 13 "uri": null 14 }, 15 "categories": [ 16 "OCaml,Fedora,GCC", 17 "tunbury.org" 18 ], 19 "source": "https://www.tunbury.org/atom.xml" 20}