How to link RMW implementation when compiling (Universal Windows Platform)

asked 2021-03-09 15:22:02 -0500

jdlangs gravatar image

updated 2021-03-11 09:28:03 -0500

I'm trying to build ROS2 for use in Univeral Windows Platform applications, which is more restrictive about loading libraries at runtime. Due to this limitation, I'm interested in knowing if it's possible to link against a particular rmw implementation (e.g., rmw_fastrtps_cpp) at build time, and avoid any use of LoadLibrary in the ROS code.

I see there is a CMake option in rmw_implementation for disabling runtime selection of the particular implementation but I wasn't able to clearly determine if that was doing a compile-time link or only allowing the default implementation to be loaded dynamically. Can anyone clarify how the option works?

If the implementation is still being loaded at run-time, is there a way to link at build instead? What would be the path to making that possible?

edit retag flag offensive close merge delete

Comments

I remember @OoeyGUI mentioning they were working on ROS 2 in UWP environments.

Perhaps he has a tip?

gvdhoorn gravatar image gvdhoorn  ( 2021-03-10 03:12:15 -0500 )edit
1

Thanks for the loop in. We are working on having ROS2 built for Hololens, and have a demonstration for Eloquent. (I'm working on Foxy). The repo with the nuget package and unity package manager is at https://github.com/ms-iot/ros_msft_mr....

I have a fix for loading on UWP in the loader - but need to migrate it to fox: https://github.com/ooeygui/rcpputils/...

Hope that helps! Lou

OoeyGUI gravatar image OoeyGUI  ( 2021-03-10 14:16:15 -0500 )edit

Thanks, both, for your comments. I probably could have phrased it better since I don't actually need help finding a solution to dynamic library loading; we've already been consulting with Lou and using his patches. I was more curious in general if it's currently possible to not have to load the middleware dynamically and if not, how hard would it be to make that possible.

jdlangs gravatar image jdlangs  ( 2021-03-10 14:43:03 -0500 )edit

I remembered Dirk working on this at some point in the past.

Related issues:

that last one summarises the current state as far as I know: maybe it can work, but it depends on what is used exactly. Later comments seem to indicate static linking doesn't work any more.


Edit: and see #q347006 for another question about statically linking ROS 2 applications.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-11 01:44:57 -0500 )edit

Did some more edits to try and be clearer. I'm not actually asking about static linking; dynamic linking is fine, I'm interested in avoiding dynamic loading.

jdlangs gravatar image jdlangs  ( 2021-03-11 09:30:04 -0500 )edit

I believe from a OS perspective there isn't much difference (between the linker linking at runtime vs LoadLibrary(..)), but perhaps @OoeyGUI can weigh in again.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-11 11:17:14 -0500 )edit