For completeness, here is how you might do an emulated build using docker buildx, although I will note once more that this is not very performant: if you actually have a target that you can compile on, unless it is extremely resource constrained, it will probably just be faster to compile on that.
-
Make a Dockerfile to build your project. Example: Nav2
- This is rather difficult to do in an efficient way, so this is an area where some community love could really help. But essentially you need to just base off a ROS base image, install
rosdep
dependencies, install any additional dependencies, and invokecolcon build
.
- This is rather difficult to do in an efficient way, so this is an area where some community love could really help. But essentially you need to just base off a ROS base image, install
-
Ensure you have
docker buildx
installed.- This comes pre-packaged with Docker Engine 20+ in some distributions, but you may have to install it manually
-
Create a new “builder” for buildx that has the
docker-container
driver and supports your target arch. For example, if you are building on an x86 host, but you want to build ARM64 images, you would do the following:
docker buildx create --use --platform=linux/arm64,linux/amd64 --name emulated-multiarch --driver docker-container
-
Do this magic incantation to setup QEMU:
docker run --privileged multiarch/qemu-user-static:latest --reset -p yes
-
Build:
docker buildx build . --platform=linux/arm64