C++20 in the build environment

Hello, I am packaging an app that has a prebuild step requiring the compilation of tools implemented in C++ 20. These tools fail to compile in the default build environment because G++ 12, available in Bookworm’s repositories, does not support <format>.

I’ve tried to switch to Clang but the compilation fails with the same error. Clang uses the standard library provided by GCC (libstdc++) and since the latter does not provide <format> this cannot pass.

I’ve tried to switch to Clang + libc++ but it produces its own batch of errors. Most probably I don’t pass the correct flags around.

All of this is quite complex to handle. Which alternatives do you suggest? Is there a way to have something more recent than Bookworm for the build environment?

1 Like

what about GCC 14.2 from Trixie? Debian -- Details of package gcc in trixie

This would be great but I see no way to switch for Trixie in the manifest reference. Maybe I can use the sudo step to change the repositories and update the image?

Please do not update the image :slight_smile:

Pulling from unstable releases is tricky, we hope you don’t update the whole system and break something else :slight_smile:

Here’s how we pull a newer Java:

    sudo:
      - echo "deb https://deb.debian.org/debian trixie main" > /etc/apt/sources.list.d/trixie.list
      - apt-get update
      - apt-get install -y -t trixie openjdk-21-jdk-headless
      - update-alternatives --auto java

maybe adapt this?

It seems to work. Thanks :slight_smile: