Skip to content

Commit 02ada52

Browse files
lmayencourtdirk-thomas
authored andcommitted
Update cross-compilation instructions (ros2#119)
The following modifications are part of this patch: * export /etc from the sysroot * update list of package ignored * revert pcre/libz workaround * use the new generic dockerfile to generate the sysroot * clear docker container after exporting it Change-Id: Iaa9bdb05203725f4d4e08561d46e5724f0372b3c Signed-off-by: Louis Mayencourt <[email protected]>
1 parent 9b23c02 commit 02ada52

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

source/Tutorials/Cross-compilation.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,17 @@ The standard `setup <Linux-Development-Setup>`__ process of ROS2 is run inside a
167167

168168
.. code-block:: bash
169169
170-
docker build -t aarch64_ros2:latest -f ros2_ws/src/ros2/cross_compile/sysroot/Dockerfile_ubuntu_arm64 .
171-
docker run --name aarch64_sysroot aarch64_ros2:latest
170+
docker build -t arm_ros2:latest -f ros2_ws/src/ros2/cross_compile/sysroot/Dockerfile_ubuntu_arm .
171+
docker run --name arm_sysroot arm_ros2:latest
172172
173173
Export the resulting container to a tarball and extract it:
174174

175175
.. code-block:: bash
176176
177-
docker container export -o sysroot_docker.tar aarch64_sysroot
177+
docker container export -o sysroot_docker.tar arm_sysroot
178178
mkdir sysroot_docker
179-
tar -C sysroot_docker -xf sysroot_docker.tar lib usr opt
179+
tar -C sysroot_docker -xf sysroot_docker.tar lib usr opt etc
180+
docker rm arm_sysroot
180181
181182
This container can be used later as virtual target to run the created file-system and run the demo code.
182183

@@ -202,11 +203,17 @@ The following packages still cause errors during the cross-compilation (under in
202203
203204
touch \
204205
ros2_ws/src/ros2/rviz/COLCON_IGNORE \
205-
ros2_ws/src/ros2/demos/intra_process_demo/COLCON_IGNORE \
206-
ros2_ws/src/ros2/demos/image_tools/COLCON_IGNORE \
207-
ros2_ws/src/ros2/robot_state_publisher/COLCON_IGNORE \
208206
ros2_ws/src/ros-visualization/COLCON_IGNORE
209207
208+
The ``Poco`` pre-built has a known issue where it is searching for ``libz`` and ``libpcre`` on the host system instead of SYSROOT.
209+
As a workaround for the moment, please link both libraries into the the host's file-system.
210+
211+
.. code-block:: bash
212+
213+
mkdir -p /usr/lib/$TARGET_TRIPLE
214+
ln -s `pwd`/sysroot_docker/lib/$TARGET_TRIPLE/libz.so.1 /usr/lib/$TARGET_TRIPLE/libz.so
215+
ln -s `pwd`/sysroot_docker/lib/$TARGET_TRIPLE/libpcre.so.3 /usr/lib/$TARGET_TRIPLE/libpcre.so
216+
210217
Then, start a build with colcon specifying the toolchain-file:
211218

212219
.. code-block:: bash
@@ -298,7 +305,7 @@ Copy the file-system on your target or use the previously built docker image:
298305

299306
.. code-block:: bash
300307
301-
docker run -it --rm -v `pwd`/ros2_ws:/ros2_ws aarch64_ros2:latest
308+
docker run -it --rm -v `pwd`/ros2_ws:/ros2_ws arm_ros2:latest
302309
303310
Source the environment:
304311

0 commit comments

Comments
 (0)