pinentry 0.9.5 fails with g++ 5 : unrestricted unions only available with -std=++11 or -std=gnu++11

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Aug 5 08:17:43 CEST 2015


hi folks--

debian unstable is switching to gcc 5 as the default compiler.

Trying to build pinentry 0.9.5 with gcc 5.2.1, i see this error:

g++ -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/libsecret-1 -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include     -I.. -I../secmem -I/usr/include/ncursesw -I../pinentry -D_FORTIFY_SOURCE=2 -Wall -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtCore  -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/qt4/QtCore  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -c -o pinentrydialog.o pinentrydialog.cpp
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/qt4/QtCore/qstring.h:54,
                 from /usr/include/qt4/QtCore/qobject.h:48,
                 from /usr/include/qt4/QtGui/qwidget.h:47,
                 from /usr/include/qt4/QtGui/qdialog.h:45,
                 from /usr/include/qt4/QtGui/QDialog:1,
                 from pinentrydialog.h:27,
                 from pinentrydialog.cpp:24:
/usr/include/c++/5/bits/basic_string.h: In instantiation of 'union std::__cxx11::basic_string<QChar, std::char_traits<QChar>, secmem::alloc<QChar> >::<anonymous>':
/usr/include/c++/5/bits/basic_string.h:119:7:   required from 'class std::__cxx11::basic_string<QChar, std::char_traits<QChar>, secmem::alloc<QChar> >'
secstring.h:37:1:   required from here
/usr/include/c++/5/bits/basic_string.h:121:53: error: member 'QChar std::__cxx11::basic_string<QChar, std::char_traits<QChar>, secmem::alloc<QChar> >::<anonymous union>::_M_local_buf [8]' with constructor not allowed in union
  _CharT           _M_local_buf[_S_local_capacity + 1];
                                                     ^
/usr/include/c++/5/bits/basic_string.h:121:53: note: unrestricted unions only available with -std=c++11 or -std=gnu++11
make[4]: *** [pinentrydialog.o] Error 1
Makefile:475: recipe for target 'pinentrydialog.o' failed

You can see more of these logs here:

 https://buildd.debian.org/status/logs.php?pkg=pinentry&ver=0.9.5-3

I haven't tried to build from git master yet.  maybe the removal of the
custom textentry field will remove this concern?  or should i be adding
-std=c++11 to the CFLAGS?

Someone posted a brief explanation of the error message on stackoverflow:

 https://stackoverflow.com/questions/5548636/what-are-unrestricted-unions-proposed-in-c11

   --dkg



More information about the Gnupg-devel mailing list