Re: ccache, MSVC, and meson

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: ccache, MSVC, and meson
Дата
Msg-id 20220524195202.GK19626@telsasoft.com
обсуждение исходный текст
Ответ на Re: ccache, MSVC, and meson  (Andres Freund <andres@anarazel.de>)
Ответы Re: ccache, MSVC, and meson  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Tue, May 24, 2022 at 12:30:59PM -0700, Andres Freund wrote:
> Hi,
> 
> On 2022-05-22 18:26:06 -0500, Justin Pryzby wrote:
> > forking: <20220307191054.n5enrlf6kdn7zc42@alap3.anarazel.de>
> > 
> > An update.
> > 
> > ccache 4.6.1 was released which allows compiling postgres
> > I submitted a request to update the package in chocolatey.
> > 
> > But with the existing build system, it's no faster anyway, I guess due to poor
> > use of parallelism.
> > https://cirrus-ci.com/task/5972008205811712
> 
> No, because it never uses caching, because the way we set the output director
> causes ccache to never cache.

I think you're referring to the trailing backslash in the MSVC project file,
meaning "write to a filename under this directory":

src/tools/msvc/MSBuildProject.pm:
<ObjectFileName>.\\$cfgname\\$self->{name}\\</ObjectFileName>

ccache was fixed to handle that in 4.6, and could be worked around before that
by adding "%(Filename).obj".

https://github.com/ccache/ccache/issues/1018

In any case, it really is caching, but without any positive effect:

[17:02:01.555]   Hits:            1398 / 1398 (100.0 %)
[17:02:01.555]     Direct:        1398 / 1398 (100.0 %)
[17:02:01.555]     Preprocessed:     0 /    0
[17:02:01.555]   Misses:             0
[17:02:01.555]     Direct:           0
[17:02:01.555]     Preprocessed:     0
[17:02:01.555] Primary storage:
[17:02:01.555]   Hits:            2796 / 2796 (100.0 %)
[17:02:01.555]   Misses:             0

> > Currently, meson doesn't (automatically) use ccache with MSVC - see
> > mesonbuild/environment.py.
> > 
> > And CC=ccache gives an error - I suppose it should not try to pop ccache off the
> > compiler list if the list has only one element.
> > [...]
> 
> > But it can be convinced to use ccache by renaming the executable to "pgccache".
> > Which builds in 46sec: https://cirrus-ci.com/task/4862234995195904
> > This requires ccache 4.6, released in Feburary and already in choco.
> > Note that ccache supports neither /Zi debugging nor precompiled headers.
> > I'm not sure, but -Dc_args=/Z7 may do what's wanted here.
> 
> The spurious message should be fixed, of course. I suspect you dont need a
> wrapper, you can just set CC='ccache cl.exe' or similar? Afaics it's not
> meaningful to do 'CC=ccache.exe' alone, because then it'll interpret arguments
> as ccache options, rather than compiler options.

if meson didn't crash CC=ccache.exe might have worked, because I had set
CCACHE_COMPILER.

As I recall, CC='ccache cl.exe' didn't work because it didn't attempt to do any
argument splitting.

The copy of ccache.exe is necessary because otherwise ccache "skips" over any
leading "ccache[.exe]" components while searching for the real compiler.

This is the only way I've gotten it to work (but feel free to comment at:
https://github.com/ccache/ccache/issues/1039)

-- 
Justin



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Matthias van de Meent
Дата:
Сообщение: Re: adding status for COPY progress report
Следующее
От: Zhihong Yu
Дата:
Сообщение: Re: adding status for COPY progress report