cross compile ROS2 on raspberry pi3
Hello guys, I'm trying to cross compile ROS2 for a Raspberry pi 3, my platform is Ubuntu on x86. I use this tutorial link text , when I did the last step ''Trigger a build'', it shows the error blow:
Starting >>> sqlite3_vendor
--- stderr: tinyxml2_vendor
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find TinyXML2 (missing: TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindTinyXML2.cmake:24 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
---
Failed <<< tinyxml2_vendor [ Exited with code 1 ]
Finished <<< ament_pep257 [1.44s]
[5.297s] ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:220> exception=RuntimeError('cannot reuse already awaited coroutine',)>
RuntimeError: cannot reuse already awaited coroutine
[5.297s] ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<_fd2callback() done, defined at /usr/lib/python3/dist-packages/colcon_core/subprocess.py:220> exception=RuntimeError('cannot reuse already awaited coroutine',)>
RuntimeError: cannot reuse already awaited coroutine
Aborted <<< gmock_vendor
Aborted <<< fastrtps
Aborted <<< sqlite3_vendor
Aborted <<< osrf_pycommon
Aborted <<< ament_cmake_core
Aborted <<< ament_pep8
Summary: 9 packages finished [5.56s]
1 package failed: tinyxml2_vendor
6 packages aborted: ament_cmake_core ament_pep8 fastrtps gmock_vendor osrf_pycommon sqlite3_vendor
1 package had stderr output: tinyxml2_vendor
181 packages not processed
I checked and this package libtinyxml2-devpackage
is already installed.
DO you have any idea about how to solve this issue ? Thank you a lot!
Asked by stella on 2019-07-26 10:20:12 UTC
Answers
The instructions you linked are old. The current up-to-date cross-compilation instructions for ROS2 can be found here https://index.ros.org/doc/ros2/Tutorials/Cross-compilation/
However, both the old as well as the new ones, are meant for ARM64 platforms and they can't be directly used for RaspberryPi. There are several issues cross-compiling for RaspberryPi.
I have collected some instructions here (they should be easy to follow, in case let me know). https://github.com/alsora/cross_compile/tree/alsora/refactor_cross_compile
Your problem can be solved by installing in the sysroot the following package
sudo apt-get install -y libtinyxml2-dev
If the package is already installed, make sure that you are using a correct compiler (g++-6-arm-linux-gnueabihf
is the one that works for me) and that you are providing the path to where the library is installed to the toolchain.
Asked by alsora on 2019-07-29 13:44:42 UTC
Comments
Thank you alsora, I think the problem is cmake didn’t setup the right path for the libtinyxml2-dev, do you have any idea aboout this?
Asked by stella on 2019-07-30 09:56:41 UTC
I need more information about your configuration in order to answer... Assuming that your raspberryPi sysroot is placed at ~/sysroot
and that the library is in ~/sysroot/usr/lib
then it should be found automatically when setting the sysroot path in the toolchain.cmake
file like this: set(CMAKE_SYSROOT ~/sysroot)
.
I suggest you to follow the instructions that I linked as these work fine
Asked by alsora on 2019-07-31 06:28:16 UTC
Comments