Ubuntu WSL is listed in Clion toolchains but says "not found"
Asked Answered
B

3

7

Unlike this question or this one, CLion seems to detect the WSL correctly:

WSL Detected

You can see that Ubuntu-20.04 is listed but still not found :

Not found

Versions :

  • Windows 10 : 1803
  • WSL : 1 (since windows 1803 does not support WSL 2)
  • WSL Distrib : Ubuntu 20.04 from Windows store
  • CLion : 2021.2.3

Has anyone ever faced this issue?

Bingaman answered 19/10, 2021 at 12:31 Comment(0)
B
1

I asked the CLion support and this if the answer (which fixed my problem)

Actually, the best way to solve this is to update Windows. If it's not possible, then in CLion go to Help | Find Action, type "Registry...", select it and in the opened list find and and disable the wsl.execute.with.wsl.exe option. It should help.

Bingaman answered 14/11, 2021 at 1:28 Comment(0)
L
4

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.gz

After 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/share

sudo 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.

Lemmie answered 10/11, 2021 at 16:39 Comment(2)
Hi, thank you for your reply. Actually, I already did what you proposed. It could work with a recent version of Windows. My problem is that my Windows verion is managed by my company so I can't control it. I asked to CLion support and I posted the solution as an answerBingaman
It works for me, but for CLion 2022.2 you need a more recent version of CMake (as you've said, go to https://cmake.org/files/, and then check the latest version)Zirkle
S
2

I faced a similar issue today and this is what worked for me:

  1. 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.
  2. In your 'wsl2 Ubuntu shell terminal', update the package index files on your system.

    • sudo apt update
  3. 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
  4. Install the 'cmake' package in your 'wsl2 Ubuntu shell terminal.

    • sudo apt install cmake
  5. Install the 'gdb' debugger for C (and C++) in your 'wsl2 Ubuntu shell terminal.

    • sudo apt install gdb
  6. Restart your IDE and reconfigure your 'Tool chain' to use WSL. All entries will now be auto-detected.

enter image description here

Spousal answered 17/6, 2023 at 8:20 Comment(0)
B
1

I asked the CLion support and this if the answer (which fixed my problem)

Actually, the best way to solve this is to update Windows. If it's not possible, then in CLion go to Help | Find Action, type "Registry...", select it and in the opened list find and and disable the wsl.execute.with.wsl.exe option. It should help.

Bingaman answered 14/11, 2021 at 1:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.