[ccache] [ccache/ccache] Visual C/C++ compatibility (#162)

Jean-Dominique GASCUEL JD.Gascuel at free.fr
Sun Mar 19 12:34:15 UTC 2017

Dear Joel, Dear Anders, 

Sorry for the whitespace mess:  I did not know about the uncrustify stuff. I added it in my pre-commit hook, so this should append again.

I now have a running version on AppVeyor (https://ci.appveyor.com/project/jd-gascuel/ccache <https://ci.appveyor.com/project/jd-gascuel/ccache>):
- It is automatically build with your autogen / configure / make suite
- it is compiled with Visual 2013 and Visual 2015 compilers, in either 32 and 64 bits versions.
- it pass the internal unit tests
- one can download a compiled alpha version (eg. https://ci.appveyor.com/api/buildjobs/86tv41vdbkr29u9a/artifacts/ccache.exe <https://ci.appveyor.com/api/buildjobs/86tv41vdbkr29u9a/artifacts/ccache.exe>)

To do so:
- I had to fix 2 bugs from the original ccache sources, when compiled in WIN32 environment. I guess you could cherry-pick them:
  o make_relative_path(char *path) does a free(path+1):
     https://github.com/jd-gascuel/ccache/commit/3160e9e3928d33ade688510f856cae653b08ed07 <https://github.com/jd-gascuel/ccache/commit/3160e9e3928d33ade688510f856cae653b08ed07>
  o hash_command_output() makes a double free of win32args == cmd
     https://github.com/jd-gascuel/ccache/commit/936a295336bddab9fb1d77183ae2545df2d26560 <https://github.com/jd-gascuel/ccache/commit/936a295336bddab9fb1d77183ae2545df2d26560>

- I had to upgrade config.guess and config.sub to the latest version. The old version (2012-07-31) did not 
  recognise my MSYS2 build image. This seems to make Travis shock: I’ll have a look there.

- I made quiet a few changes in configure.ac, Makefile.in and dev.mk.in. The main challenge there was:
  o $(CC) was used both for compilation and link. On Windows it is two separate executables.
  o Use of standard OBJEXT to manage .o vs. .obj, and of new LIBEXT to manage .a vs. .lib
  o Use different compile options (eg. -nologo -MD -O3 -W3). And link options too.
  o Visual have a different syntax to compile objects: “cl -Fofoo.obj -c foo.c” instead of “gcc -o foo.o -c foo.c”
  o Visual have a different syntax to force include (“-FIconfig.h” instead of “—include config.h”)
 … and mainly the fact this was my first autoconf project, my first MSYS project and my first AppVeyor project too.

Things I would like to do now:
- Make sure Travis works again !
- Make it run for another compiler (mingw32 and mingw64 ?) because some config stuff do not use the proper predicate yet.
- Make test.sh to run with cl.exe, if easy.
- Add a few unit tests for WIN32 specific paths and options.

- Any advice on how to do simpler ?
- Any advice on things I should do differently to better suite your taste ?
- How do you prefer I manage the configuration stuff: in configure.ac (eg. settings a LINK variable) or in Makefile (using ifeq()) ?

Thanks again for your time,
JD dot Gascuel at free dot fr
> On 17 Mar 2017, at 20:32, Anders Björklund <notifications at github.com> wrote:
> Seems that there is an awful lot of hacks needed to support this platform and compiler.
> And the whitespace issues have only gotten worse ? Maybe it is not feasible to do this...
>> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub <https://github.com/ccache/ccache/pull/162#issuecomment-287450486>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AZEC1tRjlMH51dZBDF9TtlhEUJYwtBrnks5rmt-zgaJpZM4MaPob>.

More information about the ccache mailing list