Are you wsl version 1 or 2? I am having the same problem with wsl 1 as you. I solved this problem by upgrading wsl to wsl 2.
To see whether your Linux distribution is set to WSL 1 or WSL 2, use the command: wsl -l -v.
To change versions, use the command: wsl --set-version <distro name> 2 replacing with the name of the Linux distribution that you want to update. For example, wsl --set-version Ubuntu-20.04 2 will set your Ubuntu 20.04 distribution to use WSL 2.
If an error occurs during the upgrade process, refer to Microsoft's official documentation. Here's the link
Answer from wzhlin on Stack OverflowAre you wsl version 1 or 2? I am having the same problem with wsl 1 as you. I solved this problem by upgrading wsl to wsl 2.
To see whether your Linux distribution is set to WSL 1 or WSL 2, use the command: wsl -l -v.
To change versions, use the command: wsl --set-version <distro name> 2 replacing with the name of the Linux distribution that you want to update. For example, wsl --set-version Ubuntu-20.04 2 will set your Ubuntu 20.04 distribution to use WSL 2.
If an error occurs during the upgrade process, refer to Microsoft's official documentation. Here's the link
The warning message
Cannot insert breakpoint 3.
Cannot access memory at address 0x806be6e
is directly coming from gdb, instead of CLion. Although I consider they could have pointed this out clearly.
While this gdb problem refers to a known and open issue of WSL: [WSL1] Cannot debug anything after upgrading to 22.04
I excerpt the brief description of this problem as follows:
The real reason for this issue is that WSL1 lacks /proc/*/mem files, and old version gdb will fallback to use ptrace when it fails to read /proc//mem. But after Jul 2021, Gdb disables such fallback and always assumes /proc//mem is available, so gdb on Ubuntu 22.04 cannot access memory under WSL1.
A simple solution is:
Just download the GDB 13.2 tarball, build it, and replaced the old gdb in your system.
> ./configure && make && make install
The issue seem to be, that clion can't find the cmake, C compiler, or C++ compiler of the WSL. My guess is that you haven't installed those yet.
You can install gcc with:
sudo apt install build-essential
This article explains how to build cmake:
Go to — https://cmake.org/files/ That shows all the list of the versions of cmake, I use cmake-3.15.0-rc1.tar.gz.
Open your terminal or bash and download it.
wget https://cmake.org/files/v3.15/cmake-3.15.0-rc1.tar.gzAfter downloading, then untar.
tar -xvzf cmake-3.15.0-rc1.tar.gz cd cmake-3.15.0-rc1/ ./bootstrap sudo make sudo make install cd /bin/ sudo cp cmake /usr/bin/Now don’t forget we are currently in cmake-3.15.0-rc1/ just go back by entering
cd ... that takes you up one directory back. Now copy the directory to /usr/bin/sharesudo cp -r cmake-3.15.0-rc1/ /usr/share/cmake-3.15 export CMAKE_ROOT=/usr/share/cmake-3.15
After you have done that, clion should be able to detect everything correctly.
I faced a similar issue today and this is what worked for me:
Upgrade your CLion IDE if possible.
- On my CLion v2019.2.3, the IDE wasn't even able to detect that I had already installed 'wsl2 Ubuntu v22.04'. This was resolved by upgrading to CLion IDE v2023.1.3.
In your 'wsl2 Ubuntu shell terminal', update the package index files on your system.
sudo apt update
Install the 'build-essential' package in your 'wsl2 Ubuntu shell terminal. These will contain the GNU/g++ compiler collection and a couple more libraries and tools needed for compiling a program.
sudo apt install build-essential
Install the 'cmake' package in your 'wsl2 Ubuntu shell terminal.
sudo apt install cmake
Install the 'gdb' debugger for C (and C++) in your 'wsl2 Ubuntu shell terminal.
sudo apt install gdb
Restart your IDE and reconfigure your 'Tool chain' to use WSL. All entries will now be auto-detected.

Videos
The workaround would be to use MinGW. If you download it from the website it should come with cmake, and take care of the errors.
http://mingw.org/
When extract it and go to the installer you should check something like gcc and then from the top left corner something like 'install packages'
Be sure not to accidentally download the source, which I did, which would lead you toward this error: CLion: CMake Errors Source directory does not exist
Edit: So over a year later, I've learned a little more about Cygwin and mingw beyond what the internet says. CLion needs a "Unix-like" environment. If you use CLion on MacOS or a Linux it's already Unix based. Anything that is "POSIX" compliant will work. CygWin is a terminal emulator for windows where Unix commands like mkdir work. MinGW is something similar but not posix. Comes with GCC tho. I'm still a noob.
In the "Use specified" field I put C:\cygwin64\bin\cmake.exe your path may be different. Just ensure you have CMake, Make, gdb and gcc installed already in Cygwin (using the Cygwin setup.exe not via the CMake website) but I believe Clion checks if you have them installed after inputting the path.
