[Development] two questions about the build system of Qt
Thiago Macieira
thiago.macieira at intel.com
Tue Nov 29 21:37:56 CET 2016
On terça-feira, 29 de novembro de 2016 12:14:55 PST Thiago Macieira wrote:
> > 2. The target for .obj/qgrayraster.o in the Makefile in qtbase/src/gui has
> > a dependency on .pch/Qt5Gui.gch/c, but we noticed that during the build,
> > the .pch/Qt5Gui.gch/c++ file is also read. Is there a reason why gcc would
> > read the c++ file during the build? E.g. because c and c++ code is being
> > mixed? We do not observe similar behaviour (i.e., the c file being read by
> > g++) for targets that are compiled from .cpp files.
>
> I can confirm it with strace. Seems like a bug because there is no C++ code
> mixed in for that particular compilation. You should check with GCC folks.
Looks like it's normal behaviour. Strace shows:
open("./.pch/Qt5Gui.t.gch", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
open("./.pch/Qt5Gui.t.gch/c++", O_RDONLY|O_NOCTTY) = 4
open("./.pch/Qt5Gui.t.gch/c", O_RDONLY|O_NOCTTY) = 4
So it's actually reading from the directory and opening all files it finds there
until it finds one that is a valid GCC preprocessor output for the current
language. Since the buildsystem creates the C++ preprocessed header first (more
files depend on it), it's first in the directory listing.
This is confirmed by running gcc with -H option. It prints:
x ./.pch/Qt5Gui.t.gch/c++
! ./.pch/Qt5Gui.t.gch/c
Its documentation says:
'-H'
Print the name of each header file used, in addition to other
normal activities. Each name is indented to show how deep in the
'#include' stack it is. Precompiled header files are also printed,
even if they are found to be invalid; an invalid precompiled header
file is printed with '...x' and a valid one with '...!' .
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list