Web lists-archives.com

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




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.

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
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