Newer version of gcc for Torizon IDE Extension for better C++ 20 support?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


To address your issue with the C++20 support in the Torizon IDE Extension for Visual Studio Code, here are some steps and considerations:

  1. Current GCC Version: As you mentioned, the current build container uses GCC v12.2.0. While this version does support many C++20 features, it may not fully support all of them, such as std::chrono::time_zone.

  2. Updating GCC Version: You can attempt to update the GCC version in your build container. This involves creating a custom Dockerfile that installs the desired version of GCC. Here’s a basic example of how you might do this:

    FROM torizon/debian-cross-toolchain-arm64:2-bullseye
    
    # Install dependencies
    RUN apt-get update && apt-get install -y \
        build-essential \
        wget \
        && rm -rf /var/lib/apt/lists/*
    
    # Download and install GCC 13.3.1
    RUN wget https://ftp.gnu.org/gnu/gcc/gcc-13.3.1/gcc-13.3.1.tar.gz \
        && tar -xzf gcc-13.3.1.tar.gz \
        && cd gcc-13.3.1 \
        && ./contrib/download_prerequisites \
        && mkdir build && cd build \
        && ../configure --enable-languages=c,c++ --disable-multilib \
        && make -j$(nproc) \
        && make install
    
    # Set the new GCC as the default
    RUN update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/gcc 60 \
        && update-alternatives --install /usr/bin/g++ g++ /usr/local/bin/g++ 60
    

    This Dockerfile starts from a base Torizon image and installs GCC 13.3.1. You can build this Dockerfile and use the resulting image as your build container.

  3. Using the Custom Container in Torizon IDE:

    • In your VS Code project, update the devcontainer.json to use your custom Docker image.
    • Ensure that your project settings in the Torizon IDE extension point to this new container.
  4. Limitations and Future Support: As you noted, full support for C++20 might require GCC 14, which may not yet be available for ARM. Keep an eye on updates from the GCC project and the Torizon team for newer toolchain support.

  5. Alternative Libraries: If updating GCC does not resolve your issue, you might need to look for alternative libraries or workarounds. The date library you mentioned is a good fallback, but compatibility issues might arise with different GCC versions.

  6. Community and Support: Engage with the Toradex community and support channels. Other developers might have faced similar issues and could offer solutions or workarounds.

By following these steps, you should be able to update the GCC version in your build container and potentially resolve the issues with C++20 support. If GCC 14 becomes available, you can follow a similar process to update to that version.

Please, also check if these links can help you solve your problem:

Set up the Torizon IDE Extension Environment | Toradex Developer Center.