Use CLion with Docker (eic-shell)

From epsciwiki
Revision as of 18:22, 7 March 2023 by Davidl (talk | contribs) (Created page with " Using CLion to develop ''EICrecon'' code in a Docker container can be extremely useful. One main reason is that it gives the advantage of using all of the pre-compiled depend...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using CLion to develop EICrecon code in a Docker container can be extremely useful. One main reason is that it gives the advantage of using all of the pre-compiled dependencies already in eic-shell, but it also supports running the gdb debugger inside of the container (something that currently can't be done inside singularity).

Note that one can run CLion itself inside a Docker or singularity(apptainer) container. The integration of the "Docker toolchain" in CLion makes it work particularly nicely with the host OS though.

Here is the outline:

  1. Pull the Docker image
    • docker pull eicweb/jug_xl:nightly
  2. Clone the EICrecon repository to the host
    • git clone git@github.com:eic/EICrecon EICrecon-docker
  3. Start CLion and point it to the repository
  4. Click "Manage toolchains..." and add a "Docker" toolchain
  5. Select the Docker image to use
  6. Modify the "Container Settings" to mount a data directory and allow debugging
  7. Specify that location of cmake inside the container (e.g. /usr/local/bin/cmake)

You should be good to go. CLion will take care of binding the EICrecon source directory to "/tmp" inside the container with appropriate user id etc.

NOTE: The eicweb/jug_xl:nightly Docker image is updated frequently and can take a few minutes to download and unpack. CLion/Docker will automatically do this when it sees an updated version is available which can be a little disruptive to a workflow. If this is an issue, you can look for a different tag that is updated less frequently on Docker hub here:

https://hub.docker.com/r/eicweb/jug_xl/tags


When CLion is first opened in the newly cloned EICrecon directory, it will automatically open the Project Wizard window. Click the "Manage toolchains ..." link.

20230307 CLionProjectWizard.png


In the "Toolchains" window, click the "+" button and add a "Docker" toolchain. Make sure the correct image is selected and then modify the "Container Settings".

n.b. To modify the container settings you must click the gear on the far right of the field

Change the "CMake" setting to be "/usr/local/cmake" since this is where it is installed in the container.

20230307 CLionToolchains.png

After closing the "Toolchains" window, you will return to the Project Wizard. Select "Docker" as the "Toolchain". Click "OK".

20230307 CLionProjectWizard2.png