boostorg / thread

Boost.org thread module
http://boost.org/libs/thread
198 stars 162 forks source link

Build failed on Ubuntu18.04 with armf #284

Closed potato1992 closed 4 years ago

potato1992 commented 5 years ago

Boost version 1.65, 1.70 the same result. Hardware: odroid XU4, armf platform gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04) It seems to be some functions conflict? Build fail, I am using rosbag.h in ros melodic , here is a part of the output:

[ 2%] Building CXX object CMakeFiles/ros_data_collector.dir/src/app/ros_data_collector_svr.cpp.o In file included from /usr/include/boost/thread/locks.hpp:10:0, from /usr/include/boost/thread.hpp:21, from /opt/ros/melodic/include/class_loader/multi_library_class_loader.hpp:35, from /opt/ros/melodic/include/pluginlib/class_loader.hpp:38, from /opt/ros/melodic/include/rosbag/bag.h:65, from /home/odroid/WindowsProjects/C++/ros_data_collector/ros_data_collector/src/app/../include/ros_data_collector_svr.h:7, from /home/odroid/WindowsProjects/C++/ros_data_collector/ros_data_collector/src/app/ros_data_collector_svr.cpp:24: /usr/include/boost/thread/lock_algorithms.hpp:170:43: error: macro "lock" passed 2 arguments, but takes just 1 void lock(MutexType1& m1, MutexType2& m2) ^ /usr/include/boost/thread/lock_algorithms.hpp:176:49: error: macro "lock" passed 2 arguments, but takes just 1 void lock(const MutexType1& m1, MutexType2& m2) ^ /usr/include/boost/thread/lock_algorithms.hpp:182:49: error: macro "lock" passed 2 arguments, but takes just 1 void lock(MutexType1& m1, const MutexType2& m2) ^ /usr/include/boost/thread/lock_algorithms.hpp:188:55: error: macro "lock" passed 2 arguments, but takes just 1 void lock(const MutexType1& m1, const MutexType2& m2) ^ /usr/include/boost/thread/lock_algorithms.hpp:194:59: error: macro "lock" passed 3 arguments, but takes just 1 void lock(MutexType1& m1, MutexType2& m2, MutexType3& m3) ^ /usr/include/boost/thread/lock_algorithms.hpp:221:75: error: macro "lock" passed 4 arguments, but takes just 1 void lock(MutexType1& m1, MutexType2& m2, MutexType3& m3, MutexType4& m4) ^ /usr/include/boost/thread/lock_algorithms.hpp:253:91: error: macro "lock" passed 5 arguments, but takes just 1 void lock(MutexType1& m1, MutexType2& m2, MutexType3& m3, MutexType4& m4, MutexType5& m5) ^ /usr/include/boost/thread/lock_algorithms.hpp:366:31: error: macro "lock" passed 2 arguments, but takes just 1 boost::lock(begin, end); ^ In file included from /usr/include/boost/thread/future.hpp:32:0, from /usr/include/boost/thread.hpp:24, from /opt/ros/melodic/include/class_loader/multi_library_class_loader.hpp:35, from /opt/ros/melodic/include/pluginlib/class_loader.hpp:38, from /opt/ros/melodic/include/rosbag/bag.h:65, from /home/odroid/WindowsProjects/C++/ros_data_collector/ros_data_collector/src/app/../include/ros_data_collector_svr.h:7, from /home/odroid/WindowsProjects/C++/ros_data_collector/ros_data_collector/src/app/ros_data_collector_svr.cpp:24: /usr/include/boost/thread/futures/wait_for_any.hpp:71:55: error: macro "lock" passed 2 arguments, but takes just 1 boost::lock(locks.get(), locks.get() + count);

viboes commented 5 years ago

Please add an issue to the library that is adding a macro called lock.

viboes commented 5 years ago

Any PR with a reasonable solution is welcome. I will not do anything from my side as I don't have access to this platform.

potato1992 commented 4 years ago

Any PR with a reasonable solution is welcome. I will not do anything from my side as I don't have access to this platform.

Hello, I have moved to boost version 1.7.0 and changed every 'lock' inside /usr/local/include/boost/thread/future.hpp /usr/local/include/boost/thread/lock_algorithms.hpp /usr/include/c++/7/mutex /usr/local/include/boost/thread/futures/wait_for_any.hpp /usr/local/include/boost/thread/pthread/threaddata.hpp /usr/local/include/boost/thread/barrier.hpp into 'lock', now it works. It seems that the lock template function declaration and variable definition conflicts with 'lock' from standard C++ library.

potato1992 commented 4 years ago

Any PR with a reasonable solution is welcome. I will not do anything from my side as I don't have access to this platform.

Hello, I have moved to boost version 1.7.0 and changed every 'lock' inside /usr/local/include/boost/thread/future.hpp /usr/local/include/boost/thread/lock_algorithms.hpp /usr/include/c++/7/mutex /usr/local/include/boost/thread/futures/wait_for_any.hpp /usr/local/include/boost/thread/pthread/threaddata.hpp /usr/local/include/boost/thread/barrier.hpp into 'lock', now it works. It seems that the lock template function declaration and variable definition conflicts with 'lock' from standard C++ library.

Same issue on x86 CPU: intel i5 8250u System: ubuntu 18.04 gcc version 7.4.0 boost version: 1.7.0

viboes commented 4 years ago

Renaming lock id not reasonable solution. Truc to do as with min,max and prevent macro substitution.