This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extremely slow compilation of C++ because of cc1plus does bad systemcalls


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]