Skip to contentSkip to conversation

New: Cannot build with -std=c++11

Buildroot bugzilla at busybox.net 1 participant 13 messages Jun 30, 2014 – Aug 17, 2014

lore
Share & tools
lore
#0 lore raw

https://bugs.busybox.net/show_bug.cgi?id=7250

Summary: Cannot build with -std=c++11
Product: buildroot
Version: 2014.05
Platform: PC
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Other
AssignedTo: unassigned at buildroot.uclibc.org
ReportedBy: tarka.t.otter at gmail.com
CC: buildroot at uclibc.org
Estimated Hours: 0.0

Created attachment 5468
--> https://bugs.busybox.net/attachment.cgi?id=5468
c++11 test case

After building a buildroot toolchain based on GCC 4.8.3, it does not seem possible to build any packages that require C++11 support.

Attached is a simple test case that compiles fine on my host machine with GCC 4.8.2 with -std=c+11, but fails to compile using the cross toolchain with the same flag.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#1 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #1 from Richard <[email protected]> 2014-06-30 21:05:41 UTC --- Created attachment 5474
--> https://bugs.busybox.net/attachment.cgi?id=5474
Toolchain .config

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#2 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

Yann E. MORIN <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |yann.morin.1998 at free.fr

--- Comment #2 from Yann E. MORIN <[email protected]> 2014-06-30 21:13:55 UTC --- Confirmed:

- with a host gcc-4.8.3, this compiles fine:

      $ g++ -std=c++11 -c -o 5468.o 5468.cxx
  - with a crosstool-NG armv6 toolchain, compiles OK:
      $ armv6-rpi-linux-gnueabihf-g++ -std=c++11 -c -o 5468.o 5468.cxx
  - but fails with the Buildroot-built toolchain using gcc-4.8.3:
      $ arm-buildroot-linux-uclibcgnueabihf-g++ -std=c++11 -c -o 5468.o
5468.cxx
      ess.cxx: In function ?int main()?:
      ess.cxx:5:5: error: ?to_string? is not a member of ?std?
           std::to_string(0);
           ^

C++ expert, anyone? ;-)

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#3 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

Thomas Petazzoni <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at buildroot.uclibc |thomas.petazzoni at free-elect
|.org |rons.com

--- Comment #3 from Thomas Petazzoni <[email protected]> 2014-06-30 21:52:38 UTC --- Thanks for the report. I'll try to have a look.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#4 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #4 from Thomas Petazzoni <[email protected]> 2014-07-01 18:47:48 UTC --- Basically, you're affected by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393.

uClibc does not implement C99 complex number computations (functions such as ccosf) and therefore libstdc++ concludes that there is no fully functional C99 support, and therefore it doesn't enable std::to_string() and many other methods.

When building with uClibc:

configure:16721: checking for ISO C99 support in <complex.h>
[...]
/tmp/cc2ksPYJ.o: In function `main':
/home/test/outputs/arm-uclibc/build/host-gcc-final-4.8.3/build/arm-buildroot-linux-uclibcgnueabihf/libstdc++-v3/conftest.cpp:49:
undefined reference to `ccosf' /home/test/outputs/arm-uclibc/build/host-gcc-final-4.8.3/build/arm-buildroot-linux-uclibcgnueabihf/libstdc++-v3/conftest.cpp:50:
undefined reference to `ccoshf'
[...]
configure:16861: result: no
configure:17182: checking for fully enabled ISO C99 support
configure:17184: result: no

When building with glibc:

configure:17182: checking for fully enabled ISO C99 support configure:17184: result: yes

And the std::to_string method is wrapped into a C99 conditional:

#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
     && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))

#include <ext/string_conversions.h>

namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
[...]
inline string
to_string(int __val)
{ return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),

                                           "%d", __val); }

So, for an immediate solution, use glibc. I'll try to see if we can integrate the patch proposed in the bug report.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#5 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #5 from Thomas Petazzoni <[email protected]> 2014-07-07 21:34:49 UTC --- Created attachment 5498
--> https://bugs.busybox.net/attachment.cgi?id=5498
gcc patch

Could you put this patch in package/gcc/4.8.3/ in the Buildroot sources, rebuild the toolchain, and try again? Here it seems to fix the problem. It would be good if you could also test the runtime execution of the program. Thanks!

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#6 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

Thomas Petazzoni <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

   Attachment #5498|0                           |1

is obsolete| |

--- Comment #6 from Thomas Petazzoni <[email protected]> 2014-07-08 21:06:57 UTC --- Created attachment 5510
--> https://bugs.busybox.net/attachment.cgi?id=5510
Patch to fix the issue for gcc 4.8

This time, here is a Buildroot patch that fixes the issue. Could you test it? I'm currently build-testing it (and similar patches for gcc 4.7 and 4.9) with gcc4.7/uclibc, gcc4.8/uclibc, gcc4.9/uclibc and gcc4.8/glibc.

Thanks!

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#7 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #7 from Richard <[email protected]> 2014-07-09 17:50:44 UTC --- Hey,

yeah, that patch works for me, package builds and runs fine.

Thanks all,,

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#8 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #8 from Thomas De Schampheleire <[email protected]> 2014-08-09 15:23:13 UTC --- Thomas, has this patch already been sent to the list? I guess we should fix
this in 2014.08?

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#9 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #9 from Thomas Petazzoni <[email protected]> 2014-08-09 15:49:28 UTC --- Not yet, because the same patch needs to be made for gcc 4.7, 4.8, 4.9 and the special ARC version. I've already done that, and started building toolchains
with those various gcc versions. But it takes some time, and I was busy with
the maintenance. Now that Peter has taken over the maintenance, I'll focus on
bug fixes, and I know I have this bug, and the one related to musl patches to
fix. Those are my top priorities issues to fix for 2014.08.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#11 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

--- Comment #11 from Thomas Petazzoni <[email protected]> 2014-08-13 17:52:02 UTC --- Patch series sent at
http://lists.busybox.net/pipermail/buildroot/2014-August/104150.html.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#12 lore raw

[Buildroot] [Bug 7250] Cannot build with -std=c++11

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=7250

Peter Korsgaard <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #12 from Peter Korsgaard <[email protected]> 2014-08-17 07:44:45 UTC --- Patch series has now been applied:

http://git.buildroot.net/buildroot/commit/?id=48f182ece057b8dedf72a0c601310d72b3d91a86

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.