[OE-core] c++11 support in OE's gcc 5.x toolchain

Andre McCurdy armccurdy at gmail.com
Mon Jan 25 23:42:10 UTC 2016


I'm seeing an error when trying to compile the string::append example
from cplusplus.com (
http://www.cplusplus.com/reference/string/string/append ) with the
oe-core gcc 5.3 / glibc toolchain and -std=c++11. Log below.

The problem seems to be related to the new libstdc++ dual ABI
introduced in GCC 5.1:

  https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

If I use -std=c++11 together with -D_GLIBCXX_USE_CXX11_ABI=0 to force
the old ABI then the test app compiles OK.

Do we perhaps need to do something different when building libstdc++
to enable the new ABI?

----

  i686-rdk-linux-g++ -m32 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/.../tmp/sysroots/vbox32 -std=c++11 test.cpp
  test.cpp: In function 'int main()':
  test.cpp:18:25: error: no matching function for call to
'std::__cxx11::basic_string<char>::append(int, int)'
     str.append<int>(5,0x2E);                // "....."
                           ^
  In file included from
/.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/string:52:0,
                   from
/.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/bits/locale_classes.h:40,
                   from
/.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/bits/ios_base.h:41,
                   from /.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/ios:42,
                   from
/.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/ostream:38,
                   from
/.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/iostream:39,
                   from test.cpp:2:
  /.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/bits/basic_string.h:1071:9:
note: candidate: template<class _InputIterator, class>
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::append(_InputIterator, _InputIterator) [with _InputIterator =
_InputIterator; <template-parameter-2-2> = <template-parameter-1-2>;
_CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]
           append(_InputIterator __first, _InputIterator __last)
           ^
  /.../tmp/sysroots/vbox32/usr/include/c++/5.3.0/bits/basic_string.h:1071:9:
note:   template argument deduction/substitution failed:

----



More information about the Openembedded-core mailing list