Running Cmake via WSL Remote - cmake

I am using cmake, mostly on windows.
I wanted to test compiling on linux and for that I wanted to use WSL.
I correctly (i think) setup the CMake Tools extension for Remote: WSL, cmake is installed on wsl, too.
The settings.json of the cmake extension for WSL (Remote: WSL) looks like this:
"cmake.configureArgs": [
"-DVCPKG_TARGET_TRIPLET=x64-linux",
"-DCMAKE_TOOLCHAIN_FILE=/home/raildex/downloads/vcpkg/scripts/buildsystems/vcpkg.cmake"
],
"cmake.cmakePath": "/home/raildex/downloads/cmake/bin/cmake"
The settings.json of the cmake extension for Windows (Workspace) looks like this:
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=D:\\Dokumente\\Repositories\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"-DVCPKG_TARGET_TRIPLET=x86-windows"
]
When I use the command CMake: Configure within a WSL remote connection, it looks for the toolchain file on my Windows directory:
[proc] Executing command: /home/raildex/downloads/cmake/bin/cmake
--no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=D:\Dokumente\Repositories\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/mnt/d/Dokumente/Repositories/Project -B/mnt/d/Dokumente/Repositories/Project/build -G Ninja
It runs cmake from WSL, but the configuration is for Windows?
What am I missing?

The issue was that the settings of the workspace override the settings of the remote connection.
The order of overriding is User < Remote < Workspace
My (temporary) solution is to set the cmake options for Windows in the User Settings and keep the Workspace Settings empty.

Related

Flatpak Intellij Idea - problem with subversion executable

After installing Intellij Idea using flatpak on Clear Linux I'm not able to make it run svn executable.
I added ---filesystem=host to flatpak permissions and tried to set executable path to /run/host/usr/bin/svn but with no luck (path is available/exists, though Intellij keeps complain)
svn command is normally available from system terminal.
When I try to run /run/host/usr/bin/svn command via Intellij Idea built-in terminal, I've got error that library is not available:
sh-5.0$ /run/host/usr/bin/svn
/run/host/usr/bin/svn: error while loading shared libraries: libsvn_client-1.so.0: cannot open shared object file: No such file or directory
I also tried set flatpak-spawn. Following command works perfectly fine in Intellij Idea built-in terminal:
/usr/bin/flatpak-spawn --host /usr/bin/svn, though when set as path to svn executable still gives me Intellij Idea error:
"The path to Subversion executable is probably wrong"
Could anybody please help with making it work?
TLDR: You probably need to add the path to svn into your IntelliJ terminal Path.
Details:
It looks like you are having a path issue. I had a similar problem running kubectl running PyCharm installed from a flatpak on Pop_Os.
If I try to run kubectl I see the following:
I have kubectl installed in /usr/local/bin. This is a screenshot from my 'normal' terminal.
In the PyCharm terminal this location is mounting under /run/host/usr/local/bin/.
If I look at my path in the PyCharm terminal, it is not there.
So I'll add the /run/host/usr/local/bin/ to my path and I can then run kubectl:
To make sure this comes up all the time, I need to add the PATH to the Terminal settings:
I can now execute any of the commands in my /usr/local/bin dir.
I found a really ugly solution for dealing with SVN with the JetBrains family, which does actually answer the question. But in a very roundabout way. Unfortunately Alex Nelson's solution didn't work for me.
You would think the Flatpak would come with a valid SVN, since it's actually part of the expected requirements for the program...
When in the terminal, you can run
cd ..
/usr/bin/flatpak-spawn --host vim ./svn
Then press i to go into input mode, then paste the following in the opened text file (Basically what it does is create an executable which passes it to the flatpak-spawn invocation):
#!/bin/bash
/usr/bin/flatpak-spawn --host /usr/bin/svn $#
Save and quit from vim (ESC, then :wq!). Make it executable:
chmod +x svn
Then in IntelliJ's menu, set the "path to svn" to
/home/<yourusername>/IdeaProjects/svn
It's worked for everything I've tried... Hope this helps out anyone else who was struggling with this.
I am using a similar solution to caluga.
#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host /usr/bin/env -- svn "$#"
exec makes it replace the wrapper script process so the wrapper script process can end.
I'm using /bin/sh instead of /bin/bash as bash features are not needed.
using /usr/bin/env, but maybe not necessary if PATH is set up right.
remember to quote "$#" in case there are spaces in arguments.
I am putting it in ~/.local/bin and referencing it with its absolute path in the IntelliJ settings (Settings -> Version Control -> Subversion -> Path to Subversion executable).
I also was running into problems with IntelliJ saying that /app/idea-IC path does not exist. Figured that something outside the flatpak (i.e. svn or env) was trying to change directory to the working directory from where the wrapper script was invoked (inside the flatpak). Using cd allows the wrapper script to change to a directory that exists both inside the flatpak and on the host.
Fedora Silverblue or toolbox users might want to use dev tools inside their toolbox, in which case you can do:
#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host toolbox run svn "$#"

