turtlebot3_simulations icon indicating copy to clipboard operation
turtlebot3_simulations copied to clipboard

C++ language error while compiling src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp

Open 2catycm opened this issue 2 years ago • 1 comments

What happens?

[ 98%] Building CXX object turtlebot3_simulations/turtlebot3_gazebo/CMakeFiles/turtlebot3_drive.dir/src/turtlebot3_drive.cpp.o
In file included from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/class.h:28,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/object.h:22,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectimpl.h:21,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:24,
                 from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:42:30: error: expected initializer before ‘ObjectPtrBase’
   42 |         class LOG4CXX_EXPORT ObjectPtrBase {
      |                              ^~~~~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:54:9: error: expected class-name before ‘{’ token
   54 |         {
      |         ^
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:82:25: error: ‘ObjectPtrBase’ does not name a type; did you mean ‘ObjectPtrT’?
   82 |        ObjectPtrT(const ObjectPtrBase& p1)
      |                         ^~~~~~~~~~~~~
      |                         ObjectPtrT
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:82:8: error: ‘log4cxx::helpers::ObjectPtrT<T>::ObjectPtrT(const int&)’ cannot be overloaded with ‘log4cxx::helpers::ObjectPtrT<T>::ObjectPtrT(const int&)’
   82 |        ObjectPtrT(const ObjectPtrBase& p1)
      |        ^~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:56:10: note: previous declaration ‘log4cxx::helpers::ObjectPtrT<T>::ObjectPtrT(const int&)’
   56 |          ObjectPtrT(const int& null)
      |          ^~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:89:32: error: expected ‘)’ before ‘&’ token
   89 |        ObjectPtrT(ObjectPtrBase& p1)
      |                  ~             ^
      |                                )
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:141:29: error: declaration of ‘operator=’ as non-function
  141 |       ObjectPtrT& operator=(ObjectPtrBase& p1) {
      |                             ^~~~~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:141:27: error: expected ‘;’ at end of member declaration
  141 |       ObjectPtrT& operator=(ObjectPtrBase& p1) {
      |                           ^
      |                            ;
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:141:42: error: expected ‘)’ before ‘&’ token
  141 |       ObjectPtrT& operator=(ObjectPtrBase& p1) {
      |                            ~             ^
      |                                          )
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:146:35: error: ‘ObjectPtrBase’ does not name a type; did you mean ‘ObjectPtrT’?
  146 |       ObjectPtrT& operator=(const ObjectPtrBase& p1) {
      |                                   ^~~~~~~~~~~~~
      |                                   ObjectPtrT
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:146:19: error: ‘log4cxx::helpers::ObjectPtrT<T>& log4cxx::helpers::ObjectPtrT<T>::operator=(const int&)’ cannot be overloaded with ‘log4cxx::helpers::ObjectPtrT<T>& log4cxx::helpers::ObjectPtrT<T>::operator=(const int&)’
  146 |       ObjectPtrT& operator=(const ObjectPtrBase& p1) {
      |                   ^~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:116:22: note: previous declaration ‘log4cxx::helpers::ObjectPtrT<T>& log4cxx::helpers::ObjectPtrT<T>::operator=(const int&)’
  116 |          ObjectPtrT& operator=(const int& null) //throw(IllegalArgumentException)
      |                      ^~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h: In constructor ‘log4cxx::helpers::ObjectPtrT<T>::ObjectPtrT(const int&)’:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:58:17: error: ‘ObjectPtrBase’ has not been declared
   58 |                 ObjectPtrBase::checkNull(null);
      |                 ^~~~~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h: In constructor ‘log4cxx::helpers::ObjectPtrT<T>::ObjectPtrT(const int&)’:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:83:11: error: request for member ‘cast’ in ‘p1’, which is of non-class type ‘const int’
   83 |           _LOG4CXX_OBJECTPTR_INIT(reinterpret_cast<T*>(p1.cast(T::getStaticClass())))
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h: In member function ‘log4cxx::helpers::ObjectPtrT<T>& log4cxx::helpers::ObjectPtrT<T>::operator=(const int&)’:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:121:17: error: ‘ObjectPtrBase’ has not been declared
  121 |                 ObjectPtrBase::checkNull(null);
      |                 ^~~~~~~~~~~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h: In member function ‘log4cxx::helpers::ObjectPtrT<T>& log4cxx::helpers::ObjectPtrT<T>::operator=(const int&)’:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:147:46: error: request for member ‘cast’ in ‘p1’, which is of non-class type ‘const int’
  147 |          T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));
      |                                              ^~~~
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h: In member function ‘T* log4cxx::helpers::ObjectPtrT<T>::exchange(const T*)’:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectptr.h:172:37: error: ‘ObjectPtrBase’ has not been declared
  172 |              return static_cast<T*>(ObjectPtrBase::exchange(
      |                                     ^~~~~~~~~~~~~
In file included from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/object.h:22,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectimpl.h:21,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:24,
                 from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/class.h: At global scope:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/class.h:39:38: error: expected initializer before ‘Class’
   39 |                 class LOG4CXX_EXPORT Class
      |                                      ^~~~~
In file included from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/object.h:24,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectimpl.h:21,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:24,
                 from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/classregistration.h:28:38: error: expected initializer before ‘ClassRegistration’
   28 |                 class LOG4CXX_EXPORT ClassRegistration
      |                                      ^~~~~~~~~~~~~~~~~
In file included from /mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectimpl.h:21,
                 from /mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:24,
                 from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/object.h:102:38: error: expected initializer before ‘Object’
  102 |                 class LOG4CXX_EXPORT Object
      |                                      ^~~~~~
In file included from /mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:24,
                 from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/helpers/objectimpl.h:28:28: error: expected initializer before ‘ObjectImpl’
   28 |       class LOG4CXX_EXPORT ObjectImpl : public virtual Object
      |                            ^~~~~~~~~~
In file included from /opt/ros/noetic/include/ros/console.h:46,
                 from /opt/ros/noetic/include/ros/ros.h:40,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/log4cxx/level.h:42:30: error: expected initializer before ‘Level’
   42 |         class LOG4CXX_EXPORT Level : public helpers::ObjectImpl
      |                              ^~~~~
In file included from /mnt/c/opt/ros/foxy/x64/include/boost/bind.hpp:30,
                 from /opt/ros/noetic/include/ros/publisher.h:35,
                 from /opt/ros/noetic/include/ros/node_handle.h:32,
                 from /opt/ros/noetic/include/ros/ros.h:45,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/turtlebot3_gazebo/turtlebot3_drive.h:22,
                 from /mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp:19:
/mnt/c/opt/ros/foxy/x64/include/boost/bind.hpp:36:1: note: #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
make[2]: *** [turtlebot3_simulations/turtlebot3_gazebo/CMakeFiles/turtlebot3_drive.dir/build.make:63: turtlebot3_simulations/turtlebot3_gazebo/CMakeFiles/turtlebot3_drive.dir/src/turtlebot3_drive.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4365: turtlebot3_simulations/turtlebot3_gazebo/CMakeFiles/turtlebot3_drive.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j16 -l16" failed

How to reproduce

  • in a catkin workspace' s src, I did the following:
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git 
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git 
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git 
cd .. && catkin_make

ROS env

ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/mnt/d/EnglishStandardPath/Practice_File/P_Intelligent_Robotics/lab4_ws/devel/share/common-lisp
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic

OS env

  • Windows 11

  • wsl2 core

Linux DESKTOP-SPT1P3R 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

2catycm avatar Mar 13 '22 12:03 2catycm

As you can see in the error message, a ros2 foxy is installed on windows but not wsl in C:/opt/ros/foxy by using chocolatey. Bash in wsl does not source the devel/setup.bat, but it seems that CMake in wsl is trying to use the log4cxx contained in foxy.

2catycm avatar Mar 13 '22 12:03 2catycm