xqms / rosmon

ROS node launcher & monitoring daemon
Other
180 stars 47 forks source link

Compile warnings #162

Closed amilcarlucas closed 2 years ago

amilcarlucas commented 2 years ago

I get these compile warnings when compiling 2.4.0 on arm_v7

In file included from /usr/include/c++/7/vector:69:0,
                 from /opt/ros/melodic/include/xmlrpcpp/XmlRpcDispatch.h:15,
                 from /opt/ros/melodic/include/xmlrpcpp/XmlRpcClient.h:16,
                 from /opt/ros/melodic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp/XmlRpc.h:30,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/launch/yaml_params.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/launch/yaml_params.cpp:4:
/usr/include/c++/7/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {XmlRpc::XmlRpcValue}; _Tp = XmlRpc::XmlRpcValue; _Alloc = std::allocator<XmlRpc::XmlRpcValue>]’:
/usr/include/c++/7/bits/vector.tcc:394:7: note: parameter passing for argument of type ‘std::vector<XmlRpc::XmlRpcValue>::iterator {aka __gnu_cxx::__normal_iterator<XmlRpc::XmlRpcValue*, std::vector<XmlRpc::XmlRpcValue> >}’ changed in GCC 7.1
       vector<_Tp, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc: In function ‘XmlRpc::XmlRpcValue rosmon::launch::yamlToXmlRpc(const rosmon::launch::ParseContext&, const YAML::Node&)’:
/usr/include/c++/7/bits/vector.tcc:105:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<XmlRpc::XmlRpcValue*, std::vector<XmlRpc::XmlRpcValue> >’ changed in GCC 7.1
    _M_realloc_insert(end(), std::forward<_Args>(__args)...);
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/boost/math/special_functions/math_fwd.hpp:26,
                 from /usr/include/boost/math/special_functions/round.hpp:15,
                 from /opt/ros/melodic/include/ros/time.h:58,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/monitor/../fd_watcher.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/monitor/monitor.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/ros_interface.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/ros_interface.cpp:4:
/usr/include/c++/7/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const rosmon_msgs::NodeState_<std::allocator<void> >&}; _Tp = rosmon_msgs::NodeState_<std::allocator<void> >; _Alloc = std::allocator<rosmon_msgs::NodeState_<std::allocator<void> > >]’:
/usr/include/c++/7/bits/vector.tcc:394:7: note: parameter passing for argument of type ‘std::vector<rosmon_msgs::NodeState_<std::allocator<void> >, std::allocator<rosmon_msgs::NodeState_<std::allocator<void> > > >::iterator {aka __gnu_cxx::__normal_iterator<rosmon_msgs::NodeState_<std::allocator<void> >*, std::vector<rosmon_msgs::NodeState_<std::allocator<void> >, std::allocator<rosmon_msgs::NodeState_<std::allocator<void> > > > >}’ changed in GCC 7.1
       vector<_Tp, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/boost/math/special_functions/math_fwd.hpp:26,
                 from /usr/include/boost/math/special_functions/round.hpp:15,
                 from /opt/ros/melodic/include/ros/time.h:58,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/monitor/../fd_watcher.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/monitor/monitor.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/ros_interface.h:7,
                 from /home/ubuntu/tethered_surveillance_gf/droneport/ros_ws/src/rosmon/rosmon_core/src/ros_interface.cpp:4:
/usr/include/c++/7/bits/stl_vector.h: In member function ‘void rosmon::ROSInterface::update()’:
/usr/include/c++/7/bits/stl_vector.h:948:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<rosmon_msgs::NodeState_<std::allocator<void> >*, std::vector<rosmon_msgs::NodeState_<std::allocator<void> >, std::allocator<rosmon_msgs::NodeState_<std::allocator<void> > > > >’ changed in GCC 7.1
    _M_realloc_insert(end(), __x);
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
xqms commented 2 years ago

It seems this was a gcc bug that was fixed in 7.1. The warning is there to tell you that mixing code compiled with GCC 7.1 and earlier versions might result in undefined behavior.

We could add -Wno-psabi to the compiler flags in CMakeLists.txt, but the warning is there for a reason (and I cannot check whether e.g. your system libraries are compiled with GCC < 7.1). So I won't do anything in rosmon.

If you want to suppress the warning, you can add -DCMAKE_CXX_FLAGS=-Wno-psabi to your cmake arguments.

Details about the bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728