g++ running async???
moze
moze@moze.de
Tue Apr 29 17:50:00 GMT 2014
Hi,
I have a weired phenomena, I want to discuss before filing a bug report.
Sorry, source+data is too big for posting.
I have a Programm(in C++) that calls "g++" to compile a number of cpp-files
and afterwards calls "ar" to build a static lib.
Both "g++" and "ar" are executed using posix_spawnp()+waitpid() (fork() has
same behaviour)
The Problem is that "ar" somtimes fails because the object-file I compiled
just before doesn't exist!
It seems like if waitpid() returnns before g++ is actually finished. A
simple sleep of 0.5sec avoids the problem.
The waitpid() seems to behave as expected:
1. wait longer for bigger cpp-files
2. wait-time matches output of -time
3. I get correct exit-code
But the output-file appears later, and output of -time and -v also continue
after waitpid() and even after my application has terminated...
Am I missing something obvoius???
g++ -version: g++ (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) 4.7.3
Output of run:
execute step(build)...
CC /home/programming/dlibs/DObj/dobj_object.cpp...
g++ -fPIC -Wno-trigraphs -D_REENTRANT -time -O0 -g -DDEBUG -I . -I
../delivery/include/ -c /home/programming/dlibs/DObj/dobj_object.cpp -o
objects/dobj_object.o
exec..
waited 69ms..
LNK DObj.a...
ar rcs DObj.a objects/dobj_object.o
exec..
ar: objects/dobj_object.o: No such file or directory
waited 3ms..
Exception --> link failed in (null)
moze@eddie /home/programming/dlibs $ # cc1plus 0.04 0.00
# as 0.01 0.00
Analysis of run:
exex.. + waited.. mark the time my app waits fort he execution of the line
before. That is always a little more than the sum of -time output of cc1plus
and as
Exception ist he apps reaction to the exit-code of ar
The output fort he -time option comes after the promt after the app has
finished.
Thanks in advance
Moritz
More information about the Gcc-help
mailing list