rclcpp::init crashes the node if i include certain header files from freeopcua library
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.
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.
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.