<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Greetings !</p>
    <p>I have a Dockerfile that I use to build projects with build2. Up
      until recently, I've been using ubuntu:22.04 with this Dockerfile.
      Today, I tried to update to 24.04.</p>
    <p>The good thing is that the setup is very easy to reproduce.
      Here's the Dockerfile, up until the point of failure:</p>
    <blockquote>
      <p><span style="font-family:monospace"><span
            style="background-color: rgb(255, 255, 255);">FROM</span><span
            style="background-color: rgb(255, 255, 255);"> ubuntu:22.04
          </span><br>
          <br>
          <span style="background-color: rgb(255, 255, 255);">WORKDIR</span><span
            style="background-color: rgb(255, 255, 255);"> /tmp
          </span><br>
          <span style="background-color: rgb(255, 255, 255);">ENV</span><span
            style="background-color: rgb(255, 255, 255);">
            LD_LIBRARY_PATH /usr/local/lib
          </span><br>
          <span style="background-color: rgb(255, 255, 255);">ENV</span><span
            style="background-color: rgb(255, 255, 255);">
            DEBIAN_FRONTEND </span><span
            style="background-color: rgb(255, 255, 255);">"noninteractive"</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
          <span style="background-color: rgb(255, 255, 255);">ENV</span><span
            style="background-color: rgb(255, 255, 255);"> TZ </span><span
            style="background-color: rgb(255, 255, 255);">"Europe/London"</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
          <br>
          <span style="background-color: rgb(255, 255, 255);">RUN</span><span
            style="background-color: rgb(255, 255, 255);"> apt-get </span><span
            style="background-color: rgb(255, 255, 255);">-y</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">--allow-unauthenticated</span><span
            style="background-color: rgb(255, 255, 255);"> update </span><span
            style="background-color: rgb(255, 255, 255);">&&</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
             apt-get <span
            style="background-color: rgb(255, 255, 255);">-y</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">--allow-unauthenticated</span><span
            style="background-color: rgb(255, 255, 255);"> upgrade </span><span
            style="background-color: rgb(255, 255, 255);">&&</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
             apt-get <span
            style="background-color: rgb(255, 255, 255);">-y</span><span
            style="background-color: rgb(255, 255, 255);"> install curl
          </span><span style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           cmake <span style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           pkg-config <span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           build-essential <span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           libbz2-dev <span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           libssl-dev <span
            style="background-color: rgb(255, 255, 255);">\</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
           git
          <br>
          <br>
          <span style="background-color: rgb(255, 255, 255);">COPY</span><span
            style="background-color: rgb(255, 255, 255);">
            build-build2.sh build-build2.sh<br>
            RUN bash build-build2.sh<br>
          </span></span></p>
    </blockquote>
    <p>
    </p>
    <p>And here's the build-build2.sh script:</p>
    <blockquote>
      <p><span style="font-family:monospace"><span
            style="background-color: rgb(255, 255, 255);">#!/bin/sh -ex</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
          <br>
          <span style="background-color: rgb(255, 255, 255);">export</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
style="font-weight: bold; background-color: rgb(255, 255, 255);">BUILD2_VERSION</span><span
            style="background-color: rgb(255, 255, 255);">=</span><span
            style="background-color: rgb(255, 255, 255);">"</span><span
            style="background-color: rgb(255, 255, 255);">0.16.0</span><span
            style="background-color: rgb(255, 255, 255);">"</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
          <span style="background-color: rgb(255, 255, 255);">export</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
