luigirizzo / netmap

Automatically exported from code.google.com/p/netmap
BSD 2-Clause "Simplified" License
1.86k stars 537 forks source link

Conflict with Boost Threads, patch provided #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, folks!

You use macro define which conflicts with Boost Threads library because you use 
D() name which already used in Boost Threads.

I got follow error:
g++ netmap.cpp -I/usr/src/fastnetmon/tests/netmap_includes -lthread
In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:32:0,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:10,
                 from /usr/include/boost/thread/thread.hpp:17,
                 from /usr/include/boost/thread.hpp:13,
                 from netmap.cpp:8:
/usr/include/boost/smart_ptr/detail/shared_count.hpp: In constructor 
‘boost::detail::shared_count::shared_count(P, 
boost::detail::sp_inplace_tag<D>)’:
/usr/include/boost/smart_ptr/detail/shared_count.hpp:164:16: error: expected 
‘;’ before ‘(’ token
/usr/include/boost/smart_ptr/detail/shared_count.hpp: In constructor 
‘boost::detail::shared_count::shared_count(P, 
boost::detail::sp_inplace_tag<D>, A)’:
/usr/include/boost/smart_ptr/detail/shared_count.hpp:250:16: error: expected 
‘;’ before ‘(’ token

I prepared patch for fixing this issue. Please apply it: 
https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/patches/0001-
Fix-netmap-code-for-compatibility-with-C-boost.patch

Original issue reported on code.google.com by pavel.odintsov on 2 Mar 2015 at 12:56

pavel-odintsov commented 9 years ago

Any news? Folks it's really important for me :(

pavel-odintsov commented 9 years ago

Looks fixed in recent Git version! Close it :)

pavel-odintsov commented 8 years ago

Actually we have asme issue.

I've using Boost 1.60 with Netmap and somewhere in Boost D() uses for debugging.

So it conflicts with Netmap.

In file included from /root/fastnetmon/src/sflow_agent/sflow_agent.cpp:8:0:
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp: In constructor ‘boost::move_upd::unique_ptr_data<P, D, false>::unique_ptr_data()’:
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected identifier before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:133:9: note: in expansion of macro ‘D’
       : D(), m_p()
         ^
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected ‘{’ before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:133:9: note: in expansion of macro ‘D’
       : D(), m_p()
         ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp: In constructor ‘boost::move_upd::unique_ptr_data<P, D, false>::unique_ptr_data(P)’:
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected identifier before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:137:9: note: in expansion of macro ‘D’
       : D(), m_p(p)
         ^
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected ‘{’ before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:137:9: note: in expansion of macro ‘D’
       : D(), m_p(p)
         ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp: In constructor ‘boost::move_upd::unique_ptr_data<P, D, false>::unique_ptr_data(P, boost::move_upd::unique_ptr_data<P, D, false>::deleter_arg_type1)’:
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected identifier before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:141:9: note: in expansion of macro ‘D’
       : D(d1), m_p(p)
         ^
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected ‘{’ before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:141:9: note: in expansion of macro ‘D’
       : D(d1), m_p(p)
         ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp: In constructor ‘boost::move_upd::unique_ptr_data<P, D, false>::unique_ptr_data(P, U&&)’:
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected identifier before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:146:9: note: in expansion of macro ‘D’
       : D(::boost::forward<U>(d)), m_p(p)
         ^
/opt/dps/libraries/netmap_git_d83f5e6e2d7b9a90e1ac1977e6d26a704f4e5264/include/net/netmap_user.h:174:2: error: expected ‘{’ before ‘do’
  do {       \
  ^
/opt/dps/libraries/boost_1_60_0/boost/move/unique_ptr.hpp:146:9: note: in expansion of macro ‘D’
       : D(::boost::forward<U>(d)), m_p(p)
         ^
make[2]: *** [CMakeFiles/sflow_agent.dir/sflow_agent/sflow_agent.cpp.o] Error 1

Could you replace D() define by NETMAP_DEBUG for identifier uniqueness and preventing similar issues in future?