Giter Club home page Giter Club logo

clion-remote's Introduction

Remote Development With CLion and Vagrant

This project is an example of using the new remote development features of CLion 2018.3 with a Vagrant VM as the remote host. See the 2018.2 branch for using earlier versions of CLion that support remote debugging but not remote builds.

CLion does not have Vagrant support yet, so some modifications to the standard Vagrant workflow are necessary; see the project Vagrantfile. The Vagrant box must be Linux, and it must have rsync and a recent version of GDB (7.8+). Newer versions of Ubuntu include a compatible version of GDB in their standard package repos, but CentOS users will have to build a version from source.

Initial Setup

  1. Clone this project.

2. Start and provision the Vagrant box. Note the connection port and remote project directory in the Vagrant start-up messages.

$ vagrant up

...

==> default: CLion workarounds enabled
==> default: Use port 22000 for CLion remote host connection
==> default: Use /vagrant as the remote deployment directory

Project Configuration

  1. Define a Toolchain to configure the build and debug tools for the Vagrant box. Here, a fixed SSH port is used to connect. A static IP can be instead. In either case, the address must be unique on the local machine.

    Toolchains

    Use the Vagrant private key file for this connection.

    Remote Host Credentials

    Once the Toolchain is configured, hit Apply to create it.

  2. Define one or more CMake Profiles to configure the build types to use with the Vagrant Toolchain.

    CMake Profiles

  3. When a remote Toolchain is created, CLion will create the corresponding SFTP deployment. CLion does not yet support mounted folders for remote builds, so a Vagrant synced folder cannot be used for the project directory.

    Remote Deployment

    The local project is directory is mapped to /vagrant on the VM. Here, CLion will manage the remote directory, not Vagrant. Files in the project directory cannot be used during Vagrant provisioning because they will not be synced to the VM at that point.

    Mappings

    CLion will automatically exclude the local build directory from syncing, but all other exclusions must be manually configured. The local .vagrant/ directory should be excluded along with any other files that are not needed to build or run the project.

    Excluded Paths

Remote Workflow

Once the project is properly configured, CLion will sync files to the Vagrant VM and run CMake to build the project model. Run/Debug Configurations will be created for all of the project executables.

hello Run/Debug Configuration

CLion can now be used to edit, build, debug, and test the project as if it was on the local machine.

hello Run/Debug Configuration

Project binaries built on the remote machine will be available in the local copy of the build directory.

Troubleshooting

Use YouTrack to report new bugs, find workarounds for existing bugs, and make feature requests. Many remote development bugs are attached to CPP-744.

It will sometimes be necessary to run Tools->CMake->Reload CMake Project to force CLion to reconnect to the remote host.

It is possible for the project to get into an inconsistent state that will disrupt file syncing. In some cases, CLion will be unable to sync updated build files from the remote machine to the local machine. In other cases, CLion will stop syncing local source files to the remote machine. If this occurs, try these troubleshooting steps:

  • Run Tools->CMake->Reset Cache and Reload Project
  • Run File->Invalidate Caches / Restart
  • Restart the Vagrant VM
  • Delete the remote Toolchain configuration and recreate it

clion-remote's People

Contributors

mdklatt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.