Skip to content

Commit

Permalink
Reworked to add_compile_options().
Browse files Browse the repository at this point in the history
  • Loading branch information
lewie-donckers committed Feb 15, 2022
1 parent d1d5f47 commit f603fec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.0.2)
add_compile_options(-std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror)
project(path_tracking_pid)

## Find catkin and any catkin packages
Expand Down Expand Up @@ -66,7 +67,6 @@ add_library(${PROJECT_NAME}
src/visualization.cpp
)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
target_compile_options(${PROJECT_NAME} PUBLIC -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})

include_directories(
Expand Down

2 comments on commit f603fec

@MCFurry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lewie-donckers this specific commit made our pipelines in other projects fail. In these pipelines (which depend on this package) the package is build with -DCMAKE_BUILD_TYPE=RelWithDebInfo.

The error thrown then is:

_______________________________________________________________________________
Errors << path_tracking_pid:make /logs/path_tracking_pid/build.make.000.log    
In file included from /opt/ros/noetic/include/tf2/LinearMath/Transform.h:21,
                 from /src/path_tracking_pid/include/path_tracking_pid/controller.hpp:11,
                 from /src/path_tracking_pid/src/controller.cpp:5:
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h: In member function ‘void path_tracking_pid::Controller::setPlan(geometry_msgs::Transform, geometry_msgs::Twist, const std::vector<geometry_msgs::PoseStamped_<std::allocator<void> > >&)’:
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:405:19: error: ‘*((void*)& carrotTF +16)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  405 |   return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z() * v.z();
      |          ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:405:41: error: ‘*((void*)& carrotTF +48)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  405 |   return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z() * v.z();
      |                                ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:405:63: error: ‘*((void*)& carrotTF +80)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  405 |   return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z() * v.z();
      |                                                      ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:401:19: error: ‘*((void*)& carrotTF +8)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  401 |   return m_el[0].y() * v.x() + m_el[1].y() * v.y() + m_el[2].y() * v.z();
      |          ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:401:41: error: ‘*((void*)& carrotTF +40)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  401 |   return m_el[0].y() * v.x() + m_el[1].y() * v.y() + m_el[2].y() * v.z();
      |                                ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:401:63: error: ‘*((void*)& carrotTF +72)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  401 |   return m_el[0].y() * v.x() + m_el[1].y() * v.y() + m_el[2].y() * v.z();
      |                                                      ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:397:19: error: ‘carrotTF’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  397 |   return m_el[0].x() * v.x() + m_el[1].x() * v.y() + m_el[2].x() * v.z();
      |          ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:397:41: error: ‘*((void*)& carrotTF +32)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  397 |   return m_el[0].x() * v.x() + m_el[1].x() * v.y() + m_el[2].x() * v.z();
      |                                ~~~~~~~~~^~
/opt/ros/noetic/include/tf2/LinearMath/Matrix3x3.h:397:63: error: ‘*((void*)& carrotTF +64)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  397 |   return m_el[0].x() * v.x() + m_el[1].x() * v.y() + m_el[2].x() * v.z();
      |                                                      ~~~~~~~~~^~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/path_tracking_pid.dir/build.make:76: CMakeFiles/path_tracking_pid.dir/src/controller.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:489: CMakeFiles/path_tracking_pid.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
cd /build/path_tracking_pid; catkin build --get-env path_tracking_pid | catkin env -si  /usr/bin/make --jobserver-auth=3,4; cd -

...............................................................................
Failed << path_tracking_pid:make                [ Exited with code 2 ] 

And you could reproduce this in a clean environment with this Dockerfile:

FROM ros:noetic
RUN apt-get update -qq && apt-get install -qqy python3-catkin-tools python3-osrf-pycommon git
RUN git clone https://github.com/nobleo/path_tracking_pid.git src/path_tracking_pid
RUN cd src/path_tracking_pid && git checkout f603fecff527321a9ee0165845981bd4fc578ad6 && cd /

# Install dependencies used by packages
RUN rosdep update && rosdep install -y -i --from-paths src

# Compile ROS package
RUN bash -c 'source /opt/ros/*/setup.bash && catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo'

Could you please elaborate what these specific changes should benefit? I.e. should we try fixing this, or can we just as well revert this commit?

@MCFurry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think I found it, the stricter checking simply showed a warning as error now.
This PR #47 seems to fix this warning/error.

Not sure why it only pops up with a -DCMAKE_BUILD_TYPE=RelWithDebInfo though?

Please sign in to comment.