Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLion - build within a docker container, but deploy for execution/debugging to a different host

I have constructed an x86 docker container, containing an armv8 gcc toolchain for cross-compilation of my C++ software. The idea is that I can use the docker container to cross-compile my software and then transfer the resulting binaries to a Raspberry Pi. This all works fine, manually.

What I'd like to do is integrate this with JetBrains CLion, somehow. I know that a docker container can be set up as a Remote Host (via ssh), but this would build and try to execute the binaries within the container. What I'd like to do instead is build the binaries within the container, then deploy them to an alternative Remote Host (i.e. the Raspberry Pi) for execution, and eventually debugging.

Is there an appropriate workflow supported by CLion? Is it possible to configure a Toolchain remote host and a separate Deployment remote host? From what I can see CLion only lets you select a single environment (i.e. CMake config) for a build, and that is where the resultant binary ends up executing.

like image 613
davidA Avatar asked Sep 25 '19 04:09

davidA


People also ask

Can we deploy multiple applications in one container?

It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application. You can connect multiple containers using user-defined networks and shared volumes.

What is Docker debug mode?

If you are having trouble with Docker containers or images, you can turn on debug mode on your Docker daemon. Enabling debugging provides more verbose output from the daemon and you can use this information to find out more about why your containers or images are having issues.


1 Answers

Consider this alternative setup: build an armv8 container (with docker buildx) and include a native gcc toolchain. Then, docker can run that container in qemu with something like qemu-user-static. This allows you to build and debug directly in the container.

like image 142
Woodrow Barlow Avatar answered Oct 21 '22 11:10

Woodrow Barlow