X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:reply-to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=OtzkwWxLX94W/1i5
	LCfA597jVLUkYY9V678p1MirYtgK8WH3IVi3d469Plw05rDWob44jO2KqiTmHcb2
	UKlpx6J4SGuiOIo5f3rdbJ4HFBD/tuLwlQwf8gS+RZ4oI2HuwVO0YkHS9bKgq8o8
	7dZdYnse3Tl2hjnHrY0a3Ukc2Xk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:reply-to:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=DMoM3+IrvtBLDBT4nEiIcU
	Pih4k=; b=t7ooLGeJlth5C0+wqRwtAkDQooLfHH4Yt4dnlKPYBLbs8AOnL0mk1I
	tNYz5DmG+uC6VRFwhH1CBX2+P4QmBBtAxcJFC0LVyONgn4tVFeDVa8kFRpMdpBe4
	Pt5FBGcQm6YPVORNMtuUYS9dzZouvBKRzk/hl/+v90SQWpZ0zIv2M=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
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_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit, story
X-HELO: mail-io0-f169.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:subject:to:references:reply-to:from:message-id         :date:user-agent:mime-version:in-reply-to:content-language         :content-transfer-encoding;        bh=BOcwHVtw/KFWSS06h4UnPYmD8QFMON3rgdFY8FJalZ8=;        b=ZhgyL95gIGszLJf+TCM+XpHTBfGoxjiK0jPPE19gL5g4RRcq5pqml8Pn7oIk9lC1E5         YQDOmzsirrF2LYh916Pv4+rr9ljEvLIEjwLQMMUx555TW7SP9OtsUuEotncatrcnRC2X         7fsgUE+omCc1mtiRutCXD1aktOHcSQ0wuJRdXaWnEGfM/u8bYqIfTTz9040ueMlG8lhc         C065FHwpqhyPwFPCnBDlr9LLay6YRsMgsCRq6YnmZnEDpxst6F4O7cYpve3/E220wIr5         2QtYeKkzlSSUw0kCB7Xtkr0vcxmR+jrQAS2j9ofMWUPrqLxZjuJHY7qDid9rUTaI77ET         fMAg==
X-Gm-Message-State: AKwxytdQMQs/CxYvdRmuSqHKXa9Dut/YiZOoUBlyACiIULQ39f2IWrSF	a3v6I1ABNyIwXBpRJibM0ibtRg==
X-Google-Smtp-Source: AH8x225HWFqcf14ZnxQgEchILXmTsFpResfIANBlCOlK0GRQfL/7viDW1Epsqkwu18FruEPpSmCysw==
X-Received: by 10.107.178.195 with SMTP id b186mr41625392iof.9.1517493855609;        Thu, 01 Feb 2018 06:04:15 -0800 (PST)
Subject: Re: Extremely slow compilation of C++ because of cc1plus does bad systemcalls
To: cygwin@cygwin.com
References: <CAP-WjibSr5rB6iN5b86Ndr0u4-onihZf=JApEqKOG3EY4+8CRA@mail.gmail.com> <CAEhDDbCGmRwJqRJ=9aCaA-55v0ngqS3iHwHZb_qVVYuzt3f=Ew@mail.gmail.com>
Reply-To: cygwin@cygwin.com
From: cyg Simple <cygsimple@gmail.com>
Message-ID: <73e4785e-6088-8fe2-9e8c-345d13222f8a@gmail.com>
Date: Thu, 1 Feb 2018 09:04:13 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <CAEhDDbCGmRwJqRJ=9aCaA-55v0ngqS3iHwHZb_qVVYuzt3f=Ew@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes

On 2/1/2018 4:04 AM, Csaba Raduly wrote:
> Hi Magnus,
> 
> 
> On Thu, Feb 1, 2018 at 8:45 AM, Magnus Persson  wrote:
>> When compiling a very small and simple C++ program (which took 6
>> seconds), i profiled the execution. cc1plus was speding a lot of time
>> trying to create .exe-files AND .lnk-files.
>>
>> This was the command-line:
>> g++ -c -O0 -DGTEST_DONT_DEFINE_FAIL  -std=gnu++14 -Iw64
>> -Icommon/freertos/include  -Iw64/config/ -Icommon -Icommon/dali
>> -Icommon/debug -Icommon/config  -isystem ../Tools/googletest/include
>> -isystem ../Tools/googlemock/include -DUNITTEST -g -Wall -Werror
>> -pthread  unittest/block_hvac_unittest.cc -o
>> obj_unit_linux/unittest/block_hvac_unittest.o
>>
>> I used procmon to capture all system-calls done. This is a part of
>> what happened:
>> (search for .exe  AND .lnk)
>> Why does the preprocessor try to create these files (my command is
>> just trying to compile (no linking)) ?
>>
> (snip)
>> 08:25:49.3882166 cc1plus.exe 7256 CreateFile
>> C:\cygwin64\lib\gcc\x86_64-w64-mingw32\6.4.0\include\c++\backward\clwbintrin.h.lnk
>> NAME NOT FOUND Desired Access: Read EA, Read Attributes, Read Control,
>> Disposition: Open, Options: Open Reparse Point, Attributes: n/a,
>> ShareMode: Read, Write, Delete, AllocationSize: n/a
>> 08:25:49.3882946 cc1plus.exe 7256 CreateFile
>> C:\cygwin64\lib\gcc\x86_64-w64-mingw32\6.4.0\include\c++\backward\clwbintrin.h.exe.lnk
>> NAME NOT FOUND Desired Access: Read EA, Read Attributes, Read Control,
>> Disposition: Open, Options: Open Reparse Point, Attributes: n/a,
>> ShareMode: Read, Write, Delete, AllocationSize: n/a
> 
> 
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa363874(v=vs.85).aspx
>  (Creating and Opening Files) says
> 
> "The CreateFile function can create a new file or open an existing file. "
> 
> 
> The options specified ( Desired Access: Read EA, Read Attributes, Read
> Control, Disposition: Open, Options: Open Reparse Point ) suggest that
> the compiler is trying to read, or is checking the existence of these
> files.
> 

That's not the whole story.  It's Cygwin the OP is using and every file
function will check for FILE.exe if FILE doesn't exist and then FILE.lnk
if FILE.exe doesn't exist.  If the OP doesn't want this then use the
native versions of the compilers instead of the Cygwin cross compiler.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

