From: Justin Pryzby <pryzby@telsasoft.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Cc: Melanie Plageman <melanieplageman@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Daniel Gustafsson <daniel@yesql.se>
Subject: Re: ccache, MSVC, and meson
Date: Tue, 24 May 2022 14:52:02 -0500
Message-ID: <20220524195202.GK19626@telsasoft.com> (raw)
In-Reply-To: <20220524193059.n432rlzezckxr6x2@alap3.anarazel.de>
References: <20220522232606.GZ19626@telsasoft.com>
<20220524193059.n432rlzezckxr6x2@alap3.anarazel.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, andres@anarazel.de, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andrew@dunslane.net, thomas.munro@gmail.com, melanieplageman@gmail.com, peter.eisentraut@enterprisedb.com, daniel@yesql.se
Subject: Re: ccache, MSVC, and meson
In-Reply-To: <20220524195202.GK19626@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox