简体   繁体   English

CLion - 在 docker 容器内构建,但部署以执行/调试到不同的主机

[英]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.我已经构建了一个 x86 docker 容器,其中包含一个 armv8 gcc 工具链,用于交叉编译我的 ZF6F897C9FDCF8B71C2F3 软件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.我的想法是我可以使用 docker 容器来交叉编译我的软件,然后将生成的二进制文件传输到 Raspberry Pi。 This all works fine, manually.这一切都很好,手动。

What I'd like to do is integrate this with JetBrains CLion, somehow.我想做的是以某种方式将它与 JetBrains CLion 集成。 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.我知道可以将 docker 容器设置为远程主机(通过 ssh),但这会构建并尝试在容器中执行二进制文件。 What I'd like to do instead is build the binaries within the container, then deploy them to an alternative Remote Host (ie the Raspberry Pi) for execution, and eventually debugging.我想做的是在容器中构建二进制文件,然后将它们部署到另一个远程主机(即 Raspberry Pi)以执行,并最终进行调试。

Is there an appropriate workflow supported by CLion? CLion 是否支持适当的工作流程? Is it possible to configure a Toolchain remote host and a separate Deployment remote host?是否可以配置 Toolchain 远程主机和单独的 Deployment 远程主机? From what I can see CLion only lets you select a single environment (ie CMake config) for a build, and that is where the resultant binary ends up executing.从我所看到的情况来看,CLion 只允许您在 select 一个单一环境(即 CMake 配置)进行构建,这就是生成的二进制文件最终执行的地方。

Consider this alternative setup: build an armv8 container (with docker buildx ) and include a native gcc toolchain.考虑这种替代设置:构建一个 armv8 容器(使用docker buildx )并包含一个本机 gcc 工具链。 Then, docker can run that container in qemu with something like qemu-user-static .然后,docker 可以使用qemu-user-static 之类的东西在 qemu 中运行该容器。 This allows you to build and debug directly in the container.这允许您直接在容器中构建和调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM