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:
- It requires redundant source code synchronization from the local machine to the container.
- 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).
- 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:
- Go to Settings/Preferences | Build, Execution, Deployment | Toolchains.
- Add a new toolchain, select Docker type.
- Create a docker server and select it in the toolchain settings.
- Select one of the available Docker images.
Wait until the toolchain test passes and you are ready to go:
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:
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:
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:
- Setup Docker Desktop with the WSL 2 backend.
- Enable integration with your preferred WSL distribution (in Settings | Resources | WSL Integration), e.g. ubuntu-20.04.
- 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
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:
The full release notes are available here.
Your CLion team
The Drive to Develop