If oprofile is configured with CPPFLAGS=-D_GLIBCXX_DEBUG to enable libstdc++ debug mode the build fails with template errors in libpp/xml_utils.cpp. Simply performing a search and replace in that file, replacing "(sym_iterator)0" with "sym_iterator()" fixes the build errors.
At least on my copy of libstdc++, assert((sym_iterator)0 == sym_iterator()) holds. But a default constructed iterator isn't supposed to be used for anything (according to http://stackoverflow.com/a/6955251), so perhaps the code needs some rewrite to avoid using "singular" iterators.
This can replicated on x86_64 fedora 21 with:
$ CPPFLAGS=-D_GLIBCXX_DEBUG ./configure
$ makeMaking all in libpp
This produces a number of errors along the lines of the one below:
make[2]: Entering directory '/home/wcohen/research/profiling/oprofile/oprofile/libpp'
g++ -DHAVE_CONFIG_H -I. -I.. -I ../libop -I ../libutil -I ../libdb -I ../libopt++ -I ../libutil++ -I ../libop++ -I ../libregex -D_GLIBCXX_DEBUG -W -Wall -fno-common -ftemplate-depth-50 -Werror -g -O2 -MT xml_utils.o -MD -MP -MF .deps/xml_utils.Tpo -c -o xml_utils.o xml_utils.cpp
xml_utils.cpp: In function ‘void {anonymous}::dump_symbols(const string&, sym_iterator, sym_iterator)’:
xml_utils.cpp:76:25: error: no matching function for call to ‘gnu_debug::_Safe_iterator<gnu_cxx::normal_iterator<const symbol_entry*="" const*,="" std::__cxx1998::vector<const="" symbol_entry*,="" std::allocator<const="" symbol_entry*=""> > >, std::debug::vector<const symbol_entry*=""> >::_Safe_iterator(int)’
if (b == (sym_iterator)0)
^
xml_utils.cpp:76:25: note: candidates are:
In file included from /usr/include/c++/4.9.2/debug/vector:35:0,
from /usr/include/c++/4.9.2/vector:73,
from ../libutil++/unique_storage.h:15,
from name_storage.h:17,
from symbol.h:16,
from xml_utils.h:14,
from xml_utils.cpp:14:
/usr/include/c++/4.9.2/debug/safe_iterator.h:194:9: note: template<class _MutableIterator=""> gnu_debug::_Safe_iterator<_Iterator, _Sequence>::_Safe_iterator(const gnu_debug::_Safe_iterator<_MutableIterator, typename gnu_cxx::enable_if<std::__are_same<_MutableIterator, typename="" _Sequence::iterator::iterator_type="">::value, _Sequence>::type>&)
_Safe_iterator(
^
/usr/include/c++/4.9.2/debug/safe_iterator.h:194:9: note: template argument deduction/substitution failed: