diff mbox

pinentry: fix build issue with gcc 5.x

Message ID 1471701636-30275-1-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni Aug. 20, 2016, 2 p.m. UTC
pinentry currently fails to build with gcc 5.x, because it uses some
functionality from std::string that requires C++11 without passing the
appropriate -std= value. We fix this by passing a proper -std= option
when gcc >= 5.x. Note that this can be removed once pinentry is bumped
to the newest version (currently 0.9.7) because they no longer use
std::string in the Qt part.

Fixes:

  http://autobuild.buildroot.net/results/6ea64f692acaebc4d58f3371c632b5121500f17e/
  (and many, many similar build failures)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
One-beer-granted-to: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/pinentry/pinentry.mk | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Yann E. MORIN Aug. 20, 2016, 2:10 p.m. UTC | #1
On 2016-08-20 16:00 +0200, Thomas Petazzoni spake thusly:
> pinentry currently fails to build with gcc 5.x, because it uses some
> functionality from std::string that requires C++11 without passing the
> appropriate -std= value. We fix this by passing a proper -std= option
> when gcc >= 5.x. Note that this can be removed once pinentry is bumped
> to the newest version (currently 0.9.7) because they no longer use
> std::string in the Qt part.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/6ea64f692acaebc4d58f3371c632b5121500f17e/
>   (and many, many similar build failures)
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> One-beer-granted-to: Yann E. MORIN <yann.morin.1998@free.fr>

So be it, then! ;-)

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/pinentry/pinentry.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/package/pinentry/pinentry.mk b/package/pinentry/pinentry.mk
> index 09a7705..bcb910a 100644
> --- a/package/pinentry/pinentry.mk
> +++ b/package/pinentry/pinentry.mk
> @@ -14,6 +14,13 @@ PINENTRY_DEPENDENCIES = \
>  	host-pkgconf
>  PINENTRY_CONF_OPTS += --without-libcap       # requires PAM
>  
> +# pinentry uses some std::string functionality that needs C++11
> +# support when gcc >= 5.x. This should be removed when bumping
> +# pinentry, since newer versions no longer use std::string.
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),y)
> +PINENTRY_CONF_ENV = CXXFLAGS="$(TARGET_CXXFLAGS) -std=gnu++11"
> +endif
> +
>  # build with X if available
>  ifeq ($(BR2_PACKAGE_XORG7),y)
>  PINENTRY_CONF_OPTS += --with-x
> -- 
> 2.7.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Khem Raj Aug. 20, 2016, 8:19 p.m. UTC | #2
> On Aug 20, 2016, at 7:00 AM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
> 
> pinentry currently fails to build with gcc 5.x, because it uses some
> functionality from std::string that requires C++11 without passing the
> appropriate -std= value. We fix this by passing a proper -std= option
> when gcc >= 5.x. Note that this can be removed once pinentry is bumped
> to the newest version (currently 0.9.7) because they no longer use
> std::string in the Qt part.
> 
> Fixes:
> 
>  http://autobuild.buildroot.net/results/6ea64f692acaebc4d58f3371c632b5121500f17e/
>  (and many, many similar build failures)
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> One-beer-granted-to: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
> package/pinentry/pinentry.mk | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/package/pinentry/pinentry.mk b/package/pinentry/pinentry.mk
> index 09a7705..bcb910a 100644
> --- a/package/pinentry/pinentry.mk
> +++ b/package/pinentry/pinentry.mk
> @@ -14,6 +14,13 @@ PINENTRY_DEPENDENCIES = \
> 	host-pkgconf
> PINENTRY_CONF_OPTS += --without-libcap       # requires PAM
> 
> +# pinentry uses some std::string functionality that needs C++11
> +# support when gcc >= 5.x. This should be removed when bumping
> +# pinentry, since newer versions no longer use std::string.
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),y)
> +PINENTRY_CONF_ENV = CXXFLAGS="$(TARGET_CXXFLAGS) -std=gnu++11"
> +endif

Should this package be restricted to gcc5 and newer only, I assume
it will break with gcc 4.x too and c++11 may not be there, gcc5 atleast
has the support its just not default

> +
> # build with X if available
> ifeq ($(BR2_PACKAGE_XORG7),y)
> PINENTRY_CONF_OPTS += --with-x
> --
> 2.7.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Aug. 20, 2016, 8:27 p.m. UTC | #3
Hello,

On Sat, 20 Aug 2016 13:19:02 -0700, Khem Raj wrote:

> > +# pinentry uses some std::string functionality that needs C++11
> > +# support when gcc >= 5.x. This should be removed when bumping
> > +# pinentry, since newer versions no longer use std::string.
> > +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),y)
> > +PINENTRY_CONF_ENV = CXXFLAGS="$(TARGET_CXXFLAGS) -std=gnu++11"
> > +endif  
> 
> Should this package be restricted to gcc5 and newer only, I assume
> it will break with gcc 4.x too and c++11 may not be there, gcc5 atleast
> has the support its just not default

We have lots of gcc 4.x toolchains, and we haven't had any build
failure. I believe it builds fine with gcc 4.x.

The code requiring C++11 that causes the build failure with gcc 5.x is
in libstdc++ itself. As I discussed with Yann on IRC, I don't really
understand why some code in libstdc++ uses C++11, without gcc 5.x
defaulting to C++11.

Maybe you have a clue?

Thanks,

Thomas
Thomas Petazzoni Aug. 20, 2016, 8:40 p.m. UTC | #4
Hello,

On Sat, 20 Aug 2016 16:00:36 +0200, Thomas Petazzoni wrote:
> pinentry currently fails to build with gcc 5.x, because it uses some
> functionality from std::string that requires C++11 without passing the
> appropriate -std= value. We fix this by passing a proper -std= option
> when gcc >= 5.x. Note that this can be removed once pinentry is bumped
> to the newest version (currently 0.9.7) because they no longer use
> std::string in the Qt part.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/6ea64f692acaebc4d58f3371c632b5121500f17e/
>   (and many, many similar build failures)
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> One-beer-granted-to: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  package/pinentry/pinentry.mk | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied to master, thanks.

Thomas
Khem Raj Aug. 20, 2016, 8:52 p.m. UTC | #5
> On Aug 20, 2016, at 1:27 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
> 
> Hello,
> 
> On Sat, 20 Aug 2016 13:19:02 -0700, Khem Raj wrote:
> 
>>> +# pinentry uses some std::string functionality that needs C++11
>>> +# support when gcc >= 5.x. This should be removed when bumping
>>> +# pinentry, since newer versions no longer use std::string.
>>> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),y)
>>> +PINENTRY_CONF_ENV = CXXFLAGS="$(TARGET_CXXFLAGS) -std=gnu++11"
>>> +endif
>> 
>> Should this package be restricted to gcc5 and newer only, I assume
>> it will break with gcc 4.x too and c++11 may not be there, gcc5 atleast
>> has the support its just not default
> 
> We have lots of gcc 4.x toolchains, and we haven't had any build
> failure. I believe it builds fine with gcc 4.x.
> 
> The code requiring C++11 that causes the build failure with gcc 5.x is
> in libstdc++ itself. As I discussed with Yann on IRC, I don't really
> understand why some code in libstdc++ uses C++11, without gcc 5.x
> defaulting to C++11.
> 
> Maybe you have a clue?


it could be due to dual ABI in libstdc++ may be passing _GLIBCXX_USE_CXX11_ABI=0
is enough for such apps.

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

for further reading.

You could also configure your libstdc++ to default to old ABI but I would not
recommend that.
diff mbox

Patch

diff --git a/package/pinentry/pinentry.mk b/package/pinentry/pinentry.mk
index 09a7705..bcb910a 100644
--- a/package/pinentry/pinentry.mk
+++ b/package/pinentry/pinentry.mk
@@ -14,6 +14,13 @@  PINENTRY_DEPENDENCIES = \
 	host-pkgconf
 PINENTRY_CONF_OPTS += --without-libcap       # requires PAM
 
+# pinentry uses some std::string functionality that needs C++11
+# support when gcc >= 5.x. This should be removed when bumping
+# pinentry, since newer versions no longer use std::string.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),y)
+PINENTRY_CONF_ENV = CXXFLAGS="$(TARGET_CXXFLAGS) -std=gnu++11"
+endif
+
 # build with X if available
 ifeq ($(BR2_PACKAGE_XORG7),y)
 PINENTRY_CONF_OPTS += --with-x