1

I am not able to set up Ccache on Windows using Cygwin.

What do i want to do ? I want to install CCache on a Windows PC so i could use it to compile C and C++ projects.

I have almost no Knowledge about C/C++ and the whole GCC/G++ Compiler thing.
main sources for my approaches:
- https://wiki.archlinux.org/index.php/ccache
- http://charette.no-ip.com:81/programming/2016-02-07_CCache/index.html
- https://askubuntu.com/questions/470545/how-do-i-set-up-ccache

Ccache is made for Unix-systems only so in order to get the bash commands i installed Cygwin for windows.
I have also installed MinGW32 on my C:/ drive. In Cygwin I installed the following packages: (View: Picked)

- autoconfig                    13-1
- ccache                        3.1.9-2
- ccache-debuginfo              3.1.9-2
- fish                          2.7.0-1
- gcc-tools-epoch2-autoconf     2.64-2
- gperf                         3.1-1
- libgcc1                       7.4.0-1
- make                          4.2.1-2
- mingw64x86_64-gcc-core        7.4.0-1
- mingw64x86_64-gcc-debuginfo   7.4.0-1
- mingw64x86_64-gcc-g++         7.4.0-1

After the installation i can use "ccache -V" inside Cygwin and it tells me i got version 3.1.9

according to the tutorials i am following i should get:

/usr/lib/ccache/gcc 
/usr/lib/ccache/g++

if i type the command: "which gcc g++".
But i am getting as default the following:

/cygdrive/c/mingw/bin/gcc
/cygdrive/c/mingw/bin/g++

So i wanted to change the path. But the structure of ccache inside cygwin seems to be way different then it is when you install it with sudo on a unix machine.
I cant find any gcc or g++ compilers inside ccache or at all in cygwin.
But ccache is also not at usr/lib/ccache in cygwin. If i type in "which ccache" it gives me the path usr/bin/ccache.

I am out of ideas and it seems like i just dont have enough knowledge about C compilers in general to get an idea of what to do / where to search.

Saturas
  • 535
  • 1
  • 4
  • 12
  • 1
    Visual Studio has also "precompiled headers" to do what you want. Forget anything cygwin-related and generally, anything that tries to implement linux programming aspects in Windows. – Michael Chourdakis Apr 10 '19 at 11:01
  • I would like to walk you through setting this up because it's not hard. But maybe you could add a little something more about what kind of "C and C++ projects" you want to build. Do you mean just some generic Windows programs (in which case you're better off using Visual Studio)? Or are you trying to compile Linux and/or POSIX-oriented code with their associated build tools? What *specifically* are you trying to do. – Iguananaut Apr 11 '19 at 10:01
  • As for Cygwin vs MingGW, these are two separately, mostly mutually incompatible things. MinGW is a collection of common UNIX build and build-related tools compiled natively for Windows, so that it's easy to run gcc on Windows and some other things, but it does not provide a full POSIX emulation layer. That's what Cygwin does. Cygwin is providing a more "complete" UNIX-like experience on Windows with support for compiling and running *most* POSIX-compliant code with little to no modification. If you want a full UNIX-like experience on a Windows desktop use that. – Iguananaut Apr 11 '19 at 10:04
  • The reason `which gcc` returns something in `/cygdrive/c/mingw` is that somehow or other you've ended up (maybe via a `.bashrc` or a `.profile`)? with a configuration that's putting `C:\MinGW` too early on your `$PATH`. That, or you simply haven't installed Cygwin's gcc package. – Iguananaut Apr 11 '19 at 10:08
  • 1
    The installation path of ccache's compiler wrappers like `/usr/lib/ccache/gcc ` is not on your `$PATH` by default. The usual thing to do for setting up ccache is then to manually create a symbolic link like `ln -s /usr/lib/ccache/gcc /usr/local/bin/gcc`. `/usr/local/bin` is usually before `/usr/bin` on `$PATH` so that will override your default `gcc`. – Iguananaut Apr 11 '19 at 10:08
  • Actually i wont do anything with it. My task is just to set ccache up and write a "how to" so someone could use it in the future on a windows pc to compile his c/c++ projects. I managed to compile ccache now with cygwin. I used the commands, given in the INSTALL.md , inside cygwin-console while beeing in the downloaded Ccache folder i got from gitHub. https://github.com/ccache/ccache/blob/master/doc/INSTALL.md . I didnt check everything but if i am not wrong i can now use that generated ccache.exe to compile code using ccache. – Saturas Apr 11 '19 at 13:19
  • I will keep this question updated about my progress. For now i managed to get the ccache.exe. – Saturas Apr 11 '19 at 13:25
  • Before you even look at ccache (again), you need to understand how to run the C and C++ compiler tool chains without it. I have never, in well over 10 years using cygwin, encountered a situation where I have felt a need to speed up C and C++ compilations. Try your biggest compilations, if they are in fact unreasonably slow, then look for solutions. Personally, I do not believe a learner should attempt to write a tutorial, it is just fumbling in the dark. BTW, "which -a gcc" will show you all "gcc" exes in the order they are found in the path. – Doug Henderson Apr 11 '19 at 14:55
  • As i said i wont compile in the near future ^^ its basicly a task given to me personally i only code in Java/C#/groovy maybe Typescript/Javascript but not C or C++ . Anyways with the ccache.exe i can now compile with the ccache flag. I cant tell if its alot faster because i dont have a big C/C++ project. And i really only needed cygwin (with the autoconf and gperf package) to compile ccache for the exe. But my task is done for now so thanks for all the comments. – Saturas Apr 12 '19 at 07:49

0 Answers0