Page MenuHome GnuPG

pinentry Qt4 frontend broken with libc++
Closed, ResolvedPublic

Description

pinentry's Qt4 frontend doesn't compile on systems using libc++ (for instance
current releases of OS X.)

The problem at hand is that secqstring is defined as a std::basic_string with
CharT QChar.
libc++ has a static_assert in std::basic_string to ensure that the char type
given is POD (plain old data.)
libstdc++ does not, this is why the code is working there.

Unfortunately, secqstring is widely used within the code and can't be easily
replaced.

Any idea what to do, short of rewriting the whole Qt4 frontend?

Log:

snip

/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../assuan -I../secmem
-I/opt/local/include/ncurses -I../pinentry -I/opt/local/include -Wall
-DQT_SHARED -I/opt/local/include -I/opt/local/include/QtCore -DQT_SHARED
-I/opt/local/include -I/opt/local/include/QtGui -I/opt/local/include
-I/opt/local/include/QtCore -pipe -Os -stdlib=libc++ -arch x86_64 -MT
pinentrydialog.o -MD -MP -MF .deps/pinentrydialog.Tpo -c -o pinentrydialog.o
pinentrydialog.cpp
In file included from pinentrydialog.cpp:24:
In file included from ./pinentrydialog.h:27:
In file included from /opt/local/include/QtGui/QDialog:1:
In file included from /opt/local/include/QtGui/qdialog.h:45:
In file included from /opt/local/include/QtGui/qwidget.h:47:
In file included from /opt/local/include/QtCore/qobject.h:48:
In file included from /opt/local/include/QtCore/qstring.h:54:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1187:5:
error: implicit instantiation of undefined template '__static_assert_test<false>'

