dll not found error when running ROS2 examples, any node, publish from command line on Windows 10
Hi, I am setting up ROS2 Bouncy on Windows10 and already encountered the following problem while compiling from source: ROS2 fails to build many packages on Windows 10, which I solved.
EDIT: I found this question to be the same issue.
Now, my code compiles and I want to test the examples. But when I run the talker example node, it gives me this output:
cd \dev\ros2
call install\local_setup.bat
ros2 run demo_nodes_py talker
>>> [rcutils|error_handling.c:155] rcutils_set_error_state()
This error state is being overwritten:
'failed to load shared library of rmw implementation. Exception: Cannot load library: C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll, at c:\dev\ros2\src\ros2\rmw_implementation\rmw_implementation\src\functions.cpp:135'
with this new error message:
'failed to load shared library of rmw implementation. Exception: Cannot load library: C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll, at c:\dev\ros2\src\ros2\rmw_implementation\rmw_implementation\src\functions.cpp:135'
rcutils_reset_error() should be called after error handling to avoid this.
<<<
With the error message above repeating many times...
>>> [rcutils|error_handling.c:155] rcutils_set_error_state()
This error state is being overwritten:
'failed to load shared library of rmw implementation. Exception: Cannot load library: C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll, at c:\dev\ros2\src\ros2\rmw_implementation\rmw_implementation\src\functions.cpp:135'
with this new error message:
'failed to load shared library of rmw implementation. Exception: Cannot load library: C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll, at c:\dev\ros2\src\ros2\rmw_implementation\rmw_implementation\src\functions.cpp:135'
rcutils_reset_error() should be called after error handling to avoid this.
<<<
Traceback (most recent call last):
File "C:\dev\ros2\install\lib\demo_nodes_py\talker-script.py", line 11, in <module>
load_entry_point('demo-nodes-py==0.5.1', 'console_scripts', 'talker')()
File "C:\dev\ros2\install\Lib\site-packages\demo_nodes_py\topics\talker.py", line 39, in main
rclpy.init(args=args)
File "C:\dev\ros2\install\Lib\site-packages\rclpy\__init__.py", line 27, in init
args if args is not None else sys.argv)
RuntimeError: Failed to init: failed to load shared library of rmw implementation. Exception: Cannot load library: C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll, at c:\dev\ros2\src\ros2\rmw_implementation\rmw_implementation\src\functions.cpp:135, at c:\dev\ros2\src\ros2\rcl\rcl\src\rcl\rcl.c:92
EDIT: The exact same output is generated when I use demo_nodes_cpp
. Also, when writing my own simple publisher in python, I get this error as well.
My rmw_implementation as well as all other packages (except for connext-related ones) compiled without error. Also, I find the rmw_fastrtps_cpp.dll
in the given path (C:\dev\ros2\install\bin/rmw_fastrtps_cpp.dll
). (It bugs me, that the path has mixed forward and backslashes.)
Maybe, I missed something in my setup? EDIT: Does this have to do with environment variables? If so, is there a list of variables which should be set?
EDIT: I managed to isolate the error to the ros init call:
def main(args=None):
rclpy.init(args=args) # error produced by this line of code
...
So ...