CMake WSL unable to find path
已回答
The path below certainly exists. I wonder if the dollar sign is supposed to be escaped. I don't know how to move forward at this point.
/usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" //wsl$/Ubuntu/home/kjeffery/projects/moonray_split/moonray
bash: line 0: cd: //wsl$/Ubuntu/home/kjeffery/projects/moonray_split/moonray/cmake-build-debug: Permission denied
CMake Error: The source directory "//wsl$/Ubuntu/home/kjeffery/projects/moonray_split/moonray" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
[Failed to reload]
请先登录再写评论。
Hello!
Are you trying to build the project in CLion? Or outside CLion?
Hi Anna,
This isn't building at all; this is simply reloading the CMake project.
Could you please provide steps how you created the project? Did you create it in CLion?
Hi Anna,
Our application is built with scons, so it's not a project CMakeLists.txt. It fails through CLion's "New CMake Project from Sources" or by using my custom scripts to create a CMakeLists.txt as I do on Linux. The project is cloned to a WSL directory tree.
I can copy the cmake command and go into my wsl ubuntu shell and run it properly if I change the path to a unix path. It's odd that the cmake command is a unix path, but the build directory is a windows path when CLion tries to execute it.
The responsible developer suggest that you place the project in the C drive and access it, for example, like this /mnt/c/projects/moonray_split/moonray.
Also you can consider generating compile_commands.json for your Scons project and open this Compilation database project in CLion - https://www.jetbrains.com/help/clion/compilation-database.html.
I have the same issue with permission.
From my point of view the problem is that clion calls /usr/bin/cmake with full path to the project, but path is not relative to root of wsl, but is relative to Windows path that includes "\\wsl$\....", but actual WSL distro does not know anything about \\wsl$, it could work only with paths from its root.
I think this problem should not be solved with moving project to drive C, because there several problems:
And nothing helps (set_include_directories, resetting cache, setting of INCLUDE_DIRECTORIES variable).
Yes! Using a Windows drive is completely not an option. Accessing a C drive from inside WSL2 is incredibly and unusable slow for builds. This path issue needs to be fixed in Clion. Is there an issue we can follow?
Pfeuffer what CLion version do you use? Do you get the error when you open the project using the \\wsl$ path?