Early Access Program News

CLion 2021.3 EAP: New Docker Toolchain

The CLion 2021.3 Early Access Preview program is now running and has already brought several useful improvements to the users:

  • New type hints in the editor
  • Parallel Stacks view in the debugger and new views for multi-threaded FreeRTOS debugging
  • Ninja as the default generator in CMake
  • Bundled MinGW and System Toolchain on Windows

The new EAP build, 213.4631.3, is now available from our website via the Toolbox App, or as a snap package (if you are using Ubuntu). If you are on macOS, there is a separate build for Apple silicon (M1 chip). A patch update will also be available shortly.


Here are the main highlights:

New Docker toolchain

Currently, many of us are developing in Docker containers, which is generally the easiest way to set up the environment and start working with it. Previously, the recommended way to work with Docker in CLion was to use the Remote toolchain, but there are obvious issues with such an approach:

  1. It requires redundant source code synchronization from the local machine to the container.
  2. Two copies of the source code are stored and some synchronization issues may occur (for example, when disabling and then enabling back the corresponding CMake profile using the remote toolchain).
  3. The build artefacts are stored remotely in the container and not synchronized back to the local machine.

All these issues actually come from the fact that there is no need to treat the docker container as a fully remote machine. Instead, we can mount the project folder to it to resolve all of the above issues.

Starting with this EAP, CLion can work with Docker via the Docker Toolchain:

  1. Go to Settings/Preferences | Build, Execution, Deployment | Toolchains.
  2. Add a new toolchain, select Docker type.
  3. Create a docker server and select it in the toolchain settings.
  4. Select one of the available Docker images.

Wait until the toolchain test passes and you are ready to go:
Create Docker toolchain
You might need to configure additional file sharing in Docker for CLion directories on macOS, which we plan to address later (CPP-26848).

Now you can create CMake profiles using this Docker toolchain:
CMake Profile with Docker toolchain

You can also select it in the Makefile settings for Make-based projects.

Your project will now be built, run, and debugged in the corresponding Docker container. CLion will start it and shut it down after the command is executed. The project folder is mounted into the /tmp/<ProjectFolder> directory in the container.

Docker server settings are available in Settings/Preferences | Build, Execution, Deployment | Docker. CLion also bundles the Docker plugin, which brings the Services tool window and many docker-specific actions to the IDE:
Docker services

Tips: better performance with Docker Toolchain on Windows

To get better performance when working with the Docker toolchain on Windows, we highly recommend using Docker with the WSL 2 backend:

  1. Setup Docker Desktop with the WSL 2 backend.
  2. Enable integration with your preferred WSL distribution (in Settings | Resources | WSL Integration), e.g. ubuntu-20.04.
  3. Put the sources of the project into the WSL filesystem (e.g. \\wsl$\ubuntu-20.04\tmp\llvm) and then open it in CLion with the Docker toolchain.

Code completion fixes

Several issues in code completion were addressed, and it now works inside Google Test macros and the assert macro:
Completion in Google Tests

Improvements in Structure View

You can examine the structure of the file currently open in the editor using the Structure tool window (Alt+7 on Windows/Linux, ⌘7 on macOS) or the Structure pop-up (Ctrl+F12 on Windows/Linux, ⌘F12 on macOS). It is now easier to read, with qualified names for the member functions shown there:
Structure View

The full release notes are available here.


Your CLion team
The Drive to Develop

image description