How to configure CLion for remote dev with a Raspberry Pi4

Update the Pi4 OS and install cmake :

 root@pi4:~# sudo apt update
 root@pi4:~# sudo apt upgrade
 # check what is already installed : 
 root@pi4:~# apt list -a cmake gdb
 root@pi4:~# sudo apt install cmake gdb

Install openssh on Pi4. And not Dropbear because dropbear does not support sftp.

https://dietpi.com/docs/software/ssh/

If the Pi4 does not have sftp installed, the error is :

 $ sftp root@pi4
 bash: line 1: /usr/lib/sftp-server: No such file or directory
 Connection closed

dietpi_openssh.png

Configure the project in CLion :

https://www.jetbrains.com/help/clion/remote-projects-support.html

  1. Configure the Toolchain :

clion-add-env.png

CLion-Toolchains.png

  1. Configure CMake and select toolchain created in 1 :

CLion-CMake-Toolchain.png

  1. Configure the deployment mapping :

CLion-Deployment-mapping.png

  1. Select profile and run :

CLion-Debug.png