PDA

View Full Version : exteremely slow automoc generation on clang



avanindra
24th December 2015, 08:03
Hi,


I have a project based on Qt and cmake. I am facing an issue of extremely slow automoc generation while compiling on clang Mac OS X. It runs fine on windows( msvc ) and linux( gcc ). Can you please help me identify possible cause for it , or it's natural to be slow on clang. Some times it takes 20 minutes for generating 10 moc files. I am using Qt 5.5 , though I faced same problem with Qt 5.4 too. I have tried Makefile as well as Xcode , in both the cases , automoc is very slow.

anda_skoa
24th December 2015, 12:28
Do you mean compiling the moc generated files is slow or moc generating these files?

Cheers,
_

avanindra
24th December 2015, 13:00
The moc generation is very slow. The build process almost hangs while generating the moc files. Most of the time it happens for the files containing classed extended with QObject. Compilation of moc is swift.

anda_skoa
24th December 2015, 13:22
Then it is unrelated to clang as clang is only involved when compiling the generated files, not in their generation.

You could try to manually run a single moc invocation to check if this is already slow or if the make tool running the moc rules is slow.

Cheers,
_

avanindra
24th December 2015, 13:33
I have never generated moc manually before. What's the command for doing that?...do I need to use qmake?...

anda_skoa
24th December 2015, 13:55
It is basically something like


moc -o somefile_moc.cpp somefile.h

but you can also check the Makefile cmake generated.

qmake is not required for a CMake project.

Cheers,
_