Ask Your Question
0

rclcpp::init crashes the node if i include certain header files from freeopcua library

asked 2020-09-24 09:00:28 -0500

apoorvcn47 gravatar image

My node was working fine with ros2 dashing. When i upgraded to ros2 foxy, if i include certain header files from freeOPCUA library (ex. client.h) my node crashes at rclcpp::init(argc, argv)

The prompt doesn't show many details, it just shows exit code -11. It crashes even if i just add the header file and not link any .so files or not use any functions from the library. If i chose to use the library, i can use the library functions just fine before rclcpp::init. And of course if i don't include these header files, rclcpp::init doesn't crash.

I tried to put rclcpp::init in a try catch block to catch the exceptions. but to my surprise, even if it is in try block, the program still crashes. There is no issue while compiling and as i mentioned before, everything works fine in dashing.

edit retag flag offensive close merge delete

Comments

A possible cause for these kinds of problems is a symbol clash, where two different libraries define the same symbol in some shared namespace but use it differently or have different assumptions. This could even be caused by a symbol declared in a header. You wouldn't need to actually link to anything.

Whether that is the cause here I couldn't say. Just thought I'd mention this.

I tried to put rclcpp::init in a try catch block to catch the exceptions.

It's likely the binary is actually crashing. In that case, there are no exceptions to catch.

I would suggest you copy-paste the errors you see into your question (do not post a screenshot). Perhaps someone recognises them or they provide some clue as to what is going wrong.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-24 10:50:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-09-25 13:21:27 -0500

apoorvcn47 gravatar image

updated 2020-09-25 15:03:14 -0500

You were right sir. Both FreeOPCUA and ROS use different version of spdlogger. I edited some files in OPCUA to use system spdlogger and it worked

So, this issue was already raised on FreeOPCUA github page. The necessary commits are available but haven't been merged yet. Please go through following links for help https://github.com/FreeOpcUa/freeopcu... https://github.com/FreeOpcUa/freeopcu... https://github.com/FreeOpcUa/freeopcu...

edit flag offensive delete link more

Comments

I edited some files in OPCUA

It would be immensely valuable if you could detail which files you've edited, and how.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-25 14:33:15 -0500 )edit

Updated my answer

apoorvcn47 gravatar image apoorvcn47  ( 2020-09-25 15:03:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-09-24 09:00:28 -0500

Seen: 40 times

Last updated: Sep 25