When building gpgme with slibtool the build fails when building t-revokekey in the lang/qt/tests/ directory with undefined references for QGpgME::RevokeKeyJob::result and QGpgME::RevokeKeyJob::staticMetaObject.
I think this is because they are defined in lang/qt/src/revokekeyjob.moc and t-revokekey never includes this moc header. I tried this, but unfortunately I don't know what I am doing with qt so while the undefined references were resolved, the actual test failed with a segfault.
I am unsure how GNU libtool silently ignores the undefined references in this case. Additionally, this issue only occurs under special circumstances which I also don't quite understand. So far it seems to only occur when updating gpgme and building a working version with GNU libtool will hide the issue even if gpgme is removed from the system and rebuilt.
Any help would be greatly appreciated!
--- a/lang/qt/tests/t-revokekey.cpp +++ b/lang/qt/tests/t-revokekey.cpp @@ -336,3 +336,13 @@ private: QTEST_MAIN(RevokeKeyJobTest) #include "t-revokekey.moc" + +#define make_job_subclass_ext(x,y) \ + QGpgME::x::x( QObject * parent ) : y( parent ) {} \ + QGpgME::x::~x() {} + +#define make_job_subclass(x) make_job_subclass_ext(x,Job) + +make_job_subclass(RevokeKeyJob) + +#include "revokekeyjob.moc"
rdlibtool --tag=CXX --mode=link clang++ -g -O2 -no-install -o t-revokekey t-revokekey.o t-support.o ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la ../../../src/libgpgme.la -lQt5Core -lgpg-error -lQt5Test -lQt5Core -lstdc++ rdlibtool: lconf: {.name="libtool"}. rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/gpgme-1.18.0/lang/qt/tests"}. rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 346600}. rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3. rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 346598}. rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(3,"../",O_DIRECTORY,0) = 4. rdlibtool: lconf: fstat(4,...) = 0 {.st_dev = 45, .st_ino = 346436}. rdlibtool: lconf: openat(4,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(4,"../",O_DIRECTORY,0) = 3. rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 346258}. rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4. rdlibtool: lconf: found "/tmp/gpgme-1.18.0/libtool". rdlibtool: link: clang++ t-revokekey.o t-support.o -g -O2 -L../../cpp/src/.libs -lgpgmepp -L../../cpp/src/../../../src/.libs -lgpgme -L/usr/lib64 -lassuan -lgpg-error -lassuan -L../src/.libs -lqgpgme -L../src/../../cpp/src/.libs -lgpgmepp -L../src/../../cpp/src/../../../src/.libs -lgpgme -lassuan -lgpg-error -L../src/../../../src/.libs -lQt5Core -L../../../src/.libs -lgpgme -lassuan -lgpg-error -lQt5Test -lQt5Core -lstdc++ -o .libs/t-revokekey ld.lld: error: undefined symbol: QGpgME::RevokeKeyJob::result(GpgME::Error const&, QString const&, GpgME::Error const&) >>> referenced by char_traits.h:0 (/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/char_traits.h:0) >>> t-revokekey.o:(RevokeKeyJobTest::testAsync()) ld.lld: error: undefined symbol: QGpgME::RevokeKeyJob::staticMetaObject >>> referenced by qobject.h:343 (/usr/include/qt5/QtCore/qobject.h:343) >>> t-revokekey.o:(RevokeKeyJobTest::testAsync()) clang-14: error: linker command failed with exit code 1 (use -v to see invocation) rdlibtool: exec error upon slbt_exec_link_create_executable(), line 1745: (see child process error messages). rdlibtool: < returned to > slbt_exec_link(), line 2155. make[4]: *** [Makefile:774: t-revokekey] Error 2 make[4]: Leaving directory '/tmp/gpgme-1.18.0/lang/qt/tests' make[3]: *** [Makefile:673: all] Error 2 make[3]: Leaving directory '/tmp/gpgme-1.18.0/lang/qt/tests' make[2]: *** [Makefile:466: all-recursive] Error 1 make[2]: Leaving directory '/tmp/gpgme-1.18.0/lang/qt' make[1]: *** [Makefile:463: all-recursive] Error 1 make[1]: Leaving directory '/tmp/gpgme-1.18.0/lang' make: *** [Makefile:540: all-recursive] Error 1