public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ángel González" <keisial@gmail.com>
To: moze <moze@moze.de>
Cc: gcc-help@gcc.gnu.org
Subject: Re: g++ running async???
Date: Sun, 11 May 2014 18:58:00 -0000	[thread overview]
Message-ID: <536FC851.9090804@gmail.com> (raw)
In-Reply-To: <01fd01cf63d3$72c66e50$58534af0$@moze.de>

moze wrote:
> 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???
Maybe your g++ is spawning another process and returning without waiting 
it? Seems
an odd behavior (many makefiles would break, just as your program) but 
that's what the
behavior suggests.
I would strace your g++ looking for file and process creation.

  reply	other threads:[~2014-05-11 18:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 17:50 moze
2014-05-11 18:58 ` Ángel González [this message]
2014-04-30  8:24 moze
2014-04-30 13:11 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536FC851.9090804@gmail.com \
    --to=keisial@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=moze@moze.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).