static_assert(is_pod<value_type>::value, "Character type of basic_string

must be a POD");

^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:498:35:
note: expanded from macro 'static_assert'

typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
                              ^

./secstring.h:37:1: note: in instantiation of template class
'std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >' requested here
Q_DECLARE_METATYPE( secqstring )
^
/opt/local/include/QtCore/qmetatype.h:275:35: note: expanded from macro
'Q_DECLARE_METATYPE'

metatype_id = qRegisterMetaType< TYPE >(#TYPE,      \
              ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:494:24:
note: template is declared here
template <bool> struct __static_assert_test;

^

In file included from pinentrydialog.cpp:24:
In file included from ./pinentrydialog.h:27:
In file included from /opt/local/include/QtGui/QDialog:1:
In file included from /opt/local/include/QtGui/qdialog.h:45:
In file included from /opt/local/include/QtGui/qwidget.h:47:
In file included from /opt/local/include/QtCore/qobject.h:48:
In file included from /opt/local/include/QtCore/qstring.h:54:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1259:24:
error: union member '__lx' has a non-trivial constructor

value_type __lx;
           ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1256:9:
note: in instantiation of member class 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__short::<anonymous union
at
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1256:9>'
requested here

union
^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1266:38:
note: in instantiation of member class 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__short' requested here

union __ulx{__long __lx; __short __lxx;};
                                 ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1268:23:
note: in instantiation of member class 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__ulx' requested here

enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
                  ^

./secstring.h:37:1: note: in instantiation of template class
'std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >' requested here
Q_DECLARE_METATYPE( secqstring )
^
/opt/local/include/QtCore/qmetatype.h:275:35: note: expanded from macro
'Q_DECLARE_METATYPE'

metatype_id = qRegisterMetaType< TYPE >(#TYPE,      \
              ^

/opt/local/include/QtCore/qchar.h:74:5: note: because type 'QChar' has a
user-provided default constructor

QChar();
^

In file included from pinentrydialog.cpp:24:
In file included from ./pinentrydialog.h:27:
In file included from /opt/local/include/QtGui/QDialog:1:
In file included from /opt/local/include/QtGui/qdialog.h:45:
In file included from /opt/local/include/QtGui/qwidget.h:46:
In file included from /opt/local/include/QtGui/qwindowdefs.h:45:
In file included from /opt/local/include/QtCore/qobjectdefs.h:45:
In file included from /opt/local/include/QtCore/qnamespace.h:45:
In file included from /opt/local/include/QtCore/qglobal.h:68:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:627:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1903:55:
error: no member named 'value' in
'std::1::is_empty<std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >::
rep>'

bool = is_empty<_T1>::value
       ~~~~~~~~~~~~~~~^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1930:44:
note: in instantiation of default argument for
'libcpp_compressed_pair_switch<std::1::basic_string<QChar,
std::1::char_traits<QChar>, secmem::alloc<QChar> >::rep,
secmem::alloc<QChar>, false>' required here
template <class _T1, class _T2, unsigned = __libcpp_compressed_pair_switch<_T1,
_T2>::value>

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2300:13:
note: in instantiation of default argument for
'libcpp_compressed_pair_imp<std::1::basic_string<QChar,
std::1::char_traits<QChar>, secmem::alloc<QChar> >::rep,
secmem::alloc<QChar> >' required here

typedef __libcpp_compressed_pair_imp<_T1, _T2> base;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1285:46:
note: in instantiation of template class
'std::1::compressed_pair<std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__rep,
secmem::alloc<QChar> >' requested here

__compressed_pair<__rep, allocator_type> __r_;
                                         ^

./secstring.h:37:1: note: in instantiation of template class
'std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >' requested here
Q_DECLARE_METATYPE( secqstring )
^
/opt/local/include/QtCore/qmetatype.h:275:35: note: expanded from macro
'Q_DECLARE_METATYPE'

metatype_id = qRegisterMetaType< TYPE >(#TYPE,      \
              ^

In file included from pinentrydialog.cpp:24:
In file included from ./pinentrydialog.h:27:
In file included from /opt/local/include/QtGui/QDialog:1:
In file included from /opt/local/include/QtGui/qdialog.h:45:
In file included from /opt/local/include/QtGui/qwidget.h:46:
In file included from /opt/local/include/QtGui/qwindowdefs.h:45:
In file included from /opt/local/include/QtCore/qobjectdefs.h:45:
In file included from /opt/local/include/QtCore/qnamespace.h:45:
In file included from /opt/local/include/QtCore/qglobal.h:68:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:627:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2314:40:
error: multiple overloads of '__compressed_pair' instantiate to the same
signature 'void (_T2_param)'

_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
                                   ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1285:46:
note: in instantiation of template class
'std::1::compressed_pair<std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__rep,
secmem::alloc<QChar> >' requested here

__compressed_pair<__rep, allocator_type> __r_;
                                         ^

./secstring.h:37:1: note: in instantiation of template class
'std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >' requested here
Q_DECLARE_METATYPE( secqstring )
^
/opt/local/include/QtCore/qmetatype.h:275:35: note: expanded from macro
'Q_DECLARE_METATYPE'

metatype_id = qRegisterMetaType< TYPE >(#TYPE,      \
              ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2312:40:
note: previous declaration is here

_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
                                   ^

In file included from pinentrydialog.cpp:24:
In file included from ./pinentrydialog.h:27:
In file included from /opt/local/include/QtGui/QDialog:1:
In file included from /opt/local/include/QtGui/qdialog.h:45:
In file included from /opt/local/include/QtGui/qwidget.h:47:
In file included from /opt/local/include/QtCore/qobject.h:48:
In file included from /opt/local/include/QtCore/qstring.h:54:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2255:9:
error: cannot initialize object parameter of type 'const
std::1::basic_string_common<true>' with an expression of type
'std::1::basic_string<QChar, std::1::char_traits<QChar>, secmem::alloc<QChar> >'

this->__throw_length_error();
^~~~

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2327:9:
note: in instantiation of member function 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::__grow_by_and_replace'
requested here

__grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s);
^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2471:12:
note: in instantiation of member function 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::assign' requested here

return assign(__str.data(), __str.size());
       ^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2379:9:
note: in instantiation of member function 'std::1::basic_string<QChar,
std::
1::char_traits<QChar>, secmem::alloc<QChar> >::assign' requested here

assign(__str);
^

./pinentrydialog.moc:106:53: note: in instantiation of member function
'std::1::basic_string<QChar, std::1::char_traits<QChar>,
secmem::alloc<QChar> >::operator=' requested here

case 2: *reinterpret_cast< secqstring*>(_v) = pin(); break;
                                            ^

5 errors generated.
make[3]: * [pinentrydialog.o] Error 1
make[3]: Leaving directory
`/opt/local/var/macports/build/_opt_macports_security_pinentry/pinentry/work/pinentry-0.9.0/qt4'
make[2]:
* [all] Error 2
make[2]: Leaving directory
`/opt/local/var/macports/build/_opt_macports_security_pinentry/pinentry/work/pinentry-0.9.0/qt4'
make[1]: * [all-recursive] Error 1
make[1]: Leaving directory
`/opt/local/var/macports/build/_opt_macports_security_pinentry/pinentry/work/pinentry-0.9.0'
make:
* [all] Error 2
make: Leaving directory
`/opt/local/var/macports/build/_opt_macports_security_pinentry/pinentry/work/pinentry-0.9.0'
Command failed: cd
"/opt/local/var/macports/build/_opt_macports_security_pinentry/pinentry/work/pinentry-0.9.0"
&& /usr/bin/make -w all

snip

Details

Version
0.9.0

Event Timeline

Ionic set Version to 0.9.0.
Ionic added a subscriber: Ionic.

Does this still happen with 0.9.1 or 0.9.2 which will be released later the day.

Unfortunately, yes. Still happening with 0.9.2.

I am pretty sure this should be fixed with the current master version of pinentry.

This version does no longer use the std::string stuff as it uses the usual qt
widgets.

Feel free to reopen this bug but I am so sure about it that I'll mark it as
resolved now :-)

aheinecke claimed this task.

Thanks. I can confirm the issue being fixed, although I have only tested with
Qt4 (which this bug report is against, anyway.)

I probably need to get hacking on pinentry again, though, because your latest
changes do not allow explicit selection of Qt4 xor Qt5 and thus lead to
non-reproducible builds...

An option to explicitly disable qt5 was added as part of T2105