Ccache on mingw: no such file or directory

I’m trying to reduce the build time, hence, I’m experimenting with ccache.
It works fine on ubuntu and decreases build time from about 40 min to less than 10 min.
However, on Windows (MinGW), it says:
ccache: error: execv of /C/tools/msys64/mingw64/bin/g++.exe failed: No such file or directory.

The problem is, it takes forever until a new build starts, hence, the commit-build-analyse-cycle is super slow.
I’m currently investigating if the file /C/tools/msys64/mingw64/bin/g++.exe exists, expecting results in a few hours (that’s kind of frustrating…)
No idea what the nexts steps would be. Is ccache supposed to work?

Full log
.travis.yml
mingw build script

Thanks for any help!

Edit:
The file /C/tools/msys64/mingw64/bin/g++.exe exists.

You can check Windows builder snapshot 1809 to see what is preinstalled (as well as environment and registry) in a Windows image without having to run a build every time.

Ccache is not preinstalled in Windows so it’s up to you to install and set it up if you need it.

Yes, I know. I have installed it using pacman (mingw-w64-x86_64-ccache).
The problem is not that ccache is not installed or not found.

The problem is, that ccache cannot execute g++, although it seems to have the correct file path /C/tools/msys64/mingw64/bin/g++.exe

That was the answer to your question: “Is ccache supposed to work?” — “It’s up to you to make it work.”

okay, fair enough, I’ve asked that question.
The more interesting question is, however: how can I make it work?
I’ve installed ccache, and cmake finds it. Still i get this error and i have no idea where it comes from, how to debug or how to resolve it. No related issues in the internet.

Now I’m asking kindly for help, since the docs are quite sparse and they literaly say: ask for help in the forum.

Hello, I’m starting out slowly on a similar adventure.

My take was on using the “official” build of ccache for windows now that one is available, as in https://github.com/networkupstools/nut/blob/master/.travis.yml#L931 and prefixes “ccache” expicitly into “CC” or “CXX” definition as in https://github.com/networkupstools/nut/blob/master/ci_build.sh#L207 (this was needed anyway to support builds on Unix/Linux envs with non-default compilers that did not install their symlinks into ccache dir).

Per my questions at Install ccache on Windows there should also be a chocolatey package available. And if your project is not tightly married to ccache, someone there suggested a Mozilla sccache which seems decent from the project README.

Another problem I have is lack of autotools so the project can not go from configure.ac to actually building :frowning: A discussion at Install Autoconf / automake pointed to https://github.com/tanzislam/cryptopals/blob/master/.travis.yml#L131 to prepare the environment… maybe I’ll try that too.

Hope this helps,
Jim Klimov

thanks for your reply.

I have now abandoned ccache entirely and build my project with multiple cores to meet the 50-minute time limit.
I had to switch from make to ninja, because make does not support parallel build on MinGW, apparently.

So my solution is not to use ccache.
That’s sad, but maybe there is better support for it in the future.
As of today, using ccache in my project is not worth the trouble.

I’m sorry, but I can’t do your job for you (or rather, I can, but not for free) and it’s your job to diagnose problems in 3rd-party software.

I would start from checking that all files exist, and what kind of files they are (e.g. Cygwin emulates symlinks as files with special content), then using Process Monitor to find out what’s happening when the error occurs.

It looks like either your Ccache is a native Windows app and somehow gets fed a MinGW path (that it doesn’t understand) or a simulated symlink (which it doesn’t know how to deal with, either), or that g++ fails to invoke some of its underlying executables or is itself a broken symlink.

No one asked you personally to help me or to do my job.
The docs advised me to ask my question in the forum, hence, if you’re paid by travis, I think it actually is your and your colleagues’ job to help me out.
If you’re a volunteer, I’d kindly thank you very much for your time and help :blush:.

I have strong evidence that this is not a 3rd-party software issue, but rather directly linked to the travis build environment because I cannot reproduce the issue on my local system.

Thank you for the debug suggestions, I think this would be a good approach to continue (and, to be clear, I expected no more :slightly_smiling_face:).

It is my job to get my project running, I spent the last weekends on that job, now it’s done :sweat_smile: .
I hope you understand that I have little motivation to solve that ccache issue.
To turn the tables, it’s not my job to debug this very common setup, as the actual problem (i. e., the builds timed out) was solved in a different way (that does not imply it’s your job, though :wink:).

1 Like

That’s news to me. I’ve been getting by perfectly well with -j $(nproc) to make.