Call for help: maintainership of the ros_cross_compile tool

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.

  1. 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 invoke colcon build.
  2. 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
  3. 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
  1. Do this magic incantation to setup QEMU:
    docker run --privileged multiarch/qemu-user-static:latest --reset -p yes

  2. Build:

docker buildx build . --platform=linux/arm64
2 Likes