From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23646 invoked by alias); 11 May 2014 18:58:32 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 23633 invoked by uid 89); 11 May 2014 18:58:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f172.google.com Received: from mail-we0-f172.google.com (HELO mail-we0-f172.google.com) (74.125.82.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 11 May 2014 18:58:30 +0000 Received: by mail-we0-f172.google.com with SMTP id k48so6029885wev.17 for ; Sun, 11 May 2014 11:58:27 -0700 (PDT) X-Received: by 10.180.74.39 with SMTP id q7mr12261770wiv.36.1399834707521; Sun, 11 May 2014 11:58:27 -0700 (PDT) Received: from [192.168.1.27] (150.Red-88-20-245.staticIP.rima-tde.net. [88.20.245.150]) by mx.google.com with ESMTPSA id fi2sm11769501wib.2.2014.05.11.11.58.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 May 2014 11:58:26 -0700 (PDT) Message-ID: <536FC851.9090804@gmail.com> Date: Sun, 11 May 2014 18:58:00 -0000 From: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= User-Agent: Thunderbird MIME-Version: 1.0 To: moze CC: gcc-help@gcc.gnu.org Subject: Re: g++ running async??? References: <01fd01cf63d3$72c66e50$58534af0$@moze.de> In-Reply-To: <01fd01cf63d3$72c66e50$58534af0$@moze.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00039.txt.bz2 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.