eProsima / Micro-XRCE-DDS-Agent

Micro XRCE-DDS Agent respository. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
102 stars 72 forks source link

Cmake could not find microcdr cross-compile (bitbake recipe) #319

Closed dirksavage88 closed 1 year ago

dirksavage88 commented 1 year ago

Cross compiling for arm using the yocto build tools (bit bake and dev tool) I’m getting this error due to cmake not finding the microcdr package

this error is very similar to those experiencing this dependency issue for the Client code which I see no resolution for.

Target platform is yocto zeus 5.4.24-2.1.0

I followed the exact steps in the standalone agent installation manual as well as parallel installing and building on my amd64 (this found microcdr and built successfully)

I did try to create a recipe for microcdr and build this as a dependency to the agent but ram into the same error. Where is microcdr called out in the cmakelist (find package?). I wish to only install the agent if possible and can disable a lot of options if this is solely a client based dependency…

also why is my host amd64 platform able to find the package without installing a standalone microcdr build?

As PX4 autopilot moved to xrcedds and micro ROS, I anticipate more and more users will experience this issue when cross compiling the agent for off board computing so it would be awesome if I can help find a resolution to save future headache on the user side.

pablogs9 commented 1 year ago

Micro XRCE-DDS Agent uses a CMake superbuild approach: https://github.com/eProsima/Micro-XRCE-DDS-Agent/blob/f984380d092f593cde35592be2f7571fb2bfa365/CMakeLists.txt#L123

This functionality shall be able to download and build the dependencies.

Could you provide steps for replicating this issue?

dirksavage88 commented 1 year ago

Perhaps the superbuild approach may not be conducive to the yocto build tools?

Attached is a screen snip of the error.

Steps to reproduce:

1) In a yocto build environment, with known working core recipes, use the devtool to add the micro-XRCE-DDS Agent on the host platform: $ devtool add https://github.com/eProsima/Micro-XRCE-DDS-Agent.git 2) Edit the recipe to make sure 'inherit cmake' is present in the *.bb recipe: this is all bitbake needs in order to cross-compile and does not require any 'do_configure' sections. In a nutshell, inherit cmake does the equivalent of entering into the src repo and running cmake, make install, install, etc. 3) The commit hash in my bitbake recipe is: f984380d092f593cde35592be2f7571fb2bfa365 4) Run this command to tell the yocto build tools to do all the work of configuring, dependency linking, building, installing, linking, and packaging on the target platform (ARM): $ devtool build uagent-superbuild

That last command is when I received the error: "FAILED: uclient-prefix/src/uclient-stamp/uclient-configure"

The only unknown issue is devtool not able to resolve the Gmock dependency, however I have not seen it fail because of it at this piont.

Additionally, it seems other users with different build tools are also finding issues with the superbuild modality: https://madahindev.com/post/micro_xrce_dds_cmake_integration

Screenshot from 2022-11-10 16-09-50

pablogs9 commented 1 year ago

Hi @dirksavage88, sorry but I have little experience with Yocto. My only recommendation can be to avoid using superbuild (disabling the CMake flag) and try to add the dependencies manually.

In any case, it would be great if you generate some documentation when you achieve this in order to have a procedure for integrating into those kinds of platforms. Thanks a lot.

dirksavage88 commented 1 year ago

@pablogs9 that sounds like it could work, however I’m worried those changes made would only exist on a fringe fork of this repo and not be of help to others using build systems facing similar issues.

I see that you also maintain the micro_ros_setup repo as well…which wraps this implementation in a ROS 2 node. This is also a desirable package since it is easily configurable on a native or on-target capable build system with ROS 2, but also suffers from its own build tool integration complexities as with this implementation.

Either implementation requires tweaking and/or facilitation of post install config and build steps (micro ROS setup for example, uses a ‘configure_firmware.sh’ script as well as a build script on top of the meta build tools in ROS 2…)

The gist of the issue is that both implementations of these packages aren’t ideal for cross compiling to a embedded target (lacking on-target build tools). Also, installing microROS via snap package brings its own intricacies, but given that snaps add additional package manager overhead in the build recipes on top of apt, I’m not convinced it’s viable for yocto build tools either.

dirksavage88 commented 1 year ago

For anyone looking for a buildable xrce-dds client (it's quick and dirty, definitely not an elegant solution) see here: https://github.com/dirksavage88/meta-dds.git

pablogs9 commented 1 year ago

Also I have found some interesting article (and Github repo) here: https://antmicro.com/blog/2022/10/kenning-tvm-and-micro-ros-in-the-meta-antmicro-yocto-layer/ in the Introduction of micro-ROS to meta-antmicro section