|
Boost : |
Subject: Re: [boost] Problem with debug Boost, Mac OS X and g++ 4.6
From: Christopher Jefferson (chris_at_[hidden])
Date: 2011-03-31 03:08:46
On 30 Mar 2011, at 23:48, John Wiegley wrote:
> I'm not sure yet whether this is a Boost issue, or a g++ 4.6 issue. I've
> compiled Boost 1.46.1 on Mac OS X using g++ 4.6 and these build options:
>
> sh bootstrap.sh && ./bjam debug \
> --toolset=darwin --build-type=complete --layout=versioned \
> define=_GLIBCXX_FULLY_DYNAMIC_STRING=1 define=_GLIBCXX_DEBUG=1 \
> install
Did you build g++ with _GLIBCXX_FULLY_DYNAMIC_STRING? Or are you sure where it is picking up it's standard library from?
My suspicion is that you are hitting the (which you seem to know about) _GLIBCXX_DEBUG and std::string bug in Mac OS X. Unfortunately I don't have a good answer on how to avoid it, I have tried various workarounds, but I always seem to end up getting bitten in the end.
>
> Then I build and execute the following example code:
>
> #include <boost/regex.hpp>
> #include <string>
>
> int main(int argc, char *argv[]) {
> boost::regex expr("foo.*bar");
> return boost::regex_search(std::string(argv[1]), expr) ? 0 : 1;
> }
>
> with this compile/link command:
>
> g++-mp-4.6 -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 -D_GLIBCXX_DEBUG=1 \
> -g -o regex regex.cc -lboost_regex-xgcc46-d-1_46_1
>
> and the result is:
>
> terminate called after throwing an instance of 'std::bad_cast'
> what(): std::bad_cast
>
> This is happening in boost::re_detail::cpp_regex_traits_base<char>::imbue, on
> line cpp_regex_traits.hpp:218.
>
> The same everything, using g++ 4.5, works fine, so maybe this is a g++ 4.6
> bug? I seem to recall having seen this problem before, due to mismatching a
> debug Boost with a non-debug client app, or something similar. But I've have
> verified that my client app is using the same flags that I build Boost with.
>
> Has anyone run into this? Do I need to take this bug to the g++ folks? Any
> pointers, ideas?
>
> Thanks,
> John
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk