Page MenuHome GnuPG

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

Description

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....

Details

Version
1.22.0

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/Makefile.am b/lang/qt/tests/Makefile.am
index 32ad6466..aedd3264 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -51,10 +51,10 @@ LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
         ../../../src/libgpgme.la @GPGME_QT5_LIBS@ @GPG_ERROR_LIBS@ \
         @GPGME_QT5TEST_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
 
-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 \
               @GPG_ERROR_CFLAGS@ @GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ \
               @LIBASSUAN_CFLAGS@ @GPGME_QT5TEST_CFLAGS@ -DBUILDING_QGPGME \
-              -I$(top_srcdir)/lang/qt/src \
               -DTOP_SRCDIR="$(top_srcdir)"
 endif
 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.