Because VSCode implementation of remote containers is clunky, such as having to commit before returning to local environment, we added support for CLion.
CLion solves many of the shortcomings of VSCode by using a remote environment. Basically, it is a container that has all the necessary tools to build, run and debug the project, while also synchronising the local environment with the remote one. In other words, you won't lose your changes if you forget to commit.
To setup your CLion environment, follow these steps (they are also located in the README.md of the project):
Pull sonia_common image:
docker pull docker.pkg.github.com/sonia-auv/sonia_common/sonia_common:x86-perception-latest
.docker pull docker.pkg.github.com/sonia-auv/sonia_common/sonia_common_cuda:x86-perception-latest
.Copy .env.example
to .env
and change the exposed SSH port that will be used to connect to the CLion remote
environment with the CLION_SSH_PORT
variable. You can use the default value of 2222
.
Build the remote environment Docker image:
docker-compose build proc_image_processing clion_remote_env
.docker-compose -f docker-compose-gpu.yml build proc_image_processing clion_remote_env
.Launch the remote environment:
docker-compose up clion_remote_env
.docker-compose -f docker-compose-gpu.yml up clion_remote_env
. standard_init_linux.go:228: exec user process caused: no such file or directory
, you aresonia_entrypoint.sh
sonia_clion_entrypoint.sh
are LF
.Configure your Toolchain:
File | Settings | Build, Execution, Deployment | Toolchains
.Remote Host
Toolchain:
Remote Environment
.Remote Environment
.127.0.0.1
as Host
value.CLION_SSH_PORT
variable as Port
value.sonia
as User name
value.test
as Password
value.Test connection
button to make sure CLion can SSH into your remote environment.Configure CMake:
File | Settings | Build, Execution, Deployment | CMake
.Debug
as the Build type
value.Toolchain
value.build
as the Build directory
value.Apply
button (you will need to close the window in order to do the next step).Environment
value.Include system environment variables
is checked when you click on the small icon at the endEnvironment
field.Configure Deployment:
File | Settings | Build, Execution, Deployment | Deployment
.SFTP
deployment that has been automatically created by the previous steps:
Remote Environment
.SSH configuration
. Test that the connection still works!Mappings
tab:
Local path
value. For/home/yourusername/CLionProjects/proc_image_processing/
./home/sonia/ros_sonia_ws/src/proc_image_processing
as Deployment path
value.Reload the CMake project using File | Reload CMake Project
. CLion should populate all the available launch options
up top at the left of the Play
icon.
Before you can launch something, you must copy once again the contents from the clion.env.vars file
into the Environment
field of the CMake Application that you want to launch. You can do that by
using Edit Configurations
from the toolbar at the left of the Play
button.
Tips:
Tools
menu is where you will find pretty much all the tools you need in order to interact with your remoteRemote Host
. When you open it, you can navigate theFile Transfer
. This is where you can see everything related to