[cmake-developers] [CMake 0014379]: CMAKE_AUTOMOC feature ignores dependencies and thus is not parallel safe
Mantis Bug Tracker
mantis at public.kitware.com
Wed Aug 28 11:22:17 EDT 2013
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=14379
======================================================================
Reported By: Piotr Pietraszkiewicz
Assigned To:
======================================================================
Project: CMake
Issue ID: 14379
Category: CMake
Reproducibility: random
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-08-28 11:22 EDT
Last Modified: 2013-08-28 11:22 EDT
======================================================================
Summary: CMAKE_AUTOMOC feature ignores dependencies and thus
is not parallel safe
Description:
CMAKE_AUTOMOC feature ignores dependencies and thus is not parallel safe
In a monstrous project I'm working on, build parallel, a following types of
compilation errors manifest themselves:
* in module afsdlg
> in file included from
> /artrepo/webroot/ppi/ems_pb/src/afs/dlg/CAfsDialogMREKO.cpp:160:
> /artrepo/webroot/ppi/ems_pb/build/afs/dlg/moc_CAfsDialogMREKO.cpp:44:
> error: ‘OBStubImpl_bas::idl::afs’ has not been declared
In the example the "OBSTubImpl_bas" string is nowhere to be found in the
CAfsDialogMREKO.cpp nor in the corresponding CAfsDialogMREKO.h file on which
the "moc" is run. Still the symbol shows up in the generated moc file
(moc_CAfsDialogMREKO.cpp) by which the generated file gets broken.
Digging deeper I found the "OBSTubImpl_bas" string in the header files
generated(by IDL compiler) of another module (basidl).
I also discovered, contrary to the information spread on the web, that the moc
tool pre-processes its input files.
So what, happens in my project is this:
The moc tool runs parallel to the IDL generation. The moc input
(CAfsDialogMREKO.h) indirectly includes the header files generated by IDL
compiler. Both run parallel and the IDL generation is still not finished while
the moc pre-processes the half baked IDL generated headers. It gets confused
and includes the symbols found in those headers in the generated moc_XXX files
(which is bad).
However, this shouldn't happen, because the target that generates the moc
depends on the target that triggers the IDL compiler:
* snippet of afs/dlg/CMakeLists.txt
> project( afsdlg )
> ..
> set(CMAKE_AUTOMOC TRUE)
>
> add_library( afsdlg SHARED ${afsdlg_SRCS} ${afsdlg_HDRS})
>
> add_dependencies( afsdlg arcarvidl basidl tbsidltyp psupdaidl )
, where basidl is the target that triggers the IDL compiler.
Still inspecting the build log reveals that it does, and that generation of moc
and IDL indeed get intermixed:
* beautified build log
> [ 2%]
> Generating ISysMld_idl.cpp, ISysMld_idl.h, ISysMld_skel_idl.cpp, ...
> Generating moc_CAfsDialogMREKO.cpp
> ..
> [ 2%]
> Generating Message_idl.cpp, Message_idl.h, Message_skel_idl.cpp, ...
> ..
> [ 99%] Building CXX object afs/dlg/...
> .. error: ‘OBStubImpl_bas::idl::afs’ has not been declared
, where moc_CAfsDialogMREKO.cpp is from the 'afsdlg' project and ISysMdl_idl*
and Message_idl* are from the 'basidl' target
A working workaround is not to use 'set(CMAKE_AUTOMOC TRUE)' but rather
rely on the QT4_AUTOMOC or QT4_WRAP_CPP macros.
The issue is not critical because there are alternatives. However, I saw
discussions about deprecating the working QT4_AUTOMOC and QT4_WRAP_CPP macros
(or not providing them for QT5) and hence this report.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-08-28 11:22 Piotr PietraszkiewiczNew Issue
======================================================================
More information about the cmake-developers
mailing list