CLion-WSL Path Configuration
Answered
Hi All, I'm trying to get CLion running for the first time. I'm on a Windows machine but do all my building in WSL for an STM32 embedded target using arm-none-eabi-gcc compiler.
I have a CMake project that I can build successfully from terminal using WSL, but when I try to import the project into CLion and run the same CMake command it can't find the compiler on my path. Some of these tools I add to my path in my .bashrc file, and I guess CLion invokes WSL in such a way that it doesn't source that.
What's the recommended way to set a "profile" for CLion-WSL or otherwise add some paths to the WSL path?
Please sign in to leave a comment.
I have a similar problem. It seems that CLion invokes the build using /bin/sh by default (C:\WINDOWS\system32\wsl.exe --distribution MyDist --exec /bin/sh -c ..."). I would like to change that to use bash instead and start it in interactive mode, thus sourcing my .bashrc. Or something similar, but I cannot find a way to do that. Does anyone know if it is possible to change this?
There seems to be an issue reported about this: https://youtrack.jetbrains.com/issue/CPP-26615
Hello,
here's related issue CPP-27045
Please download latest CLion 2021.3 and enable option in Execute commands in login (-l) shell in Settings | Advanced Settings.
In this case env vars defined in .profile has to be available.
Thanks! That seems to work.
It doesn't work in CLion 2022.2.4
Rakjak2 please provide more details:
What exactly doesn't work? What issue do you face? What have you tried?
I was trying to set path to cmake in PATH variable in .profile file. At the end it turned out that applying the file wasn't a problem at all, it was just CLion which uses hardcoded /usr/bin/cmake. The same applies to gdb path.
Rakjak2 you can specify the paths to CMake and GDB in `File | Settings | Build, Execution, Deployment | Toolchains`.
Yes, with specifying the paths manually it works, I thought that it will find it in the PATH variable when I choose "WSL CMake", but apparently CLion doesn't run detection command with -l option to load .profile file in this case.