Author Topic: ccache to speed up builds  (Read 22738 times)

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: ccache to speed up builds
« Reply #15 on: May 11, 2010, 08:58:45 pm »
oups didnt notice that it indeed worked  :lol:

aye my ccache version had a few patches to fix some broken behaviour :)

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #16 on: May 23, 2010, 12:30:40 am »
just made a test and it works ok if done like in the image.

Could you please clarify? The *only* change you made (besides copying ccache.exe to the mingw bin directory) was to set that preprocessor variable and nothing else? You left the toolchain properties untouched, is that it?

Ken

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: ccache to speed up builds
« Reply #17 on: May 23, 2010, 12:22:45 pm »
i believe so as that is what i do when i use it :)

but i may be wrong.

problem on my side is i cant set it in the toolchain or codeblocks will throw an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!] selected at me :)

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #18 on: May 23, 2010, 06:36:53 pm »
i believe so as that is what i do when i use it :)

but i may be wrong.

problem on my side is i cant set it in the toolchain or codeblocks will throw an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!] selected at me :)

I had the same problem when I tried to set the toolchain compilers, but I can't tell if just setting the var is making any difference. Under Linux I had both to use a script *and* set an environment variable (but not where you set it, It's on the "Custom variables" tab which is at the same level as the "toolchain executables" tab, just to the right of it). Under Linux it clearly works.

Windows. Meh.

Ken

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #19 on: May 23, 2010, 06:43:21 pm »
I had the same problem when I tried to set the toolchain compilers, but I can't tell if just setting the var is making any difference.

I set the "show full command line" option on, and I can confirm that ccache is *not* being called.

Any suggestions, anyone?

Ken

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7254
Re: ccache to speed up builds
« Reply #20 on: May 23, 2010, 07:07:32 pm »
Using a script on linux works, if you either put it in the same place the real compiler resides (usually /usr/bin, needs root-rights) or add the directory with the script to the Additional paths in the Toolchain executables-tab.

for gcc I use ccache-gcc with the following content:
Code
#!/bin/sh
ccache gcc $@

and for g++ I called my script ccache-g++:
Code
#!/bin/sh
ccache g++ $@


No environment-variables needed.
don't forget to make the scripts executable (
Code
chmod +x <scriptname>
[/b])

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: ccache to speed up builds
« Reply #21 on: May 23, 2010, 10:42:44 pm »
one way to check if its working with the CC=ccache gcc variable on windows is looking in c:\username\appdata\roaming if theres a .ccache folder there with a lot of odly named files in it then it works ;)

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #22 on: May 23, 2010, 11:20:42 pm »
Using a script on linux works, if you either put it in the same place the real compiler resides (usually /usr/bin, needs root-rights) or add the directory with the script to the Additional paths in the Toolchain executables-tab.

Hi Jens,

I got it working under Linux, the problem is with windows...

Thanks anyway,
Ken

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #23 on: May 23, 2010, 11:40:22 pm »
one way to check if its working with the CC=ccache gcc variable on windows is looking in c:\username\appdata\roaming if theres a .ccache folder there with a lot of odly named files in it then it works ;)

There is only one file in that folder, called "stats".

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7254
Re: ccache to speed up builds
« Reply #24 on: May 24, 2010, 12:05:07 am »
ccache-gcc.bat:
Code
@echo off
ccache "gcc %*"

ccache-g++.bat:
Code
@echo off
ccache "g++ %*"

Put them into the system-path or MinGW's bin-folder should work.
I used the "Additional paths" in "Toolchain executables"-tab.
Tested on my virtual(kvm/qemu)-vista-system.

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #25 on: May 24, 2010, 12:21:10 am »
ccache-gcc.bat:
Code
@echo off
ccache "gcc %*"

ccache-g++.bat:
Code
@echo off
ccache "g++ %*"

Put them into the system-path or MinGW's bin-folder should work.
I used the "Additional paths" in "Toolchain executables"-tab.
Tested on my virtual(kvm/qemu)-vista-system.


It works here - I used mingw32-gcc and mingw32-g++, I don't know if this makes any difference.

Thanks once again!

Ken

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #26 on: May 24, 2010, 12:26:27 am »
Now, is there anything that can speed up linking as well?

Ken

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: ccache to speed up builds
« Reply #27 on: May 24, 2010, 01:46:42 am »
nothing usable from within codeblocks i believe :(

theres a tool from thor lilquist he uses for gtk building but it relies heavily on bash and is more of a replacement for libtool.

ld isnt that slow to be frank since its a real program i dont find linking times to be any scary with gcc :) not even for huge libraries like wxwidgets monolithic.

and libtool can make a grown man cry on windows  :lol:

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: ccache to speed up builds
« Reply #28 on: May 24, 2010, 02:04:54 am »
ld isnt that slow to be frank since its a real program i dont find linking times to be any scary with gcc :) not even for huge libraries like wxwidgets monolithic.
Try to code using boost::bind and boost::function.... my app was 10k LOC and the linking was slow.

For linux there is the gold linker that is said to be faster than ld, but it is linux only. http://en.wikipedia.org/wiki/Gold_%28linker%29
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: ccache to speed up builds
« Reply #29 on: May 24, 2010, 02:21:33 am »

ld isnt that slow to be frank since its a real program i dont find linking times to be any scary with gcc :) not even for huge libraries like wxwidgets monolithic.

and libtool can make a grown man cry on windows  :lol:

Hehe. :)

You do have a point about the linking times not being that large, but anything that you can shave off during a heavy debug-rewrite-recompile-debug session is welcome...

Ken