Opened 12 years ago

Closed 10 years ago

#4999 closed Bugs (fixed)

boost-log from SVN doesn't compile on gcc 4.6

Reported by: sean@… Owned by: Douglas Gregor
Milestone: To Be Determined Component: signals
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: denis.arnaud_boost@…

Description

I'm attempting to use boost-log from SVN with boost 1.45.0 on Darwin w/ gcc 4.6. When I attempt to compile it, the following code:

boost_1_45_0/libs/signals/src/named_slot_map.cpp:94

void named_slot_map::disconnect(const stored_group& name) {

group_iterator group = groups.find(name); if (group != groups.end()) {

slot_pair_iterator i = group->second.begin(); while (i != group->second.end()) {

slot_pair_iterator next = i; ++next; i->first.disconnect(); i = next;

} groups.erase(group);

}

}

Gives me the following error:

darwin.compile.c++ bin.v2/libs/signals/build/darwin-4.6.0/debug/link-static/named_slot_map.o

"/opt/local/bin/g++-mp-4.6" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -gdwarf-2 -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_NO_LIB=1 -I"." -c -o "bin.v2/libs/signals/build/darwin-4.6.0/debug/link-static/named_slot_map.o" "libs/signals/src/named_slot_map.cpp"

In file included from /opt/local/include/gcc46/c++/map:61:0,

from ./boost/signals/detail/named_slot_map.hpp:20, from libs/signals/src/named_slot_map.cpp:12:

/opt/local/include/gcc46/c++/bits/stl_map.h: In member function 'void std::map<_Key, _Tp, _Compare, _Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::iterator) [with _Key = boost::signals::detail::stored_group, _Tp = std::list<boost::signals::detail::connection_slot_pair>, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >]': libs/signals/src/named_slot_map.cpp:105:23: instantiated from here /opt/local/include/gcc46/c++/bits/stl_map.h:626:9: error: call of overloaded 'erase(std::map<boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair>, boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group> >::iterator&)' is ambiguous /opt/local/include/gcc46/c++/bits/stl_map.h:626:9: note: candidates are: /opt/local/include/gcc46/c++/bits/stl_tree.h:763:7: note: void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator) [with _Key = boost::signals::detail::stored_group, _Val = std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> >, _KeyOfValue = std::_Select1st<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >] /opt/local/include/gcc46/c++/bits/stl_tree.h:1490:5: note: std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::erase(const _Key&) [with _Key = boost::signals::detail::stored_group, _Val = std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> >, _KeyOfValue = std::_Select1st<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, _Compare = boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group>, _Alloc = std::allocator<std::pair<const boost::signals::detail::stored_group, std::list<boost::signals::detail::connection_slot_pair> > >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type = long unsigned int]

I also run in to another error:

In file included from libs/log/src/global_logger_storage.cpp:22:0: ./boost/log/utility/type_info_wrapper.hpp: In destructor 'boost::log_st::type_info_wrapper::auto_free::~auto_free()': ./boost/log/utility/type_info_wrapper.hpp:54:31: error: 'free' was not declared in this scope 0.000009 sec system; 0.000043 sec user ...failed updating 1 target...

And can fix this one:

--- /tmp/type_info_wrapper.hpp 2010-12-18 08:21:03.000000000 -0800 +++ obj/contrib-Darwin-i386/boost_1_45_0/boost/log/utility/type_info_wrapper.hpp 2010-12-18 08:21:18.000000000 -0800 @@ -13,6 +13,8 @@

#ifndef BOOST_LOG_UTILITY_TYPE_INFO_WRAPPER_HPP_INCLUDED_ #define BOOST_LOG_UTILITY_TYPE_INFO_WRAPPER_HPP_INCLUDED_

+#include <stdlib.h> +

#include <typeinfo> #include <string> #include <boost/log/detail/prologue.hpp>

@@ -51,7 +53,7 @@

struct auto_free {

explicit auto_free(void* p) : p_(p) {}

  • ~auto_free() { free(p_); }

+ ~auto_free() { ::free(p_); }

private:

void* p_;

};

Exit 1

gcc-mp-4.6 (GCC) 4.6.0 20101211 (experimental)

Attachments (2)

boost-1.46.0-signals-erase.patch (725 bytes ) - added by pmachata@… 12 years ago.
This should fix the problem with the ambiguous erase
fix4999.patch (564 bytes ) - added by Justin SB <justin@…> 11 years ago.
Patch that should work with C++03 and C++0x

Download all attachments as: .zip

Change History (10)

comment:1 by Andrey Semashev, 12 years ago

Component: Building Boostsignals
Owner: changed from Andrey Semashev to Douglas Gregor
  1. The first problem is not related to Boost.Log, I'm reassigning it to Boost.Signals maintainer.
  2. I've fixed the incorrect include in Boost.Log, thanks.
  3. Please, don't post several problems in a single ticket.
  4. Please, don't post Boost.Log problems to Boost Trac yet. This library is not merged into the official distribution and is maintained as a SourceForge project. You can ask for support there.

by pmachata@…, 12 years ago

This should fix the problem with the ambiguous erase

comment:2 by Steven Watanabe, 12 years ago

That patch will break C++03.

comment:3 by Denis Arnaud <denis.arnaud_boost@…>, 12 years ago

Cc: denis.arnaud_boost@… added

by Justin SB <justin@…>, 11 years ago

Attachment: fix4999.patch added

Patch that should work with C++03 and C++0x

comment:4 by Justin SB <justin@…>, 11 years ago

This problem is still present with gcc 4.6 and --std=c++0x; I've attached a patch which is the same as the above patch, but using the "old" cast-syntax that is compatible with --std=c++03.

comment:5 by phst, 10 years ago

This just bit me when trying to compile with Clang and libc++. Apparently this is still not fixed in HEAD?

comment:6 by andrew.c.morrow@…, 10 years ago

I am also encountering this issue when using XCode 4.5 DP2 clang++ to build boost 1.50.0 in C++11 mode. Specifically, it prevents the signals library from building. It would be nice to see this resolved for boost 1.51.

comment:7 by Marshall Clow, 10 years ago

Applied patch in [79575]

comment:8 by Marshall Clow, 10 years ago

Resolution: fixed
Status: newclosed

(In [79709]) Merge changes from [79575] to Release; fixes #4999

Note: See TracTickets for help on using tickets.