style="font-weight: bold; background-color: rgb(255, 255, 255);">BUILD2_FINGERPRINT</span><span
            style="background-color: rgb(255, 255, 255);">=</span><span
            style="background-color: rgb(255, 255, 255);">"</span><span
            style="background-color: rgb(255, 255, 255);">70:64:FE:E4:E0:F3:60:F1:B4:51:E1:FA:12:5C:E0:B3:DB:DF:96:33:39:B9:2E:E5:C2:68:63:4C:A6:47:39:43</span><span
            style="background-color: rgb(255, 255, 255);">"</span><span
            style="background-color: rgb(255, 255, 255);">
          </span><br>
          <br>
          curl <span style="background-color: rgb(255, 255, 255);">-sSfO</span><span
            style="background-color: rgb(255, 255, 255);">
            <a class="moz-txt-link-freetext" href="https://download.build2.org/">https://download.build2.org/</a></span><span
            style="background-color: rgb(255, 255, 255);">$BUILD2_VERSION</span><span
            style="background-color: rgb(255, 255, 255);">/build2-install-</span><span
            style="background-color: rgb(255, 255, 255);">$BUILD2_VERSION</span><span
            style="background-color: rgb(255, 255, 255);">.sh
          </span><br>
          <span style="background-color: rgb(255, 255, 255);">chmod</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">+x</span><span
            style="background-color: rgb(255, 255, 255);">
            build2-install-</span><span
            style="background-color: rgb(255, 255, 255);">$BUILD2_VERSION</span><span
            style="background-color: rgb(255, 255, 255);">.sh
          </span><br>
          sh build2-install-<span
            style="background-color: rgb(255, 255, 255);">$BUILD2_VERSION</span><span
            style="background-color: rgb(255, 255, 255);">.sh </span><span
            style="background-color: rgb(255, 255, 255);">--yes</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">--trust</span><span
            style="background-color: rgb(255, 255, 255);"> </span><span
            style="background-color: rgb(255, 255, 255);">"</span><span
            style="background-color: rgb(255, 255, 255);">$BUILD2_FINGERPRINT</span><span
            style="background-color: rgb(255, 255, 255);">"</span><br>
        </span></p>
    </blockquote>
    <p>Using these 2 files as they are, you should be able to build a
      functional ubuntu 22.04 with build2 installed.</p>
    <p>However, changing the first line of the Dockerfile to `FROM
      ubuntu:24.04` will cause the build2 install script to fail with
      the following errors:</p>
    <blockquote>
      <p><span style="font-family:monospace"><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/tmp/build2-toolchain-0.16.0/libpkg-config/libpkg-config/bsdstubs.c:29:1:</span><span
            style="color:#000000;background-color:#ffffff;"> </span><span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">error:
          </span><span style="color:#000000;background-color:#ffffff;">static
            declaration of '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">strlcpy</span><span
            style="color:#000000;background-color:#ffffff;">' follows
            non-static declaration
          </span><br>
            29 | <span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">strlcpy</span><span
            style="color:#000000;background-color:#ffffff;"> (char* dst,
            const char* src, size_t siz)
          </span><br>
               | <span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">^~~~~~~</span><span
            style="color:#000000;background-color:#ffffff;">
          </span><br>
          In file included from <span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/tmp/build2-toolchain-0.16.0/libpkg-config/libpkg-config/stdinc.h:35</span><span
            style="color:#000000;background-color:#ffffff;">,
          </span><br>
                          from <span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/tmp/build2-toolchain-0.16.0/libpkg-config/libpkg-config/bsdstubs.c:17</span><span
            style="color:#000000;background-color:#ffffff;">:
          </span><br>
          <span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/usr/include/string.h:506:15:</span><span
            style="color:#000000;background-color:#ffffff;"> </span><span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">note: </span><span
            style="color:#000000;background-color:#ffffff;">previous
            declaration of '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">strlcpy</span><span
            style="color:#000000;background-color:#ffffff;">' with type
            '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">size_t(char
            * restrict,  const char * restrict,  size_t)</span><span
            style="color:#000000;background-color:#ffffff;">' {aka '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">long
            unsigned int(char * restrict,  const char * restrict,  long
            unsigned int)</span><span
            style="color:#000000;background-color:#ffffff;">'}
          </span><br>
           506 | extern size_t <span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">strlcpy</span><span
            style="color:#000000;background-color:#ffffff;"> (char
            *__restrict __dest,
          </span><br>
               |               <span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">^~~~~~~</span><span
            style="color:#000000;background-color:#ffffff;">
          </span><br>
          <span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/tmp/build2-toolchain-0.16.0/libpkg-config/libpkg-config/bsdstubs.c:67:1:</span><span
            style="color:#000000;background-color:#ffffff;"> </span><span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">error:
          </span><span style="color:#000000;background-color:#ffffff;">static
            declaration of '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">strlcat</span><span
            style="color:#000000;background-color:#ffffff;">' follows
            non-static declaration
          </span><br>
            67 | <span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">strlcat</span><span
            style="color:#000000;background-color:#ffffff;"> (char* dst,
            const char* src, size_t siz)
          </span><br>
               | <span
style="font-weight:bold;color:#ff5454;background-color:#ffffff;">^~~~~~~</span><span
            style="color:#000000;background-color:#ffffff;">
          </span><br>
          <span
style="font-weight:bold;color:#000000;background-color:#ffffff;">/usr/include/string.h:512:15:</span><span
            style="color:#000000;background-color:#ffffff;"> </span><span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">note: </span><span
            style="color:#000000;background-color:#ffffff;">previous
            declaration of '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">strlcat</span><span
            style="color:#000000;background-color:#ffffff;">' with type
            '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">size_t(char
            * restrict,  const char * restrict,  size_t)</span><span
            style="color:#000000;background-color:#ffffff;">' {aka '</span><span
style="font-weight:bold;color:#000000;background-color:#ffffff;">long
            unsigned int(char * restrict,  const char * restrict,  long
            unsigned int)</span><span
            style="color:#000000;background-color:#ffffff;">'}
          </span><br>
           512 | extern size_t <span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">strlcat</span><span
            style="color:#000000;background-color:#ffffff;"> (char
            *__restrict __dest,
          </span><br>
               |               <span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">^~~~~~~</span><br>
        </span></p>
    </blockquote>
    <p>I have no clear idea what's going on. Ubuntu 24.04 ships g++13,
      which I have already used countless times on Fedora to build
      build2 using the same script.<br>
    </p>
    <p>I'm guessing <span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">HAVE_STRLCPY</span>
      </span>and <span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">HAVE_STRLCAT</span>
      </span>should've been defined, and weren't. Seems like the
      documentation for libbuild2-autoconf may contain the relevant
      information to fix the issue... I might look into it again at a
      later time, but for now I'm hoping this message will be helpful !</p>
    <p>Bye !<br>
    </p>
  </body>
</html>