Page MenuHome GnuPG

gpgme-1.22.0 fails to compile tests (when building in source tree)
Closed, ResolvedPublic


Configured with `./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/gpgme-1.22.0 --htmldir=/usr/share/doc/gpgme-1.22.0/html --with-sysroot=/ --libdir=/usr/lib64 --enable-
languages=cpp qt5 --disable-static`

x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../conf  -I../../../lang/cpp/src -I../../../src -DQT_CORE_LIB -I/usr/include/qt5/QtCore -I/usr/include/qt5  -fpic -fvisibility=hidden -DQT_TESTLI
B_LIB -I/usr/include/qt5/QtTest -I/usr/include/qt5 -DQT_CORE_LIB -I/usr/include/qt5/QtCore  -DBUILDING_QGPGME -I../../../lang/qt/src -DTOP_SRCDIR="../../.." -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE
FILE64_SOURCE  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type  -ggdb3 -c -o run-importjob.o run-importjob.cpp
run-importjob.cpp: In function ‘int main(int, char**)’:
run-importjob.cpp:93:60: error: ‘toLogString’ is not a member of ‘QGpgME’
   93 |     for (const auto &line : QString::fromStdString(QGpgME::toLogString(result)).split('\n')) {
      |                                                            ^~~~~~~~~~~
make[5]: *** [Makefile:1038: run-importjob.o] Error 1
make[5]: Leaving directory '/var/tmp/portage/app-crypt/gpgme-1.22.0/work/gpgme-1.22.0/lang/qt/tests'
make[5]: *** Waiting for unfinished jobs....



Event Timeline

This happens because you build in the source directory and therefore the wrong debug.h is found. While this should work in general we strongly suggest to use a separate build directory.

The following patch fixes this (for me):

diff --git a/lang/qt/tests/ b/lang/qt/tests/
index 32ad6466..aedd3264 100644
--- a/lang/qt/tests/
+++ b/lang/qt/tests/
@@ -51,10 +51,10 @@ LDADD = ../../cpp/src/ ../src/ \
         ../../../src/ @GPGME_QT5_LIBS@ @GPG_ERROR_LIBS@ \
-AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
+AM_CPPFLAGS = -I$(top_srcdir)/lang/qt/src -I$(top_srcdir)/lang/cpp/src \
+              -I$(top_builddir)/src \
-              -I$(top_srcdir)/lang/qt/src \
 if WANT_QT6

I'll swap us over to out of source build for this as well. I've been doing it gradually for the gpg suite. Thanks.

ikloecker renamed this task from gpgme-1.22.0 fails to compile tests to gpgme-1.22.0 fails to compile tests (when building in source tree).Aug 23 2023, 10:09 AM
ikloecker closed this task as Resolved.
ikloecker claimed this task.
ikloecker removed a project: Gentoo.

Fixed. Removing Gentoo tag because it's not Gentoo-specific.