Closed alsora closed 5 years ago
To summarise, you are using two docker files: The Dockerfile_raspbian_arm
to generate the Raspbian rootfs and Dockerfile_cc_for_arm
for the actual compilation.
Compiling within a Docker container virtualised with qemu
has additional costs compared to "true" cross-compilation on a workstation without virtualisation. Using qemu virtualisation, the arm instructions form the compiler inside Docker need to be translated to the host architecture, adding overhead to the compile time. Having a true cross-compilation, that is running a compiler that generates target binaries on the host architecture, would be much faster. It would also reduce the dependency on Docker, since the rootfs could be generated once using Docker and reused for multiple cross-compilations on the host.
@christianrauch
This is just a first PR to enable Raspbian cross-compilation. My idea was that, after this gets merged, to update how cross-compilation works for all platforms.
The final idea would be to have:
sysroot
directory. They will use qemu
.
Dockerfile_cc_for_arm
). Note that this Dockerfile does not require qemu
.With this first PR, I haven't removed qemu
from the second Dockerfile, because I didn't want to break something in the already present ARM v8 cross-compilation, but rather only add support for Raspbian.
Closing this PR in favor of https://github.com/ros2/cross_compile/pull/18
This PR includes the previous https://github.com/ros2/cross_compile/pull/13.
Complete instructions for cross-compiling ROS2 for RaspberryPi
Build cross-compilation docker environment
Generate sysroot
Create ROS2 workspace
Ignore some packages
Add the toolchain to workspace
Create a Docker container and enter in it
Inside the Docker container
Then you can finally cross-compile
Future work
If this works for everyone, I would proceed to automate it to have a single command for both raspberrypi and armv8.