When using WSL as toolchain for CLion, Cmake uses wrong path

I have WSL which is configured to mount partitions at the root of the filesystem.
$cat /etc/wsl.conf
[automount]
root = /
options = "metadata"
That means my drives are accessed using paths which start from root e. g. /c /d etc...
CLion with WSL toolchain executes the command:
/usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/gcc -G "CodeBlocks - Unix Makefiles" /mnt/c/Users/dmytr/CLionProjects/untitled
bash: line 0: cd: /mnt/c/Users/dmytr/CLionProjects/untitled/cmake-build-debug: No such file or directory
CMake Error: The source directory "/mnt/c/Users/dmytr/CLionProjects/untitled" does not exist.
It is obvious that Cmake needs to be invoked where path-to-source starts with /c not /mnt/c.
How it is possible to fix this?
I've created an issue at JetBrains issue tracker - https://youtrack.jetbrains.com/issue/CPP-15459
Looks like there is known bug and it is already fixed in CLion 2019.1 EAP.

How to use -Dinstallation.host= in intelliJ tomcat configuration without command line

I am using mvn for build and deploy my code in tomcat. I am using command for build clean install -DskipTests -DskipJangarooApp -pl :studio-webapp -am -T 4C where studio-webapp is my module name.
And after build i use tomcat:run command like this :
tomcat7:run -Dinstallation.host=192.168.252.100
where 192.168.252.100 is my host machine IP. This process is running well.
But the problem is when I change any java class in my IntelliJ I again run buil command then run. And its taking so much time. So that I want to apply tomcat configuration in IntelliJ but i am not able to find any option of "-Dinstallation.host" in this screen

java.io.IOException: Couldn't create PTY when opening the terminal in WebStorm

I am using WebStorm for an Angular project from past 6 months and suddenly now when I try to access terminal in WebStorm I am getting an error message
java.io.IOException: Couldn't create PTY
could not actually understand the cause of this.
This error occurs because the IDE is not finding the correct shell path for your installed git version.
To solve this, go to the File -> Settings -> Tools -> Terminal menu and change the Shell path based on the installed git version.
On Windows do:
for 64bit:
"C:\Program Files\Git\bin\sh.exe" -login -i
for 32bit:
"C:\Program Files (x86)\Git\bin\sh.exe" -login -i
Don't forget the quotes around the command.
And Linux:
/usr/bin/zsh,/usr/bin/bash or the Shell path for your system.

Use gnome-terminal in codelite instead of default terminal

I'm trying to get gnome-terminal to work in codelite under
setting > preferences > terminal
I tried
gnome-terminal -x '$(CMD)'
but it gives me the following error
Failed to execute child process "/bin/sh -f /usr/lib/codelite/codelite_exec ./program" (No such file or directory)
I'm running Linux Mint 18.
Solution is to run
sudo update-alternatives --config x-terminal-emulator
from a terminal and select
/usr/bin/gnome-terminal.wrapper
as default terminal.
CodeLite uses x-terminal-emulator. So as long as you define x-terminal-emulator to point to the correct terminal it will work.
See this post for more information
I just came across this problem after upgrading to CodeLite 10.0 from the CodeLite repository. The problem occurs because CodeLite is now installing things in different directories - namely codelite_xterm and codelite_exec, which are now installed to /usr/bin/.
For me, on Ubuntu 16.10, I found the easiest solution was to change Settings > Preferences > Terminal to:
/usr/bin/codelite_xterm '$(TITLE)' '$(CMD)'
You can then run:
sudo update-alternatives --config x-terminal-emulator
to select the terminal you wish to use (the default on Ubuntu 16.10 is gnome-terminal, so you won't have to run the last command if you're happy with gnome-terminal).