Page MenuHomePhorge

Build failures of kontact in the docker container
Closed, ResolvedPublic

Description

kdepimlibs, kdepim-runtime and kdepim recently fail to build in our docker containers with a message like this:

Generating moc_testsearchplugin.cpp
/work/source/kdepimlibs/akonadi/tests/testsearchplugin/testsearchplugin.h:30: Error: Undefined interface
AUTOGEN: error: process for /work/build/kdepimlibs/akonadi/tests/testsearchplugin/moc_testsearchplugin.cpp failed:
/work/source/kdepimlibs/akonadi/tests/testsearchplugin/testsearchplugin.h:30: Error: Undefined interface

moc failed...
akonadi/tests/testsearchplugin/CMakeFiles/akonadi_test_searchplugin_automoc.dir/build.make:57: recipe for target 'akonadi/tests/testsearchplugin/CMakeFiles/akonadi_test_searchpl
ugin_automoc' failed
make[2]: *** [akonadi/tests/testsearchplugin/CMakeFiles/akonadi_test_searchplugin_automoc] Error 1
CMakeFiles/Makefile2:12997: recipe for target 'akonadi/tests/testsearchplugin/CMakeFiles/akonadi_test_searchplugin_automoc.dir/all' failed
make[1]: *** [akonadi/tests/testsearchplugin/CMakeFiles/akonadi_test_searchplugin_automoc.dir/all] Error 2
Makefile:138: recipe for target 'all' failed

The root cause of this is that moc is invoked with incorrect include paths (try make VERBOSE=1 to find how moc is invoked:):

/usr/lib64/qt4/bin/moc-qt4 \
-I/work/build/kdepimlibs/akonadi/tests/testsearchplugin \
-I/work/build/kdepimlibs/akonadi/tests \
-I/work/build/kdepimlibs/akonadi \
-I/work/build/kdepimlibs/akonadi/kmime \
-I/work/build/kdepimlibs/kmime \
-I/work/source/kdepimlibs/akonadi/tests/testsearchplugin \
-I/work/source/kdepimlibs/akonadi \
-I/work/source/kdepimlibs \
-I/work/build/kdepimlibs \
-I/work/install/include/KDE \
-I/usr/include/KDE \
-I/usr/include/phonon \
-I/usr/include/QtXmlPatterns \
-I/usr/include/QtXml \
-I/usr/include/QtWebKit \
-I/usr/include/QtUiTools \
-I/usr/include/QtTest \
-I/usr/include/QtSvg \
-I/usr/include/QtSql \
-I/usr/include/QtScriptTools \
-I/usr/include/QtScript \
-I/usr/include/QtOpenGL \
-I/usr/include/QtNetwork \
-I/usr/include/QtMultimedia \
-I/usr/include/QtHelp \
-I/usr/include/QtDesigner \
-I/usr/include/QtDeclarative \
-I/usr/include/QtDBus \
-I/usr/include/Qt3Support \
-I/usr/include/QtGui \
-I/usr/include/QtCore \
-I/usr/include/Qt \
-I/usr/lib64/qt4/mkspecs/default \
-I/work/install/include/akonadi/private \
-I/usr/include \
-I/usr/include \
-DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=12 \
-DKDE_DEFAULT_DEBUG_AREA=5250 \
-DKDE_DEPRECATED_WARNINGS \
-DQT_NO_CAST_TO_ASCII \
-DQT_NO_STL \
-DQT_USE_QSTRINGBUILDER \
-D_BSD_SOURCE \
-D_DEFAULT_SOURCE \
-D_REENTRANT \
-D_XOPEN_SOURCE=500 \
-o /work/build/kdepimlibs/akonadi/tests/testsearchplugin/moc_testsearchplugin.cpp /work/source/kdepimlibs/akonadi/tests/testsearchplugin/testsearchplugin.h

The problem is that /work/install/include is missing from the include paths as it get's stripped from the viable paths somehow.
It seems cmake is the culprit, but I'm not entirely sure.

Details

Ticket Type
Task

Event Timeline

mollekopf raised the priority of this task from to 60.
mollekopf updated the task description. (Show Details)
mollekopf changed Ticket Type from Task to Task.
mollekopf subscribed.

bash-4.3$ cmake --version
cmake version 3.3.2

on fedora 22

I think the problem is that system include paths are for some reason stripped from the list passed to the moc, but the /work/install/include directory doesn't make it into the list. If we include a symlink to /work/install/include in include_directories it appears as expected in the moc commandline.

The moc options can also be found in CMakeFiles/searchjobtest_automoc.dir/AutogenInfo.cmake

In AM_OLD_COMPILE_SETTINGS in AutomocOldMocDefinitions.cmake we can see /work/install/include as part of the passed in arguments still.

The path in AM_OLD_COMPILE_SETTINGS was probably only an artifact of me messing around, the path is not reliably included there.

Looks like using this hack works:

set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
    ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}                                                                                                                                                                                                            
    "${CMAKE_INSTALL_PREFIX}/include"                                                                                                                                                                                                                    
)
mollekopf claimed this task.

Our immediate build proplems seem to be solved with the above patch added.