View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014379CMakeCMakepublic2013-08-28 11:222016-06-10 14:31
ReporterPiotr Pietraszkiewicz 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityrandom
StatusclosedResolutionmoved 
PlatformLinuxOSOS Version
Product VersionCMake 2.8.11.1 
Target VersionFixed in Version 
Summary0014379: CMAKE_AUTOMOC feature ignores dependencies and thus is not parallel safe
DescriptionCMAKE_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.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036306)
Piotr Pietraszkiewicz (reporter)
2014-07-02 10:29

What's the status here?
Let me rephrase: inter-target dependencies are ignored by CMAKE_AUTOMOC.
Reproducibility is 100%, but the problems this creates may be random.
(0042356)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-08-28 11:22 Piotr Pietraszkiewicz New Issue
2014-07-02 10:29 Piotr Pietraszkiewicz Note Added: 0036306
2016-06-10 14:29 Kitware Robot Note Added: 0042356
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team