ah 

well the patches are from here and mostly unmodified 
http://code.google.com/p/ccache-win32/issues/listthis is actually a win32 ccache but a few of the preprocessor variables where missing in the makefile so easy to fix 

basically it just adding -DHAVE_STRING_H -DHAVE_CTYPE_H -DHAVE_STDLIB_H -DHAVE_GETHOSTNAME and then adding ws2_32 to the libraries to link with 

theres two versions of the patch to this function (static void failed(void))
the working one is this one 
#ifdef _WIN32
    {
        PROCESS_INFORMATION pinfo;
        STARTUPINFO sinfo;
        BOOL ret;
        DWORD exitcode;
        char *args;
        extern char *argvtos(char **argv);
        ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
        ZeroMemory(&sinfo, sizeof(STARTUPINFO));
        sinfo.cb = sizeof(STARTUPINFO);
        sinfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
        sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
        sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
        sinfo.dwFlags |= STARTF_USESTDHANDLES;
        args = argvtos(orig_args->argv);
        ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, &sinfo, &pinfo);
        free(args);
        if (ret == 0)
        {
            cc_log("CreateProcessA failed\n");
            exit(1);
        }
        WaitForSingleObject(pinfo.hProcess, INFINITE);
        GetExitCodeProcess(pinfo.hProcess, &exitcode);
        CloseHandle(pinfo.hProcess);
        CloseHandle(pinfo.hThread);
        exit(exitcode);
    }
#else
    execv(orig_args->argv[0], orig_args->argv);
    cc_log("execv returned (%s)!\n", strerror(errno));
    perror(orig_args->argv[0]);
    exit(1);
#endif
the other uses a hacky mingw implementation that doesnt quite work.
full function below for visibility.
/*
  something went badly wrong - just execute the real compiler
*/
static void failed(void)
{
    char *e;
    /* delete intermediate pre-processor file if needed */
    if (i_tmpfile)
    {
        if (!direct_i_file)
        {
            unlink(i_tmpfile);
        }
        free(i_tmpfile);
        i_tmpfile = NULL;
    }
    /* delete the cpp stderr file if necessary */
    if (cpp_stderr)
    {
        unlink(cpp_stderr);
        free(cpp_stderr);
        cpp_stderr = NULL;
    }
    /* strip any local args */
    args_strip(orig_args, "--ccache-");
    if ((e=getenv("CCACHE_PREFIX")))
    {
        char *p = find_executable(e, MYNAME);
        if (!p && !(p = find_executable(e, MYNAME2)))
        {
            perror(e);
            exit(1);
        }
        args_add_prefix(orig_args, p);
    }
#ifdef _WIN32
    {
        PROCESS_INFORMATION pinfo;
        STARTUPINFO sinfo;
        BOOL ret;
        DWORD exitcode;
        char *args;
        extern char *argvtos(char **argv);
        ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
        ZeroMemory(&sinfo, sizeof(STARTUPINFO));
        sinfo.cb = sizeof(STARTUPINFO);
        sinfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
        sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
        sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
        sinfo.dwFlags |= STARTF_USESTDHANDLES;
        args = argvtos(orig_args->argv);
        ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, &sinfo, &pinfo);
        free(args);
        if (ret == 0)
        {
            cc_log("CreateProcessA failed\n");
            exit(1);
        }
        WaitForSingleObject(pinfo.hProcess, INFINITE);
        GetExitCodeProcess(pinfo.hProcess, &exitcode);
        CloseHandle(pinfo.hProcess);
        CloseHandle(pinfo.hThread);
        exit(exitcode);
    }
#else
    execv(orig_args->argv[0], orig_args->argv);
    cc_log("execv returned (%s)!\n", strerror(errno));
    perror(orig_args->argv[0]);
    exit(1);
#endif
}
hope it helps 
